11-18-2009 07:04 AM
Here's a strange behavior I found while downscaling images with EncodedImage.scaleImage32 method. When performed on JPEG images, all works fine, however this is not the case with GIF images.
I am using GIF images with transparent background, about 100x100 px, and scaling them to 64x64. The non transparent parts are scaled correctly, but the resulting image is the same size as the original (100x100), keeping a huge transparent padding at right and bottom. It is something like this:
| | |
| | |
w1: expected image size. The non transparent parts of the image are correctly included here.
w2: original image size, and also scaled image size.
Areas between w2 and w1 are fully transparent background
I think it only happens on certain simulators. The workaround is cropping the resulting image to it's expected width (w1).
I was using Eclipse 3.4 with BB plugin alpha, component pack 4.5 and simulator 8300-220.127.116.11
11-18-2009 08:13 AM
What functions are you calling to get the width/height?
If you are using getHeight/getWidth than you should call getScaledHeight/getScaledWidth. If you scaled it and then draw it and you see this "buffer" then it is a bug. If you are just looking at the width and height then it might not be a bug.
The only reasoning that my resoning would be wrong is that you said it only happens on certain simulators.
11-19-2009 06:55 AM
Ha ha, Ok have you only tried it with GIF and JPEG or did you try it on other image types? I know JPEG and WBMP are the only ones that don't support alpha but I don't know if it's the EncodedImage subtype (GIFEncodedImage) or if it is a non-mutable function and it simply changes the scale values on the EncodedImage. I have a feeling that I am just babbling but I use this in a couple areas and want to make sure that I don't encounter any errors.