我想知道如何單個像素的alpha通道可以是-1?我正在瀏覽PNG圖像的每個像素(加載到緩衝圖像中,ARGB類型)。許多alpha值是-1(其他都大於零) - 這怎麼可能?不應該在0到255之間?代碼如下。感謝您的任何提示!alpha通道如何爲-1?
// imagine some great loop for x and y before this code
int a = (scaledImage.getRGB(x, y) & 0xff000000) >> 24; // kill all bits except for the first 8, shift 24 to the right to get them
System.out.println("" + a);
謝謝您也提供解決方案的問題! –