38 |
|
|
39 |
package java.awt.image; |
package java.awt.image; |
40 |
|
|
41 |
|
import java.awt.color.ColorSpace; |
42 |
|
|
43 |
/** |
/** |
44 |
* @author C. Brian Jones (cbj@gnu.org) |
* @author C. Brian Jones (cbj@gnu.org) |
45 |
*/ |
*/ |
169 |
map_size = size; |
map_size = size; |
170 |
opaque = !hasAlpha; |
opaque = !hasAlpha; |
171 |
this.trans = trans; |
this.trans = trans; |
172 |
|
} |
173 |
|
|
174 |
|
/** |
175 |
|
* Each array much contain <code>size</code> elements. For each |
176 |
|
* array, the i-th color is described by reds[i], greens[i], |
177 |
|
* blues[i], alphas[i], unless alphas is not specified, then all the |
178 |
|
* colors are opaque except for the transparent color. |
179 |
|
* |
180 |
|
* @param bits the number of bits needed to represent <code>size</code> colors |
181 |
|
* @param size the number of colors in the color map |
182 |
|
* @param cmap packed color components |
183 |
|
* @param start the offset of the first color component in <code>cmap</code> |
184 |
|
* @param hasAlpha <code>cmap</code> has alpha values |
185 |
|
* @param trans the index of the transparent color |
186 |
|
* @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT |
187 |
|
*/ |
188 |
|
public IndexColorModel (int bits, int size, byte[] cmap, int start, |
189 |
|
boolean hasAlpha, int trans, int transferType) |
190 |
|
{ |
191 |
|
super(bits * 4, // total bits, sRGB, four channels |
192 |
|
nArray(bits, 4), // bits for each channel |
193 |
|
ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB |
194 |
|
true, // has alpha |
195 |
|
false, // not premultiplied |
196 |
|
TRANSLUCENT, transferType); |
197 |
|
if (transferType != DataBuffer.TYPE_BYTE |
198 |
|
&& transferType != DataBuffer.TYPE_USHORT) |
199 |
|
throw new IllegalArgumentException(); |
200 |
|
map_size = size; |
201 |
|
opaque = !hasAlpha; |
202 |
|
this.trans = trans; |
203 |
} |
} |
204 |
|
|
205 |
public final int getMapSize () |
public final int getMapSize () |