【发布时间】:2011-10-22 14:01:25
【问题描述】:
我使用 setPixel() 将像素设置为某个值,但是当我在同一像素上调用 getPixel 时,它会返回一个不同的值。
当 alpha==255 时它工作正常,但任何其他值它给出不同的值;
这是在华硕变压器 Honeycomb 3.2 上测试的
int newPixel=Color.argb(alpha, red, green, blue);
if(x==74&&y==86){
Log.w("PuzzleMaker","newPixel:"+newPixel+","+image.getConfig().name()+","+image.isMutable());
}
image.setPixel(x,y,newPixel);
if(x==74&&y==86){
int testPixel=image.getPixel(x, y);
Log.w("PuzzleMaker","testPixel:"+testPixel);
}
日志:
newPixel: 13426418,ARGB_8888,true
testPixel: -16777216
日志中的2个数字应该相同。
【问题讨论】:
-
太好了,我很高兴你知道了!既然您自己想通了,您应该将解决方案添加为该问题的答案,然后将您的答案视为正确答案。
-
我本来打算这样做,但由于我是新手,所以在我提出问题至少 8 小时后才能添加自己的答案。不过我现在会这样做。