Java Code Examples for java.awt.image.ColorModel#getComponentSize()

The following examples show how to use java.awt.image.ColorModel#getComponentSize() . 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: GIFImageWriterSpi.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 2
Source File: GIFImageWriterSpi.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 3
Source File: GIFImageWriterSpi.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 4
Source File: GIFImageWriterSpi.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 5
Source File: GIFImageWriterSpi.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 6
Source File: GIFImageWriterSpi.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 7
Source File: GIFImageWriterSpi.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 8
Source File: GIFImageWriterSpi.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 9
Source File: GIFImageWriterSpi.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 10
Source File: GIFImageWriterSpi.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
Example 11
Source File: GIFImageWriter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 12
Source File: GIFImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 13
Source File: GIFImageWriter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 14
Source File: GIFImageWriter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 15
Source File: GIFImageWriter.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 16
Source File: GIFImageWriter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 17
Source File: GIFImageWriter.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private boolean needToCreateIndex(RenderedImage image) {

        SampleModel sampleModel = image.getSampleModel();
        ColorModel colorModel = image.getColorModel();

        return sampleModel.getNumBands() != 1 ||
            sampleModel.getSampleSize()[0] > 8 ||
            colorModel.getComponentSize()[0] > 8;
    }
 
Example 18
Source File: SoftwareParallelVideoRenderer.java    From mochadoom with GNU General Public License v3.0 4 votes vote down vote up
/**
 * It will render much faster on machines with display already in HiColor mode
 * Maybe even some acceleration will be possible
 */
static boolean checkConfigurationHicolor() {
    final ColorModel cm = GRAPHICS_CONF.getColorModel();
    final int cps = cm.getNumComponents();
    return cps == 3 && cm.getComponentSize(0) == 5 && cm.getComponentSize(1) == 5 && cm.getComponentSize(2) == 5;
}
 
Example 19
Source File: ChannelDefinitionBox.java    From healthcare-dicom-dicomweb-adapter with Apache License 2.0 4 votes vote down vote up
/** Computes the length of this box from the provided
 *  <code>ColorModel</code>.
 */
private static int computeLength(ColorModel colorModel) {
    int length = colorModel.getComponentSize().length - 1;
    return 10 +
           (colorModel.isAlphaPremultiplied() ? length * 18 : length * 12);
}
 
Example 20
Source File: SoftwareParallelVideoRenderer.java    From mochadoom with GNU General Public License v3.0 4 votes vote down vote up
/**
 * It will render much faster on machines with display already in TrueColor mode
 * Maybe even some acceleration will be possible
 */
static boolean checkConfigurationTruecolor() {
    final ColorModel cm = GRAPHICS_CONF.getColorModel();
    final int cps = cm.getNumComponents();
    return cps == 3 && cm.getComponentSize(0) == 8 && cm.getComponentSize(1) == 8 && cm.getComponentSize(2) == 8;
}