问题描述
我有一个源图像中PNG与阿尔法信息,即我与规模Graphics.scaleInto():
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);
这工作的,新的缩放后的图像放在 DST
,但alpha信息失真。一些地区显示为白色,而有些是透明的。透明边框有一个蓝色的色调给他们。
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.
推荐答案
你如何绘制缩放后的图像?正如我发现<一个href=\"http://stackoverflow.com/questions/4239553/scale-a-bitmap-and-$p$pserve-alpha-on-blackberry/4299740\">my较早前的问题,即使相对于阿尔法做正确的比例,你需要调用一个绘图方法,它利用了阿尔法 - )Graphics.drawARGB(
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().
这篇关于调整对黑莓位图,同时保持Alpha数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!