[comp.sys.mac.programmer] Rotation of a Bit-Mapped Graphic Object

eberard@ajpo.sei.cmu.edu (Edward Berard) (09/08/88)

Some time ago I posted a request for information on rotation of
graphic objects on a Macintosh. I did receive a few replies, and I
thank all who responded. One reply was in response to another reply,
and the author was unable to post it to this newsgroup. 

The original question was: Given a bit-mapped graphics object (e.g., a
picture or an icon), and a point about which it is to be rotated, what
are some of the better ways of doing this on the Macintosh? The
response to the response  reads as follows:

>> b) Given a bit-mapped graphic object (e.g., a picture or icon) and
>
>Render the object into an off-screen bitmap. and for each pixel in
>the destination, apply the inverse transform to find the set of pixels
>that contribute to it in the source. Do the appropriate weighted sum of
>the contributing source pixels to determine the value of the destination
>pixel. (This from destination to source algorithm works much better
>than a source to destination one.)  You'll probably want to special case
>out rotations by multiples of 90 degrees.

No, please don't.  The user has better things to do than wait for you
to do a transformation for every single pixel in the image.  Instead
use two skews, one in the X direction and one in the Y direction.
Because for each line or column you are doing a linear mapping with
constant phase, you should be able to do some nice optimizations.  See
"A Nonaliasing Real-Time Spatial Transform Technique" by Karl M. Fant
in _IEEE_Computer_ _Graphics_and_Applications_, March 1986, pp. 66 and
67 for what is probably the best way of doing this.

Eric Pepke                           pepke%fsu.mfenet@nmfecc.arpa
Supercomputer Computations           pepke%scri.hepnet@lbl-csa2.arpa
   Research Institute                pepke%fsu.bitnet@cunyvm.cuny.edu
Florida State University             "It happens sometimes.  People
				     just explode. Natural causes."
Tallahassee, FL 32306-4052 


Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many
lawyers.