我有一张 PNG 图片(角落里有透明像素),我试图提取这些透明像素的颜色代码,我使用了一个 xxxx 网站,它让我可以选择像素并返回其颜色代码;
选择透明像素后我得到:
RGB 代码: R:34 G:62 B:74
这不符合逻辑
我将 BitmapDrawable 与我的 PNG 图像一起使用 // 我认为这不是正确的方法
位图 位图 = ((BitmapDrawable)image.getDrawable()).getBitmap();
有没有办法检查像素是否透明?
谢谢
Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap();
int transparency = ((bitmap.getPixel(x,y) & 0xff000000) >> 24);
transparency
将在之间0 (completely transparent
) and 255 (completely opaque
).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)