本文整理汇总了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;
}
示例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;
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}