@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
java类java.awt.image.DirectColorModel的实例源码
WGLGraphicsConfig.java 文件源码
项目:jdk8u_jdk
阅读 31
收藏 0
点赞 0
评论 0
GLXGraphicsConfig.java 文件源码
项目:jdk8u_jdk
阅读 24
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
WebP.java 文件源码
项目:webp-imageio
阅读 21
收藏 0
点赞 0
评论 0
private static byte[] extractDirectRGBInt( int aWidth, int aHeight, DirectColorModel aColorModel, SinglePixelPackedSampleModel aSampleModel, DataBufferInt aDataBuffer ) {
byte[] out = new byte[ aWidth * aHeight * 3 ];
int rMask = aColorModel.getRedMask();
int gMask = aColorModel.getGreenMask();
int bMask = aColorModel.getBlueMask();
int rShift = getShift( rMask );
int gShift = getShift( gMask );
int bShift = getShift( bMask );
int[] bank = aDataBuffer.getBankData()[ 0 ];
int scanlineStride = aSampleModel.getScanlineStride();
int scanIx = 0;
for ( int b = 0, y = 0; y < aHeight; y++ ) {
int pixIx = scanIx;
for ( int x = 0; x < aWidth; x++, b += 3 ) {
int pixel = bank[ pixIx++ ];
out[ b ] = ( byte ) ( ( pixel & rMask ) >>> rShift );
out[ b + 1 ] = ( byte ) ( ( pixel & gMask ) >>> gShift );
out[ b + 2 ] = ( byte ) ( ( pixel & bMask ) >>> bShift );
}
scanIx += scanlineStride;
}
return out;
}
BufferedImageGraphicsConfig.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
/**
* Returns the color model associated with this configuration that
* supports the specified transparency.
*/
public ColorModel getColorModel(int transparency) {
if (model.getTransparency() == transparency) {
return model;
}
switch (transparency) {
case Transparency.OPAQUE:
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
return ColorModel.getRGBdefault();
default:
return null;
}
}
CGLGraphicsConfig.java 文件源码
项目:OpenJSharp
阅读 24
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
D3DGraphicsConfig.java 文件源码
项目:OpenJSharp
阅读 33
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
WGLGraphicsConfig.java 文件源码
项目:OpenJSharp
阅读 18
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
GLXGraphicsConfig.java 文件源码
项目:OpenJSharp
阅读 18
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
BufferedImageGraphicsConfig.java 文件源码
项目:jdk8u-jdk
阅读 21
收藏 0
点赞 0
评论 0
/**
* Returns the color model associated with this configuration that
* supports the specified transparency.
*/
public ColorModel getColorModel(int transparency) {
if (model.getTransparency() == transparency) {
return model;
}
switch (transparency) {
case Transparency.OPAQUE:
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
return ColorModel.getRGBdefault();
default:
return null;
}
}
CGLGraphicsConfig.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
D3DGraphicsConfig.java 文件源码
项目:jdk8u-jdk
阅读 32
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
WGLGraphicsConfig.java 文件源码
项目:jdk8u-jdk
阅读 28
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
GLXGraphicsConfig.java 文件源码
项目:jdk8u-jdk
阅读 23
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
BufferedImageGraphicsConfig.java 文件源码
项目:openjdk-jdk10
阅读 55
收藏 0
点赞 0
评论 0
/**
* Returns the color model associated with this configuration that
* supports the specified transparency.
*/
public ColorModel getColorModel(int transparency) {
if (model.getTransparency() == transparency) {
return model;
}
switch (transparency) {
case Transparency.OPAQUE:
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
return ColorModel.getRGBdefault();
default:
return null;
}
}
GLXGraphicsConfig.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
CGLGraphicsConfig.java 文件源码
项目:openjdk-jdk10
阅读 30
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
D3DGraphicsConfig.java 文件源码
项目:openjdk-jdk10
阅读 26
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
WGLGraphicsConfig.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
PackedColorModelEqualsTest.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
private static void verifyEquals(DirectColorModel m1,
DirectColorModel m2) {
if (m1.equals(null)) {
throw new RuntimeException("equals(null) returns true");
}
if (!(m1.equals(m2))) {
throw new RuntimeException("equals() method is not working"
+ " properly");
}
if (!(m2.equals(m1))) {
throw new RuntimeException("equals() method is not working"
+ " properly");
}
if (m1.hashCode() != m2.hashCode()) {
throw new RuntimeException("HashCode is not same for same"
+ " PackedColorModels");
}
}
PackedColorModelEqualsTest.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
private static void testMaskArrayEquality() {
/*
* Test with different maskArray values, since PackedColorModel
* is abstract we use subclass DirectColorModel.
*/
DirectColorModel model1 =
new DirectColorModel(24, 0x00FF0000, 0x0000FF00, 0x000000FF);
DirectColorModel model2 =
new DirectColorModel(24, 0x000000FF, 0x0000FF00, 0x00FF0000);
if (model1.equals(model2)) {
throw new RuntimeException("equals() method is determining"
+ " ColorMap equality improperly");
}
if (model2.equals(model1)) {
throw new RuntimeException("equals() method is determining"
+ " ColorMap equality improperly");
}
}
PackedColorModelEqualsTest.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
private static void testConstructor2() {
/*
* verify equality with constructor
* DirectColorModel(ColorSpace space, int bits, int rmask, int gmask,
* int bmask, int amask, boolean isAlphaPremultiplied, int transferType)
*/
DirectColorModel model1 =
new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
false, DataBuffer.TYPE_BYTE);
DirectColorModel model2 =
new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
false, DataBuffer.TYPE_BYTE);
verifyEquals(model1, model2);
}
BufferedImageGraphicsConfig.java 文件源码
项目:openjdk9
阅读 20
收藏 0
点赞 0
评论 0
/**
* Returns the color model associated with this configuration that
* supports the specified transparency.
*/
public ColorModel getColorModel(int transparency) {
if (model.getTransparency() == transparency) {
return model;
}
switch (transparency) {
case Transparency.OPAQUE:
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
return ColorModel.getRGBdefault();
default:
return null;
}
}
GLXGraphicsConfig.java 文件源码
项目:openjdk9
阅读 22
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
CGLGraphicsConfig.java 文件源码
项目:openjdk9
阅读 30
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
D3DGraphicsConfig.java 文件源码
项目:openjdk9
阅读 24
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
WGLGraphicsConfig.java 文件源码
项目:openjdk9
阅读 21
收藏 0
点赞 0
评论 0
@Override
public ColorModel getColorModel(int transparency) {
switch (transparency) {
case Transparency.OPAQUE:
// REMIND: once the ColorModel spec is changed, this should be
// an opaque premultiplied DCM...
return new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
case Transparency.BITMASK:
return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
case Transparency.TRANSLUCENT:
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
return new DirectColorModel(cs, 32,
0xff0000, 0xff00, 0xff, 0xff000000,
true, DataBuffer.TYPE_INT);
default:
return null;
}
}
OutputPaneController.java 文件源码
项目:BrickifyFX
阅读 24
收藏 0
点赞 0
评论 0
/**
* Get the image to write. This is the mosaic image with alpha channel stripped, as this
* doesn't work with the JPEG export.
*/
private BufferedImage getImageToWrite() throws InterruptedException {
BufferedImage image = SwingFXUtils.fromFXImage(mainController.getMosaicImage(), null);
final int[] RGB_MASKS = {0xFF0000, 0xFF00, 0xFF};
final ColorModel rgbOpaque = new DirectColorModel(32, RGB_MASKS[0], RGB_MASKS[1], RGB_MASKS[2]);
PixelGrabber pg = new PixelGrabber(image, 0, 0, -1, -1, true);
pg.grabPixels();
int width = pg.getWidth(), height = pg.getHeight();
DataBuffer buffer = new DataBufferInt((int[]) pg.getPixels(), pg.getWidth() * pg.getHeight());
WritableRaster raster = Raster.createPackedRaster(buffer, width, height, width, RGB_MASKS, null);
BufferedImage bi = new BufferedImage(rgbOpaque, raster, false, null);
return bi;
}
ImageLoader.java 文件源码
项目:pumpernickel
阅读 23
收藏 0
点赞 0
评论 0
/** This checks to see if two DirectColorModels are identical.
* Apparently the "equals" method in DirectColorModel doesn't really work.
*/
private static boolean equals(DirectColorModel d1,DirectColorModel d2) {
if(d1.getAlphaMask()!=d2.getAlphaMask())
return false;
if(d1.getGreenMask()!=d2.getGreenMask())
return false;
if(d1.getRedMask()!=d2.getRedMask())
return false;
if(d1.getBlueMask()!=d2.getBlueMask())
return false;
if(d1.getColorSpace()!=d2.getColorSpace())
return false;
if(d1.isAlphaPremultiplied()!=d2.isAlphaPremultiplied())
return false;
if(d1.getTransferType()!=d2.getTransferType())
return false;
if(d1.getTransparency()!=d2.getTransparency())
return false;
return true;
}
CompositeRed.java 文件源码
项目:Push2Display
阅读 18
收藏 0
点赞 0
评论 0
protected static ColorModel fixColorModel(CachableRed src) {
ColorModel cm = src.getColorModel();
if (cm.hasAlpha()) {
if (!cm.isAlphaPremultiplied())
cm = GraphicsUtil.coerceColorModel(cm, true);
return cm;
}
int b = src.getSampleModel().getNumBands()+1;
if (b > 4)
throw new IllegalArgumentException
("CompositeRed can only handle up to three band images");
int [] masks = new int[4];
for (int i=0; i < b-1; i++)
masks[i] = 0xFF0000 >> (8*i);
masks[3] = 0xFF << (8*(b-1));
ColorSpace cs = cm.getColorSpace();
return new DirectColorModel(cs, 8*b, masks[0], masks[1],
masks[2], masks[3],
true, DataBuffer.TYPE_INT);
}
FormatRed.java 文件源码
项目:Push2Display
阅读 20
收藏 0
点赞 0
评论 0
public static CachableRed construct(CachableRed src, ColorModel cm) {
ColorModel srcCM = src.getColorModel();
if ((cm.hasAlpha() != srcCM.hasAlpha()) ||
(cm.isAlphaPremultiplied() != srcCM.isAlphaPremultiplied()))
return new FormatRed(src, cm);
if (cm.getNumComponents() != srcCM.getNumComponents())
throw new IllegalArgumentException
("Incompatible ColorModel given");
if ((srcCM instanceof ComponentColorModel) &&
(cm instanceof ComponentColorModel))
return src;
if ((srcCM instanceof DirectColorModel) &&
(cm instanceof DirectColorModel))
return src;
return new FormatRed(src, cm);
}