UBBFriend: Email This Page to Someone!
  Computer Workshop User Forums
  Whats New ?
  Rotating Images

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Rotating Images
Chris Boss
Administrator
posted 05-26-2009 06:08 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
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     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
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     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
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

All times are EST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | Computer Workshop ( EZGUI ) Home Page

Copyright 2000 to 2007 Christopher R. Boss

Powered by: Ultimate Bulletin Board, Version 5.44
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.