[ab] Rotozoom weirdness
Anthony Fairchild
anthonyf at blarg.net
Wed Dec 6 15:41:53 CST 2006
Hello again,
I'm playing around with SDL-GFX:ROTOZOOM, using it instead of my still
somewhat slow pure lisp surface rotating function. I had to make a
couple of modifications to the SDL-GFX code to get it to work. The
exported symbol for rotozoom is called DRAW-ROTOZOOM while this
function does not exist anywhere (perhaps not yet implemented?). I
found the ROTOZOOM function and then just inserted an export entry for
it. Here's my new ROTATE-SURFACE function:
(defun rotate-surface(surf degrees)
"Rotates a surface clockwise by degrees. Negative degrees rotates
counter-clockwise"
(sdl-gfx:rotozoom (coerce (- degrees) 'double-float)
(coerce 1.0 'double-float) 0 :surface surf))
Notice I had to coerce the rotation and zoom into 'double-float so
CFFI wouldn't complain.
So now, on to the actual problem. When the images get rotated, 90
degrees for example, I get a small black line (perhaps 1 or 2 pixels
thick) at the top of the resulting image. The image I am rotating is
a perfect square and the result is also square, but it seems to be
shifted slightly downward. When rotating the original image 180 or
270 degrees I get a similar effect at the left side and/or top of the
image.
Very strange. I wonder if this is a problem with the rotozoom code in
the DLL or if the coercion to double-float is causing this. Any
ideas?
Here's a screenshot with ROTOZOOM:
http://img402.imageshack.us/img402/8509/rotatewithrotozoompz4.jpg
Here's a screenshot with the pure lisp rotate function:
http://img49.imageshack.us/img49/146/rotatepurelispgr0.jpg
Thanks,
Anthony
More information about the application-builder
mailing list