/**
* 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;
}
}
java类java.awt.image.DirectColorModel的实例源码
BufferedImageGraphicsConfig.java 文件源码
项目:jdk8u_jdk
阅读 23
收藏 0
点赞 0
评论 0
CGLGraphicsConfig.java 文件源码
项目:jdk8u_jdk
阅读 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;
}
}
D3DGraphicsConfig.java 文件源码
项目:jdk8u_jdk
阅读 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;
}
}
BufferedImageGraphicsConfig.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 19
收藏 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 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 19
收藏 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 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 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;
}
}
WGLGraphicsConfig.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 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 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 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;
}
}
Utils.java 文件源码
项目:iSeleda
阅读 22
收藏 0
点赞 0
评论 0
public static void debugRaster(Raster raster) {
ColorModel colorModel = new DirectColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
32,
0x00ff0000,// Red
0x0000ff00,// Green
0x000000ff,// Blue
0xff000000,// Alpha
true, // Alpha Premultiplied
DataBuffer.TYPE_INT
);
Raster correctlyTranslated = raster.createChild(raster.getMinX(), raster.getMinY(), raster.getWidth(), raster.getHeight(), 0, 0, null);
BufferedImage debugImage = new BufferedImage(colorModel, (WritableRaster) correctlyTranslated, true, null);
debugImage(debugImage);
}
ImageTypeSpecifier.java 文件源码
项目:javify
阅读 21
收藏 0
点赞 0
评论 0
/**
* Create a grayscale image type specifier, given the number of
* bits, data type and whether or not the data is signed.
*
* @param bits the number of bits used to specify a greyscale value
* @param dataType a DataBuffer type constant
* @param isSigned true if this type specifier should support
* negative values, false otherwise
*
* @return a greyscal image type specifier
*
* @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or
* 16
* @exception IllegalArgumentException if dataType is not
* DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
* DataBuffer.TYPE_USHORT
* @exception if bits is larger than the number of bits in the given
* data type
*/
public static ImageTypeSpecifier createGrayscale (int bits, int dataType,
boolean isSigned,
boolean isAlphaPremultiplied)
{
if (bits != 1 && bits != 2 && bits != 4 && bits != 8 && bits != 16)
throw new IllegalArgumentException ("invalid bit size");
if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_SHORT
&& dataType != DataBuffer.TYPE_USHORT)
throw new IllegalArgumentException ("invalid data type");
if (dataType == DataBuffer.TYPE_BYTE && bits > 8)
throw new IllegalArgumentException ("number of bits too large for data type");
// FIXME: this is probably wrong:
return new ImageTypeSpecifier (new DirectColorModel (bits, 0xff, 0x0,
0x0, 0xff),
new MultiPixelPackedSampleModel (dataType,
1, 1,
bits));
}