FAST anti-aliased general image rotation!

6 posts / 0 new
Last post
TheVinn
Offline
Last seen: 1 day 1 hour ago
Joined: 29 Aug 2009 - 11:31
FAST anti-aliased general image rotation!

There is an article in Graphics Gems 1 which gives an algorithm for applying a rotation-only transformation matrix to an image, using an algorithm that is not only the fastest possible, but also provides anti-aliasing in a natural efficient manner that leverages the algorithm.

The article is in Graphics Gems I, here's the bibliographical entry:
Paeth, Alan W., A Fast Algorithm for General Raster Rotation, Graphics Gems, p. 179-195.

If you want to read the original article for free, Amazon.com has the entire book available for preview. It starts on page 179:
http://www.amazon.com/gp/reader/0122861 ... 0122861663

Unfortunately, the source code is missing, but if you can implement a simple function to apply a fractional shear to a single row or column of pixels, you can make this work.

If the Juce GraphicsSoftwareRenderer is not already using this technique for applying rotation-only transforms to images, it will get a very nice performance boost from using it!

This is particularly handy for those people who want to have animated rotating objects in their interface.

AaronLeese
AaronLeese's picture
Offline
Last seen: 2 weeks 6 days ago
Joined: 5 Feb 2009 - 17:52
Re: FAST anti-aliased general image rotation!

Nice!!! this is great stuff.

Vinn - man, you're a machine.

Aaron Leese
Stagecraft Software
-= new ways for DJs =-
Synths • Plugs • Turntablism / DJ Tech

TheVinn
Offline
Last seen: 1 day 1 hour ago
Joined: 29 Aug 2009 - 11:31
Re: FAST anti-aliased general image rotation!

Well hey...I didn't develop the algorithm...LOL...its just back in 1992 when I started my first computer job (working on Canvas at Deneba Systems) I read all the Graphics Gems and I did a lot of work with pixel processing.

But thanks :-)

ans
Offline
Last seen: 2 months 5 days ago
Joined: 7 Jan 2011 - 21:52
Re: FAST anti-aliased general image rotation!

Quote:
This is particularly handy for those people who want to have animated rotating objects in their interface.

In case it's the Mac's spinning progress indicator that you have in mind, or similar stuff, that would be a lot simpler to implement with a series of 8-12 small images rather than true image rotation computed in real time. For synth knobs and other skinned UI elements, I would also rather use prerendered images (if at all necessary).

It would however be cool to render the images once and then cache them during runtime ;-) Makes for a very easily skinnable application.

X-Ryl669
Offline
Last seen: 3 days 20 hours ago
Joined: 24 Apr 2005 - 17:30
Re: FAST anti-aliased general image rotation!

If you need some code:
http://books.google.fr/books?id=fvA7zLEFWZgC&pg=PA179&lpg=PA179&dq=a+fast+algorithm+for+general+raster+rotation

It's a good idea, but it's the kind of code I'm reluctant to use since there are many corner cases that cause a lot of "if angle is that", on top of the function, so many codepaths to tests etc.
Anyway, I'm almost sure this kind of optimization is actually implemented in OpenGL software rendering (and probably in GPU based rendering), so you can have it for free, provided you use OpenGL as the rendering primitive.

X-Ryl669

TheVinn
Offline
Last seen: 1 day 1 hour ago
Joined: 29 Aug 2009 - 11:31
Re: FAST anti-aliased general image rotation!

ans wrote:
Quote:
In case it's the Mac's spinning progress indicator that you have in mind

I was thinking more along the lines of user-content. For example, an album thumbnail that "spins" up to full screen size when touched.