From article <726100620.1@freudsys.iaf>, by Renee.Teunissen@freudsys.iaf.nl (Renee Teunissen):
> I have the following "problem". for a Photo montage package i wrote a rotation tool for full color objects [bitmap images]. this program runs unther windows 3.1. but rotating these bitmaps goes very slow, eg if I do the same rotation [same image size and pixel depth] in PhotoStyler is goes much faster. anyone any smart idears about a pointer to a fast rotation algorithm ??
I'll tell you how I do my rotations. I hope it is of some help.
1] Before the process begins, I build a table of all the SIN and COS
functions. This saves me the trouble of having to compute it for
each and every point (not to mention CPU time).
2] Then it's a simple matter of using the formula [if ROT is about 0,0]:
x' = x * cos (radians) - y * sin (radians)
y' = y * cos (radians) + x * sin (radians)
radians = [Degrees Rotation] * Pi / 180
If you want to twirl the object around some other point besides (0,0) [which
will probably take more CPU time than remapping the image] then use the
formula...
x' = Xr + (X - Xr) * Cos (radians) - (Y - Yr) * Sin (radians)
y' = Yr + (Y - Yr) * Cos (radians) + (X - Xr) * Sin (radians)
I hope this is of some use to you. Let me know, okay?