when a color table item is not found the pixel should be transparent (int value = 0)

This commit is contained in:
honfika@gmail.com
2015-03-30 22:18:51 +02:00
parent ec31310e2b
commit 06e006e21d
2 changed files with 9 additions and 3 deletions

View File

@@ -258,7 +258,10 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag {
for (int x = 0; x < bitmapWidth; x++) {
int c = 0;
if ((bitmapFormat == DefineBitsLossless2Tag.FORMAT_8BIT_COLORMAPPED)) {
c = multiplyAlpha(colorMapData.colorTableRGB[colorMapData.colorMapPixelData[pos32aligned] & 0xff].toInt());
int colorTableIndex = colorMapData.colorMapPixelData[pos32aligned] & 0xff;
if (colorTableIndex < colorMapData.colorTableRGB.length) {
c = multiplyAlpha(colorMapData.colorTableRGB[colorTableIndex].toInt());
}
}
if ((bitmapFormat == DefineBitsLossless2Tag.FORMAT_32BIT_ARGB)) {
c = multiplyAlpha(bitmapData.bitmapPixelData[pos].toInt());

View File

@@ -162,8 +162,11 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag {
for (int x = 0; x < bitmapWidth; x++) {
int c = 0;
if (bitmapFormat == DefineBitsLosslessTag.FORMAT_8BIT_COLORMAPPED) {
RGB color = colorMapData.colorTableRGB[colorMapData.colorMapPixelData[pos32aligned] & 0xff];
c = color.toInt();
int colorTableIndex = colorMapData.colorMapPixelData[pos32aligned] & 0xff;
if (colorTableIndex < colorMapData.colorTableRGB.length) {
RGB color = colorMapData.colorTableRGB[colorTableIndex];
c = color.toInt();
}
}
if (bitmapFormat == DefineBitsLosslessTag.FORMAT_15BIT_RGB) {
c = new RGB(bitmapData.bitmapPixelDataPix15[pos].red * 8, bitmapData.bitmapPixelDataPix15[pos].green * 8, bitmapData.bitmapPixelDataPix15[pos].blue * 8).toInt();