當前位置: 首頁>>代碼示例>>Java>>正文


Java DirectColorModel.getAlphaMask方法代碼示例

本文整理匯總了Java中java.awt.image.DirectColorModel.getAlphaMask方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectColorModel.getAlphaMask方法的具體用法?Java DirectColorModel.getAlphaMask怎麽用?Java DirectColorModel.getAlphaMask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.image.DirectColorModel的用法示例。


在下文中一共展示了DirectColorModel.getAlphaMask方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: equals

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
/** 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;
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:23,代碼來源:ImageLoader.java

示例2: equals

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:tinyMediaManager,項目名稱:tinyMediaManager,代碼行數:23,代碼來源:ImageLoader.java

示例3: checkCompatible

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private void checkCompatible(ColorModel colorModel,
                             SampleModel sampleModel){
    ColorSpace cs = colorModel.getColorSpace();

    // Check that model is sRGB or linear RGB
    if((!cs .equals (sRGB)) && (!cs .equals( lRGB)))
        throw new IllegalArgumentException("Expected CS_sRGB or CS_LINEAR_RGB color model");

    // Check ColorModel is of type DirectColorModel
    if(!(colorModel instanceof DirectColorModel))
        throw new IllegalArgumentException("colorModel should be an instance of DirectColorModel");

    // Check transfer type
    if(sampleModel.getDataType() != DataBuffer.TYPE_INT)
        throw new IllegalArgumentException("colorModel's transferType should be DataBuffer.TYPE_INT");

    // Check red, green, blue and alpha mask
    DirectColorModel dcm = (DirectColorModel)colorModel;
    if(dcm.getRedMask() != 0x00ff0000)
        throw new IllegalArgumentException("red mask in source should be 0x00ff0000");
    if(dcm.getGreenMask() != 0x0000ff00)
        throw new IllegalArgumentException("green mask in source should be 0x0000ff00");
    if(dcm.getBlueMask() != 0x000000ff)
        throw new IllegalArgumentException("blue mask in source should be 0x000000ff");
    if(dcm.getAlphaMask() != 0xff000000)
        throw new IllegalArgumentException("alpha mask in source should be 0xff000000");
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:28,代碼來源:MorphologyOp.java

示例4: isCompatible

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private boolean isCompatible(ColorModel colorModel,
                             SampleModel sampleModel){
    ColorSpace cs = colorModel.getColorSpace();
    // Check that model is sRGB or linear RGB
    if((cs != ColorSpace.getInstance(ColorSpace.CS_sRGB))
       &&
       (cs != ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)))
        return false;

    // Check ColorModel is of type DirectColorModel
    if(!(colorModel instanceof DirectColorModel))
        return false;

    // Check transfer type
    if(sampleModel.getDataType() != DataBuffer.TYPE_INT)
        return false;

    // Check red, green, blue and alpha mask
    DirectColorModel dcm = (DirectColorModel)colorModel;
    if(dcm.getRedMask() != 0x00ff0000)
        return false;
    if(dcm.getGreenMask() != 0x0000ff00)
        return false;
    if(dcm.getBlueMask() != 0x000000ff)
        return false;
    if(dcm.getAlphaMask() != 0xff000000)
        return false;
    return true;
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:30,代碼來源:MorphologyOp.java

示例5: isRgbColorModel

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static boolean isRgbColorModel(ColorModel cm) {
    if (cm instanceof DirectColorModel &&
            cm.getTransferType() == DataBuffer.TYPE_INT) {
        DirectColorModel directCM = (DirectColorModel) cm;

        return directCM.getRedMask() == 0x00FF0000 &&
                directCM.getGreenMask() == 0x0000FF00 &&
                directCM.getBlueMask() == 0x000000FF &&
                (directCM.getNumComponents() == 3 ||
                        directCM.getAlphaMask() == 0xFF000000);
    }

    return false;
}
 
開發者ID:teddyted,項目名稱:iSeleda,代碼行數:15,代碼來源:BlendComposite.java

示例6: isBgrColorModel

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static boolean isBgrColorModel(ColorModel cm) {
    if (cm instanceof DirectColorModel &&
            cm.getTransferType() == DataBuffer.TYPE_INT) {
        DirectColorModel directCM = (DirectColorModel) cm;

        return directCM.getRedMask() == 0x000000FF &&
                directCM.getGreenMask() == 0x0000FF00 &&
                directCM.getBlueMask() == 0x00FF0000 &&
                (directCM.getNumComponents() == 3 ||
                        directCM.getAlphaMask() == 0xFF000000);
    }

    return false;
}
 
開發者ID:teddyted,項目名稱:iSeleda,代碼行數:15,代碼來源:BlendComposite.java

示例7: isRgbColorModel

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static boolean isRgbColorModel(ColorModel cm) {
    if (cm instanceof DirectColorModel &&
            cm.getTransferType() == DataBuffer.TYPE_INT) {
        DirectColorModel directCM = (DirectColorModel) cm;

        return directCM.getRedMask() == 0x00FF0000 &&
               directCM.getGreenMask() == 0x0000FF00 &&
               directCM.getBlueMask() == 0x000000FF &&
               (directCM.getNumComponents() == 3 ||
                directCM.getAlphaMask() == 0xFF000000);
    }

    return false;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:15,代碼來源:BlendComposite.java

示例8: isBgrColorModel

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static boolean isBgrColorModel(ColorModel cm) {
    if (cm instanceof DirectColorModel &&
            cm.getTransferType() == DataBuffer.TYPE_INT) {
        DirectColorModel directCM = (DirectColorModel) cm;

        return directCM.getRedMask() == 0x000000FF &&
               directCM.getGreenMask() == 0x0000FF00 &&
               directCM.getBlueMask() == 0x00FF0000 &&
               (directCM.getNumComponents() == 3 ||
                directCM.getAlphaMask() == 0xFF000000);
    }

    return false;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:15,代碼來源:BlendComposite.java

示例9: checkComponentsOrder

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static boolean checkComponentsOrder(ColorModel cm) {
    if (cm instanceof DirectColorModel &&
            cm.getTransferType() == DataBuffer.TYPE_INT) {
        DirectColorModel directCM = (DirectColorModel) cm;
        
        return directCM.getRedMask() == 0x00FF0000 &&
               directCM.getGreenMask() == 0x0000FF00 &&
               directCM.getBlueMask() == 0x000000FF &&
               (directCM.getNumComponents() != 4 ||
                directCM.getAlphaMask() == 0xFF000000);
    }
    
    return false;
}
 
開發者ID:romainguy,項目名稱:filthy-rich-clients,代碼行數:15,代碼來源:BlendComposite.java

示例10: checkComponentsOrder

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static boolean checkComponentsOrder(ColorModel cm) {
    if (cm instanceof DirectColorModel
            && cm.getTransferType() == DataBuffer.TYPE_INT) {
        DirectColorModel directCM = (DirectColorModel) cm;

        return directCM.getRedMask() == 0x00FF0000
                && directCM.getGreenMask() == 0x0000FF00
                && directCM.getBlueMask() == 0x000000FF
                && (directCM.getNumComponents() != 4
                || directCM.getAlphaMask() == 0xFF000000);
    }

    return false;
}
 
開發者ID:jindrapetrik,項目名稱:jpexs-decompiler,代碼行數:15,代碼來源:BlendComposite.java

示例11: extractDirectRGBAInt

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
private static byte[] extractDirectRGBAInt( int aWidth, int aHeight, DirectColorModel aColorModel, SinglePixelPackedSampleModel aSampleModel, DataBufferInt aDataBuffer ) {
  byte[] out = new byte[ aWidth * aHeight * 4 ];

  int rMask = aColorModel.getRedMask();
  int gMask = aColorModel.getGreenMask();
  int bMask = aColorModel.getBlueMask();
  int aMask = aColorModel.getAlphaMask();
  int rShift = getShift( rMask );
  int gShift = getShift( gMask );
  int bShift = getShift( bMask );
  int aShift = getShift( aMask );
  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 += 4 ) {
      int pixel = bank[ pixIx++ ];
      out[ b ] = ( byte ) ( ( pixel & rMask ) >>> rShift );
      out[ b + 1 ] = ( byte ) ( ( pixel & gMask ) >>> gShift );
      out[ b + 2 ] = ( byte ) ( ( pixel & bMask ) >>> bShift );
      out[ b + 3 ] = ( byte ) ( ( pixel & aMask ) >>> aShift );
    }
    scanIx += scanlineStride;
  }
  return out;
}
 
開發者ID:lonnyj,項目名稱:webp-imageio,代碼行數:28,代碼來源:WebP.java

示例12: createProxy

import java.awt.image.DirectColorModel; //導入方法依賴的package包/類
public static SurfaceDataProxy createProxy(SurfaceData srcData,
                                           X11GraphicsConfig dstConfig)
{
    if (srcData instanceof X11SurfaceData) {
        // srcData must be a VolatileImage which either matches
        // our visual or not - either way we do not cache it...
        return UNCACHED;
    }

    ColorModel cm = srcData.getColorModel();
    int transparency = cm.getTransparency();

    if (transparency == Transparency.OPAQUE) {
        return new Opaque(dstConfig);
    } else if (transparency == Transparency.BITMASK) {
        // 4673490: updateBitmask() only handles ICMs with 8-bit indices
        if ((cm instanceof IndexColorModel) && cm.getPixelSize() == 8) {
            return new Bitmask(dstConfig);
        }
        // The only other ColorModel handled by updateBitmask() is
        // a DCM where the alpha bit, and only the alpha bit, is in
        // the top 8 bits
        if (cm instanceof DirectColorModel) {
            DirectColorModel dcm = (DirectColorModel) cm;
            int colormask = (dcm.getRedMask() |
                             dcm.getGreenMask() |
                             dcm.getBlueMask());
            int alphamask = dcm.getAlphaMask();

            if ((colormask & 0xff000000) == 0 &&
                (alphamask & 0xff000000) != 0)
            {
                return new Bitmask(dstConfig);
            }
        }
    }

    // For whatever reason, this image is not a good candidate for
    // caching in a pixmap so we return the non-caching (non-)proxy.
    return UNCACHED;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:42,代碼來源:X11SurfaceDataProxy.java


注:本文中的java.awt.image.DirectColorModel.getAlphaMask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。