Page 1 of 1

ResizeImage without scaling the image

Posted: Fri Feb 22, 2008 7:08 am
by Mistrel
I would like to draw on images to create custom gadgets. The problem I have is that resizing images is very slow on large images or with many images at once. The problem appears to be caused by the scaling of the old pixels. In my case I only need to change the image dimensions. My gadgets will redraw every pixel new at the correct scale.

I'm currently using CreateImage() to recreate the image which is much faster but this does not feel like an optimal approach. A flag for ResizeImage() that prevents it from scaling would be nice.

Posted: Fri Feb 22, 2008 7:36 am
by Kaeru Gaman
> but this does not feel like an optimal approach.

it is the optimal approach. ResizeImage() is made for scaling.
stop thinking OOP.
sure, an Image is an object, but not damned to be bound to your Gadget.

PS:
imagine what happenes if you shrink an Image - The Image has to be recreated, to free the obsolete memory.

Posted: Fri Feb 22, 2008 8:01 am
by Mistrel
Kaeru Gaman wrote:imagine what happenes if you shrink an Image - The Image has to be recreated, to free the obsolete memory.
That makes a lot of sense.

Posted: Fri Feb 22, 2008 11:22 am
by Trond
A CropImage() function would be useful, but it would probably just be a wrapper from GrabImage().