Jussi Lahtinen wrote: > > There is probably more efficient ways, but quick and dirty... >
Great minds must think alike. I didn't receive a notification email about your post for some reason, but independently developed the same code almost exactly. Crazy, huh? Your code (and my code) do the trick nicely. Here's mine: http://old.nabble.com/file/p29413377/gb.image_rotate.tar.bz2 gb.image_rotate.tar.bz2 PUBLIC SUB Form_Open() ' General declarations. DIM bg_normal AS Image = Image.Load("grass.png") DIM bg_rotated AS Image DIM bg_cropped AS Image DIM f AS Float DIM t AS Float DIM frames AS Integer ' Assign initial values to variables. DrawingArea.Height = Desktop.Height DrawingArea.Width = Desktop.Width ' Rotate the background and update the drawing area. FMain.Show t = Timer FOR f = 0 TO 6.2831853 * 1 STEP 0.01 bg_rotated = bg_normal.Rotate(f) bg_cropped = bg_rotated.Copy((bg_rotated.Width - 1024) / 2, (bg_rotated.Height - 1024) / 2, 1024, 1024) Draw.Begin(DrawingArea) Draw.Image(bg_cropped, 0, 0) Draw.End frames = frames + 1 WAIT NEXT ' Display frames per second rendered. PRINT frames / (Timer - t) & " frames per second" ' End the program. QUIT END ----- Kevin Fishburne, Eight Virtues www: http://sales.eightvirtues.com http://sales.eightvirtues.com e-mail: mailto:[email protected] [email protected] phone: (770) 853-6271 -- View this message in context: http://old.nabble.com/gb.image%3A-how-to-keep-a-rotated-image-centered-tp29369608p29413377.html Sent from the gambas-user mailing list archive at Nabble.com. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
