PDA

View Full Version : Bitmap Rotation



dekz
22-07-2006, 06:38 AM
ANy easy way to do this, rotate a img using a trackbar over 1 degree for every value the trackbar is moved in delphi 7, also without screwing with canvas drawings already drawn? cheers

dmantione
22-07-2006, 07:37 AM
Each pixel row is a line. You can calculate the new coordinates for it using simple goniometry. When you have the new cooordinates, use Bresenhams algorithm to draw the line.

WILL
22-07-2006, 09:14 AM
Hi dekz, welcome to PGD! :)

Your question is very vauge. Can you please elaborate a bit?

Are you asking about how to do a bitmap rotation algorithm? ie. Whats the math and all of that stuff?

Crusare
11-12-2006, 09:37 AM
Hi! You should use "GR_32", which is a professional utility for DelphiX. With that, you can do the rotation, and anti-aliasing, so that the picture will look just fine.

jdarling
11-12-2006, 02:07 PM
Hi! You should use "GR_32", which is a professional utility for DelphiX. With that, you can do the rotation, and anti-aliasing, so that the picture will look just fine.
Actually, GR32 is not just for DelphiX and it has never been part of DelphiX. It is a freeware opensource graphics library for Delphi (and to some extent Lazarus). For 2D games, you can even write the entire game in GR32, this has been done a few times. Sorry, just had to point that out.

The rotation routines are definately worth looking at, also worth looking at is EFG's site (googling places this in the top 3 results for "Delphi Rotate Bitmap") http://www.efg2.com/Lab/ImageProcessing/RotateScanline.htm. Ayways, hope that answers the OP question.