Java Code Examples for java.awt.image.DirectColorModel#getNumComponents()

The following examples show how to use java.awt.image.DirectColorModel#getNumComponents() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlendComposite.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 2
Source File: BlendComposite.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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;
}
 
Example 3
Source File: BlendComposite.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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;
}
 
Example 4
Source File: BlendComposite.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: BlendComposite.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: BlendComposite.java    From Pixelitor with GNU General Public License v3.0 5 votes vote down vote up
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;
}