Resize Bitmap on Blackberry, while keeping alpha data

戏子无情 提交于 2019-12-11 16:36:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!