Author
|
Topic: Rotating Images
|
Chris Boss Administrator
|
posted 05-26-2009 06:08 PM
Well I finally figured out how to rotate (bitBlt) an image using the GDI (no not GDI+, but the standard GDI). The API's use only work on Windows NT 4.0, 2000, XP and Vista. It is not supported on 95/98/ME. I am having some fun playing with this. I do have to say the API's are a little confusing IMO and not consistant (BitBlts have to be dealt with differently than regular drawing). |
Chris Boss Administrator
|
posted 05-26-2009 06:11 PM
I am not sure the best way to approach this for Sprites though, since the sprites are not drawn using the GDI (or any API's).One could draw all the frames for rotation when creating the sprite and simply flip frames, but that uses a lot more memory. Also rotation done on the fly (I would have to rotate the curent sprite image and then draw the new image into the sprite buffer) will be a lot slower than dynamically creating all the frames ahead of time. Sprites can flip though, which means that to get 360 degrees of rotation (in 1 degree intervals) would only require 90 images. |
Chris Boss Administrator
|
posted 05-27-2009 04:03 PM
Just wanted to note that GDI+ may actually use the same technique for rotating images as I have found using the GDI.GDI+ calls the same API's (from the GDI) that I am using, so it is possible this feature is actually just part of the GDI (from XP on) and GDI+ just takes advantage of it. If you would like to download a DDT app I wrote which rotates a bitmap (sorry, no source code) so you can see it be done (using the GDI alone), download using this link: http://cwsof.com/download/rotate.zip
| |