Does anybody know why my image2 does not get scaled in the image2.scaleImage32() method?
Here’s my code:
public ZoomScreen setScreen(){
map1.getBitmap().scaleInto(tempBmp, Bitmap.FILTER_BILINEAR);
Graphics g = Graphics.create(tempBmp); //works
g.drawBitmap(100, 100, bitmapImage2.getWidth(), bitmapImage2.getHeight(), bitmapImage2, 0, 0); //works
image2 = PNGEncodedImage.encode(tempBmp); //works
image3 = image2.scaleImage32(Fixed32.toFP(100), Fixed32.toFP(200)); // does not work
ZoomScreen screen = new ZoomScreen(image3);// works
return screen;
}
Perhaps you are passing absolute values of width and height to
scaleImage32()method. But it is not a correct way to use this method. You need to pass scale factor instead of absolute value of width and height.Assuming
imageis an EncodedImage class instance, andthumbnailSideis a side of scaled image in pixels, here is the code that should work for you: