anyone know a good site or article on doing rotation when bliting a direct draw surface to another?? or even a basic formula to get me started?
Printable View
anyone know a good site or article on doing rotation when bliting a direct draw surface to another?? or even a basic formula to get me started?
I believe the formula is...
For X: NewX = Cos(Rotation_Radian) * (Width / 2 - X)
For Y: NewY = Sin(Rotation_Radian) * (Height / 2 - Y)
I'm not too sure on that, and that method can also cause rotation holes, so be careful.
Pi = 3.14159265
X = Radias * Sin((Angle * Pi) / Total Point in Circle E.g 360 for degrees
Y = Radias * Cos((Angle * Pi) / Total Point in Circle E.g 360 for degrees
Original PostionX = Original PositionX + X
Origanal Position Y = Original Position Y - Y
Hope it Help But it doesnt Rotate an image thats a different story!
Ask if you need help on that but i cant be bothered to write it if i dont need to
Bodwad
Quote:
Originally posted by Sastraxi
and that method can also cause rotation holes, so be careful.
To get rid of the holes, do the opposite. Instead of copying every pixel from the source to the destination, loop trough the destination rectangle and get the source pixel. You might end up with the same pixel on two destination places, but that's what fills the holes :)
I've got an URL on that technique too somewhere, although it is Delphi code the theory is the same for VB...