Rotating odd shaped images

Hi,
In my project where I can drag images around in the canvas I added rotation option to rotate the image. So far its good because I was using dummy graphics for testing the they are 32x32. However I’ve found out if the image isn’t perfectly square, say its taller than it is wide or whatever, and I go to rotate it parts of the image gets cut off.

I’m not sure on how get it to not cut off the rotated image.

Rotate(degrees as Double)
Var i as Integer
Var w,h as Double
Var np As Picture
Var px As  PixmapShape

w = Icon.Width
h = icon.Height

for i = 0 to GetUbound //ubound of micon
  
  px = new PixmapShape(mIcon(i))
  px.Rotation =(degrees* 3.14159 / 180)
  
  np = new Picture(w,h)//new picture
  np.Graphics.DrawObject(px,w/2,h/2)
  
  micon(i) = np
  
  
next

How do you expect this to work? You need to make the rectangle a square with the longer side of the rectangle for rotation.

Hello Eric
change your Picture Array to Pixmapshap Array and save your Pixmapshaps there in my example I created a class for it and an array of them programmed for display on its own level Test demo attached, the images may still need to be assigned

https://www.dropbox.com/scl/fo/7ahehazwb8m2vwgyd5zl7/AKUqDQU92PuHxZl6G4TN8eo?rlkey=f0eyjh9ldm8e7k9djot94hktg&dl=1

It was one of those things where I my mind went blank…

Ah cool, thanks. I’ll check that out.