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

The following examples show how to use java.awt.image.IndexColorModel#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: HeadlessIndexColorModel.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) {
    IndexColorModel cm =
            new IndexColorModel(8, 1, new byte[]{(byte) 128}, new byte[]{(byte) 128}, new byte[]{(byte) 128});
    cm.getTransparency();
    cm.getComponentSize();
    cm.isAlphaPremultiplied();
    cm.hasAlpha();
    cm.isAlphaPremultiplied();
    cm.getTransferType();
    cm.getPixelSize();
    cm.getComponentSize();
    cm.getNumComponents();
    cm.getNumColorComponents();
    cm.getRed(20);
    cm.getGreen(20);
    cm.getBlue(20);
    cm.getAlpha(20);
    cm.getRGB(20);
    cm.isAlphaPremultiplied();
}
 
Example 2
Source File: PaletteBox.java    From healthcare-dicom-dicomweb-adapter with Apache License 2.0 5 votes vote down vote up
/** Gets the size of the components or the bit depth for all the color
 *  coomponents.
 */
private static byte[] getCompSize(IndexColorModel icm) {
    int[] comp = icm.getComponentSize();
    int size = comp.length;
    byte[] buf = new byte[size];
    for (int i = 0; i < size; i++)
        buf[i] = (byte)(comp[i] - 1);
    return buf;
}
 
Example 3
Source File: PaletteBox.java    From healthcare-dicom-dicomweb-adapter with Apache License 2.0 5 votes vote down vote up
/** Gets the LUT from the <code>IndexColorModel</code> as an two-dimensional
 *  byte array.
 */
private static byte[][] getLUT(IndexColorModel icm) {
    int[] comp = icm.getComponentSize();
    int size = icm.getMapSize();
    byte[][] lut = new byte[comp.length][size];
    icm.getReds(lut[0]);
    icm.getGreens(lut[1]);
    icm.getBlues(lut[2]);
    if (comp.length == 4)
        icm.getAlphas(lut[3]);
    return lut;
}
 
Example 4
Source File: PaletteBox.java    From healthcare-dicom-dicomweb-adapter with Apache License 2.0 4 votes vote down vote up
/** Compute the length of this box. */
private static int computeLength(IndexColorModel icm) {
    int size = icm.getMapSize();
    int[] comp = icm.getComponentSize();
    return 11 + comp.length + size * comp.length;
}