[Gambas-user] gb.image: how to keep a rotated image centered

kevinfishburne kevinfishburne at ...1887...
Fri Aug 6 20:09:37 CEST 2010


I'm attempting to rotate an image about its center point, using something
like:

DIM background AS Image = Image.Load("grass.png")
DIM f AS Float

FOR f = 0 TO 6.2831853 STEP 0.01
  Draw.Begin(DrawingArea)
    Draw.Image(background.Rotate(f), 0, 0)
  Draw.End
  WAIT
NEXT

The resolution of the returned rotated image actually changes based on the
angle, such that the entire original image is preserved (no clipping
occurs). This would be extremely useful in most cases, but not in mine as
I'm making a game.

Anyone know what math I should use to try to keep the rotated image centered
about its mid-point while being rotated? Thanks all.

-----
Kevin Fishburne, Eight Virtues
www:  http://sales.eightvirtues.com http://sales.eightvirtues.com 
e-mail:  mailto:sales at ...1887... sales at ...1887... 
phone: (770) 853-6271
-- 
View this message in context: http://old.nabble.com/gb.image%3A-how-to-keep-a-rotated-image-centered-tp29356475p29356475.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list