Assuming you want a proportional scale (keeps the aspect ratio the same), create a function like so:
[code]Function ProportionalScale(extends Pic as Picture, Width as integer, Height as Integer) As Picture
// Calculate scale factor
dim factor as Double = min( Height / Pic.Height, Width / Pic.Width )
// Calculate new size
dim w as integer = Pic.Width * factor
dim h as integer = Pic.Height * factor
// 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 scaled image
Return NewPic
End Function
[/code]
Then assign the returned picture to your WebImageView control. Something like:
How funny. I just added a training video last weekend that did this exact thing for WebImageView. http://xojo.bkeeney.com/XojoTraining/ Look for PictureShare.
The only thing I did differently was check to see if the picture was bigger than the ImageView bounds. If it was, I did the proportional scaling. If it was not, I didn’t do any scaling because I didn’t want the image enlarged.
thanks for that link - but I’m trying it on Web/Linux.
The solution is with GDI+.
Is there another way?[/quote]
You can get and set picture.graphics.pixel without using RGBSurface, and I believe the function ScalePicture posted there can be used in Web Edition. Of course it requires a small adaptation.
The whole discussion thread is about alternate algorithm to Xojo scaling that provide better quality. Is it not what you wished for ? I tried the ScalePicture method, and found it to produce better results than the Xojo drawpicture method.