Hello,
I am looking for a way to rescale a bitmap with transparency. Now I am using the following method:
- The user can select a picture file on his disk. All file formats that CVI supports can be choosen (bmp, png, ico).
- This picture is put on a picture control, using the DisplayImageFile function.
- Now, I need to store this picture, so I can put it back on the picture control the next time the user launches my program. But I only need to store a picture of 32 by 32 pixels. Since the user can select a huge file, I first want to rescale this picture to the 32x32 format. Appearantly, the GetCtrlBitmap function returns a bitmap which is the same size of the selected picture. So my idea was to draw this bitmap on a 32x32 invisible canvas, using the CanvasDrawBitmap function, and then getting the picture back from the canvas, using the GetCtrlBitmap function on this canvas.
- OK, now I got a 32x32 bitmap, which I could save to a png file, using the SaveBitmapToPNGFile function. Problem is: the transparency of my picture is lost! Suppose the user selected a png file with a transparent area. Putting this file to the picture control, and getting the bitmap from this control, I get a bitmap with an alpha channel, indicating the transparency of the pixels. After I draw this bitmap to the canvas (canvas has a transparent background!) and then getting the bitmap from the canvas. The alpha channel of the bitmap is gone.
So now I am looking for some way to rescale the original bitmap (with transparency) into a 32x32 bitmap. I am pretty sure that some really good algorithms already exist, so I'd rather not write them myself

All hints are appreciated.
Wim
Gemidis n.v. - Innovating Display Technology
Ghent, Belgium