break;
case TYPE_3BYTE_BGR: {
int bits[] = { 8, 8, 8 };
int bandOffsets[] = { 2, 1, 0 };
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
bits,
false,
false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
width, height, width * 3, 3, bandOffsets, null);
}
break;
case TYPE_4BYTE_ABGR: {
int bits[] = { 8, 8, 8, 8 };
int bandOffsets[] = { 3, 2, 1, 0 };
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
bits,
true,
false,
Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
width, height, width * 4, 4, bandOffsets, null);
}
break;
case TYPE_4BYTE_ABGR_PRE: {
int bits[] = { 8, 8, 8, 8 };
int bandOffsets[] = { 3, 2, 1, 0 };
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
bits,
true,
true,
Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
width, height, width * 4, 4, bandOffsets, null);
}
break;
case TYPE_USHORT_565_RGB:
cm = new DirectColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
16,
RED_565_MASK,
GREEN_565_MASK,
BLUE_565_MASK,
0,
false,
DataBuffer.TYPE_USHORT);
raster = cm.createCompatibleWritableRaster(width, height);
break;
case TYPE_USHORT_555_RGB:
cm = new DirectColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
15,
RED_555_MASK,
GREEN_555_MASK,
BLUE_555_MASK,
0,
false,
DataBuffer.TYPE_USHORT);
raster = cm.createCompatibleWritableRaster(width, height);
break;
case TYPE_BYTE_GRAY: {
int bits[] = { 8 };
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_GRAY),
bits,
false,
false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
raster = cm.createCompatibleWritableRaster(width, height);
}
break;
case TYPE_USHORT_GRAY: {
int bits[] = { 16 };
cm = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_GRAY),
bits,
false,
false,
Transparency.OPAQUE,