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

Kevin Fishburne kevinfishburne at ...1887...
Fri Aug 6 22:48:52 CEST 2010


   "old" Nabble is falling apart. It seems to randomly fail to accept my posts.
   Good times. Anyway, here's the post bypassing Nabble:
   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:
   e-mail:
   phone:  [1]http://www.eightvirtues.com
    [2]sales at ...1887...
    (770) 853-6271

References

   1. http://www.eightvirtues.com/
   2. mailto:sales at ...1887...



More information about the User mailing list