Java Code Examples for java.awt.color.ColorSpace#getMaxValue()

The following examples show how to use java.awt.color.ColorSpace#getMaxValue() . 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: DataConversionTests.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 2
Source File: DataConversionTests.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 3
Source File: DataConversionTests.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 4
Source File: DataConversionTests.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 5
Source File: DataConversionTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 6
Source File: DataConversionTests.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 7
Source File: DataConversionTests.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 8
Source File: DataConversionTests.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 9
Source File: DataConversionTests.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 10
Source File: DataConversionTests.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Context(TestEnvironment env, Result result, ColorSpace cs) {
    this.cs = cs;
    this.env = env;
    this.res = result;

    numComponents = cs.getNumComponents();

    val = new float[numComponents];

    for (int i = 0; i < numComponents; i++) {
        float min = cs.getMinValue(i);
        float max = cs.getMaxValue(i);

        val[i] = 0.5f * (max - min);
    }

    rgb = new float[]{0.5f, 0.5f, 0.5f};
    cie = new float[]{0.5f, 0.5f, 0.5f};
}
 
Example 11
Source File: DirectColorModel.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 12
Source File: DirectColorModel.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 13
Source File: DirectColorModel.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 14
Source File: DirectColorModel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 15
Source File: DirectColorModel.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs a {@code DirectColorModel} from the specified
 * parameters.  Color components are in the specified
 * {@code ColorSpace}, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an {@code int} pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If {@code amask} is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an {@code int} pixel
 * representation.  If there is alpha, the {@code boolean}
 * {@code isAlphaPremultiplied} specifies how to interpret
 * color and alpha samples in pixel values.  If the {@code boolean}
 * is {@code true}, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified {@code ColorSpace}
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied {@code true} if color samples are
 *        premultiplied by the alpha sample; {@code false} otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if {@code space} is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 16
Source File: DirectColorModel.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a {@code DirectColorModel} from the specified
 * parameters.  Color components are in the specified
 * {@code ColorSpace}, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an {@code int} pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If {@code amask} is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an {@code int} pixel
 * representation.  If there is alpha, the {@code boolean}
 * {@code isAlphaPremultiplied} specifies how to interpret
 * color and alpha samples in pixel values.  If the {@code boolean}
 * is {@code true}, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified {@code ColorSpace}
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied {@code true} if color samples are
 *        premultiplied by the alpha sample; {@code false} otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if {@code space} is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 17
Source File: DirectColorModel.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 18
Source File: DirectColorModel.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 19
Source File: DirectColorModel.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}
 
Example 20
Source File: DirectColorModel.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a <code>DirectColorModel</code> from the specified
 * parameters.  Color components are in the specified
 * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB
 * and have minimum normalized component values which are all 0.0
 * and maximum values which are all 1.0.
 * The masks specify which bits in an <code>int</code> pixel
 * representation contain the red, green and blue color samples and
 * the alpha sample, if present.  If <code>amask</code> is 0, pixel
 * values do not contain alpha information and all pixels are treated
 * as opaque, which means that alpha&nbsp;=&nbsp;1.0.  All of the
 * bits in each mask must be contiguous and fit in the specified number
 * of least significant bits of an <code>int</code> pixel
 * representation.  If there is alpha, the <code>boolean</code>
 * <code>isAlphaPremultiplied</code> specifies how to interpret
 * color and alpha samples in pixel values.  If the <code>boolean</code>
 * is <code>true</code>, color samples are assumed to have been
 * multiplied by the alpha sample.  The transparency value is
 * Transparency.OPAQUE, if no alpha is present, or
 * Transparency.TRANSLUCENT otherwise.  The transfer type
 * is the type of primitive array used to represent pixel values and
 * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or
 * DataBuffer.TYPE_INT.
 * @param space the specified <code>ColorSpace</code>
 * @param bits the number of bits in the pixel values; for example,
 *         the sum of the number of bits in the masks.
 * @param rmask specifies a mask indicating which bits in an
 *         integer pixel contain the red component
 * @param gmask specifies a mask indicating which bits in an
 *         integer pixel contain the green component
 * @param bmask specifies a mask indicating which bits in an
 *         integer pixel contain the blue component
 * @param amask specifies a mask indicating which bits in an
 *         integer pixel contain the alpha component
 * @param isAlphaPremultiplied <code>true</code> if color samples are
 *        premultiplied by the alpha sample; <code>false</code> otherwise
 * @param transferType the type of array used to represent pixel values
 * @throws IllegalArgumentException if <code>space</code> is not a
 *         TYPE_RGB space or if the min/max normalized component
 *         values are not 0.0/1.0.
 */
public DirectColorModel(ColorSpace space, int bits, int rmask,
                        int gmask, int bmask, int amask,
                        boolean isAlphaPremultiplied,
                        int transferType) {
    super (space, bits, rmask, gmask, bmask, amask,
           isAlphaPremultiplied,
           amask == 0 ? Transparency.OPAQUE : Transparency.TRANSLUCENT,
           transferType);
    if (ColorModel.isLinearRGBspace(colorSpace)) {
        is_LinearRGB = true;
        if (maxBits <= 8) {
            lRGBprecision = 8;
            tosRGB8LUT = ColorModel.getLinearRGB8TosRGB8LUT();
            fromsRGB8LUT8 = ColorModel.getsRGB8ToLinearRGB8LUT();
        } else {
            lRGBprecision = 16;
            tosRGB8LUT = ColorModel.getLinearRGB16TosRGB8LUT();
            fromsRGB8LUT16 = ColorModel.getsRGB8ToLinearRGB16LUT();
        }
    } else if (!is_sRGB) {
        for (int i = 0; i < 3; i++) {
            // super constructor checks that space is TYPE_RGB
            // check here that min/max are all 0.0/1.0
            if ((space.getMinValue(i) != 0.0f) ||
                (space.getMaxValue(i) != 1.0f)) {
                throw new IllegalArgumentException(
                    "Illegal min/max RGB component value");
            }
        }
    }
    setFields();
}