当前位置: 首页>>代码示例>>Java>>正文


Java ComponentColorModel.OPAQUE属性代码示例

本文整理汇总了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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:TextureLoader.java

示例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);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:26,代码来源:TrackerPanel.java

示例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);
}
 
开发者ID:WhiteHexagon,项目名称:example-jovr-lwjgl3-rift,代码行数:20,代码来源:TextureLoader.java

示例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;
}
 
开发者ID:hageldave,项目名称:ImagingKit,代码行数:15,代码来源:ColorImg.java

示例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));
}
 
开发者ID:vilie,项目名称:javify,代码行数:50,代码来源:PNGDecoder.java

示例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));
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:50,代码来源:PNGDecoder.java


注:本文中的java.awt.image.ComponentColorModel.OPAQUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。