I recently started working on an image viewing program for Mac OS X using Cocoa, and one of the features I decided to add was the ability to rotate images in 90° increments. I did some searching on the internet, and found a few things:
- Some other people who were struggling with the same thing and posted some code snippets.
- Code for a rotation function that supports arbitrary rotation and scaling.
- Apple Documentation on Drawing
Neither of the first two was exactly what I wanted—the first didn’t quite work, while the second was too complicated and, in order to support arbitrary rotation, created an NSImage object that was way too large.[Read Rest of Article]