Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to scale a picture proportionally?

Answer: For a proportional scaling, we calculate the new picture size relative to the target maximum size.
Example
Function ProportionalScaled(extends pic as Picture, Width as Integer, Height as Integer) As Picture
// Calculate scale factor

dim faktor as Double = min( Height / Pic.Height, Width / Pic.Width)

// Calculate new size
dim w as Integer = Pic.Width * faktor
dim h as Integer = Pic.Height * faktor

// create new picture
dim NewPic as new Picture(w,h,32)

// draw picture in the new size
NewPic.Graphics.DrawPicture Pic, 0, 0, w, h, 0, 0, Pic.Width, Pic.Height

// return result
Return NewPic
End Function

This does not handle mask, but you can scale the mask the same way and assign it to the new picture.
(see other FAQ entry with mask)


The biggest plugin in space...