问题
I have a source image in PNG with alpha information, that I scale with Graphics.scaleInto():
Bitmap dst = new Bitmap(123, 178);
dst.createAlpha(Bitmap.ALPHA_BITDEPTH_8BPP);
Bitmap img = Bitmap.getBitmapResource(name);
img.scaleInto(dst, Bitmap.FILTER_BOX);
This works, the new scaled image is put in dst
, but the alpha information is distorted. Some areas show as white, while some are transparent. Transparency borders have a blue tint to them.
回答1:
How do you draw the scaled image? As I found in my earlier question, even if you are doing the scaling correctly with respect to alpha, you need to call a drawing method that makes use of the alpha - Graphics.drawARGB().
来源:https://stackoverflow.com/questions/5298718/resize-bitmap-on-blackberry-while-keeping-alpha-data