當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。