125 |
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens, |
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens, |
126 |
byte[] blues, byte[] alphas) |
byte[] blues, byte[] alphas) |
127 |
{ |
{ |
128 |
super (bits); |
// FIXME: This super() constructor should not be used since it can give |
129 |
|
// the wrong value for hasAlpha() which is final and cannot be overloaded |
130 |
|
super(bits); |
131 |
map_size = size; |
map_size = size; |
132 |
opaque = (alphas == null); |
opaque = (alphas == null); |
133 |
|
|
418 |
*/ |
*/ |
419 |
public final int getAlpha (int pixel) |
public final int getAlpha (int pixel) |
420 |
{ |
{ |
421 |
if (pixel < map_size) |
if (opaque || pixel >= map_size) |
422 |
return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits)); |
return 255; |
423 |
|
|
424 |
return 0; |
return (int) ((generateMask (3) & rgb[pixel]) >> (3 * pixel_bits)); |
425 |
} |
} |
426 |
|
|
427 |
/** |
/** |