本文整理汇总了Java中java.awt.image.ComponentColorModel.OPAQUE属性的典型用法代码示例。如果您正苦于以下问题:Java ComponentColorModel.OPAQUE属性的具体用法?Java ComponentColorModel.OPAQUE怎么用?Java ComponentColorModel.OPAQUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.image.ComponentColorModel
的用法示例。
在下文中一共展示了ComponentColorModel.OPAQUE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TextureLoader
/**
* Create a new texture loader based on the game panel
*/
public TextureLoader() {
glAlphaColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
new int[] {8,8,8,8},
true,
false,
ComponentColorModel.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
glColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
new int[] {8,8,8,0},
false,
false,
ComponentColorModel.OPAQUE,
DataBuffer.TYPE_BYTE);
}
示例2: drawUserDepths
/**
* Draw user depths.
*
* @param g2d
* the g2d
*/
private void drawUserDepths(Graphics2D g2d)
{ // Create BufferedImage using
// the depth image bytes and
// a colour model, then draw
// it
// define an 8-bit RGB channel colour model
ColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[]
{ 8, 8, 8 }, false, false, ComponentColorModel.OPAQUE, DataBuffer.TYPE_BYTE);
// fill the raster with the depth image bytes
DataBufferByte dataBuffer = new DataBufferByte(imgbytes, imWidth * imHeight * 3);
WritableRaster raster = Raster.createInterleavedRaster(dataBuffer, imWidth, imHeight, imWidth * 3, 3, new int[]
{ 0, 1, 2 }, null);
// combine colour model and raster to create a BufferedImage
BufferedImage image = new BufferedImage(colorModel, raster, false, null);
g2d.drawImage(image, 0, 0, null);
}
示例3: TextureLoader
/**
* Create a new texture loader based on the game panel
*
* @param gl The GL content in which the textures should be loaded
*/
public TextureLoader() {
glAlphaColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
new int[] {8,8,8,8},
true,
false,
ComponentColorModel.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
glColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
new int[] {8,8,8,0},
false,
false,
ComponentColorModel.OPAQUE,
DataBuffer.TYPE_BYTE);
}
示例4: getRemoteBufferedImage
@Override
public BufferedImage getRemoteBufferedImage(){
SampleModel samplemodel = new BandedSampleModel(DataBuffer.TYPE_DOUBLE, getWidth(), getHeight(), hasAlpha() ? 4:3);
DataBufferDouble databuffer = new DataBufferDouble(getData(), numValues());
WritableRaster raster = Raster.createWritableRaster(samplemodel, databuffer, null);
ColorModel colormodel = new ComponentColorModel(
ColorSpace.getInstance(ColorSpace.CS_sRGB),
hasAlpha(),
false,
hasAlpha() ? ComponentColorModel.TRANSLUCENT:ComponentColorModel.OPAQUE,
DataBuffer.TYPE_DOUBLE
);
BufferedImage bimg = new BufferedImage(colormodel, raster, false, null);
return bimg;
}
示例5: getColorModel
public ColorModel getColorModel( ColorSpace cs,
int colorType, int depth )
{
int[] bits;
boolean hasAlpha = false;
int transferType;
switch( colorType )
{
case PNGHeader.GRAYSCALE_WITH_ALPHA:
if( cs == null )
cs = ColorSpace.getInstance( ColorSpace.CS_GRAY );
hasAlpha = true;
bits = new int[]{ depth, depth };
break;
case PNGHeader.RGB:
bits = new int[]{ depth, depth, depth };
break;
case PNGHeader.RGB_WITH_ALPHA:
hasAlpha = true;
bits = new int[]{ depth, depth, depth, depth };
break;
case PNGHeader.GRAYSCALE:
if( depth < 8 )
return grayPalette( depth );
if( cs == null )
cs = ColorSpace.getInstance( ColorSpace.CS_GRAY );
bits = new int[]{ depth };
break;
default:
case PNGHeader.INDEXED:
return null; // Handled by the palette chunk.
}
if( cs == null )
cs = ColorSpace.getInstance( ColorSpace.CS_sRGB );
return new ComponentColorModel(cs, bits, hasAlpha, false,
(hasAlpha ?
ComponentColorModel.TRANSLUCENT :
ComponentColorModel.OPAQUE),
((depth == 16) ? DataBuffer.TYPE_USHORT :
DataBuffer.TYPE_BYTE));
}
示例6: getColorModel
public ColorModel getColorModel( ColorSpace cs,
int colorType, int depth )
{
int[] bits;
boolean hasAlpha = false;
int transferType;
switch( colorType )
{
case PNGHeader.GRAYSCALE_WITH_ALPHA:
if( cs == null )
cs = ColorSpace.getInstance( ColorSpace.CS_GRAY );
hasAlpha = true;
bits = new int[]{ depth, depth };
break;
case PNGHeader.RGB:
bits = new int[]{ depth, depth, depth };
break;
case PNGHeader.RGB_WITH_ALPHA:
hasAlpha = true;
bits = new int[]{ depth, depth, depth, depth };
break;
case PNGHeader.GRAYSCALE:
if( depth < 8 )
return grayPalette( depth );
if( cs == null )
cs = ColorSpace.getInstance( ColorSpace.CS_GRAY );
bits = new int[]{ depth };
break;
default:
case PNGHeader.INDEXED:
return null; // Handled by the palette chunk.
}
if( cs == null )
cs = ColorSpace.getInstance( ColorSpace.CS_sRGB );
return new ComponentColorModel(cs, bits, hasAlpha, false,
(hasAlpha ?
ComponentColorModel.TRANSLUCENT :
ComponentColorModel.OPAQUE),
((depth == 16) ? DataBuffer.TYPE_USHORT :
DataBuffer.TYPE_BYTE));
}