ResizeImage without scaling the image

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

ResizeImage without scaling the image

Post 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.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

A CropImage() function would be useful, but it would probably just be a wrapper from GrabImage().
Post Reply