sun.java2d.cmm.ColorTransform Java Examples

The following examples show how to use sun.java2d.cmm.ColorTransform. 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: ICC_ColorSpace.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #2
Source File: LCMS.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #3
Source File: ICC_ColorSpace.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #4
Source File: LCMS.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #5
Source File: ICC_ColorSpace.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #6
Source File: ICC_ColorSpace.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #7
Source File: ICC_ColorSpace.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #8
Source File: ICC_ColorSpace.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this {@code ColorSpace} into a
 * value in the default {@code CS_sRGB} color space.
 * <p>
 * This method transforms color values using algorithms designed to produce
 * the best perceptual match between input and output colors. In order to do
 * colorimetric conversion of color values, you should use the
 * {@code toCIEXYZ} method of this color space to first convert from the
 * input color space to the {@code CS_CIEXYZ} color space, and then use the
 * {@code fromCIEXYZ} method of the {@code CS_sRGB} color space to convert
 * from {@code CS_CIEXYZ} to the output color space. See
 * {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 *
 * @param  colorvalue a float array with length of at least the number of
 *         components in this {@code ColorSpace}
 * @return a float array of length 3
 * @throws ArrayIndexOutOfBoundsException if array length is not at least
 *         the number of components in this {@code ColorSpace}
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short[] tmp = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #9
Source File: ICC_ColorSpace.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default {@code CS_sRGB}
 * color space into this {@code ColorSpace}.
 * <p>
 * This method transforms color values using algorithms designed to produce
 * the best perceptual match between input and output colors. In order to do
 * colorimetric conversion of color values, you should use the
 * {@code toCIEXYZ} method of the {@code CS_sRGB} color space to first
 * convert from the input color space to the {@code CS_CIEXYZ} color space,
 * and then use the {@code fromCIEXYZ} method of this color space to convert
 * from {@code CS_CIEXYZ} to the output color space. See
 * {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 *
 * @param  rgbvalue a float array with length of at least 3
 * @return a float array with length equal to the number of components in
 *         this {@code ColorSpace}
 * @throws ArrayIndexOutOfBoundsException if array length is not at least 3
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short[] tmp = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #10
Source File: LCMS.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #11
Source File: LCMS.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #12
Source File: ICC_ColorSpace.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the {@code toCIEXYZ}
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * {@code fromCIEXYZ} method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 *
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #13
Source File: ICC_ColorSpace.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the {@code toCIEXYZ}
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * {@code fromCIEXYZ} method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 *
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #14
Source File: ICC_ColorSpace.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #15
Source File: LCMS.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #16
Source File: LCMS.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #17
Source File: ICC_ColorSpace.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #18
Source File: ICC_ColorSpace.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #19
Source File: LCMS.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #20
Source File: LCMS.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #21
Source File: ICC_ColorSpace.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #22
Source File: ICC_ColorSpace.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #23
Source File: ICC_ColorSpace.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #24
Source File: ICC_ColorSpace.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #25
Source File: ICC_ColorSpace.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #26
Source File: LCMS.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}
 
Example #27
Source File: ICC_ColorSpace.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #28
Source File: ICC_ColorSpace.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in this ColorSpace
 * into a value in the default CS_sRGB color space.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of this color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of the CS_sRGB color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param colorvalue a float array with length of at least the number
 *      of components in this ColorSpace.
 * @return a float array of length 3.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least the number of components in this ColorSpace.
 */
public float[]    toRGB (float[] colorvalue) {

    if (this2srgb == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.Out);
        this2srgb = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    int nc = this.getNumComponents();
    short tmp[] = new short[nc];
    for (int i = 0; i < nc; i++) {
        tmp[i] = (short)
            ((colorvalue[i] - minVal[i]) * invDiffMinMax[i] + 0.5f);
    }
    tmp = this2srgb.colorConvert(tmp, null);
    float[] result = new float [3];
    for (int i = 0; i < 3; i++) {
        result[i] = ((float) (tmp[i] & 0xffff)) / 65535.0f;
    }
    return result;
}
 
Example #29
Source File: ICC_ColorSpace.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Transforms a color value assumed to be in the default CS_sRGB
 * color space into this ColorSpace.
 * <p>
 * This method transforms color values using algorithms designed
 * to produce the best perceptual match between input and output
 * colors.  In order to do colorimetric conversion of color values,
 * you should use the <code>toCIEXYZ</code>
 * method of the CS_sRGB color space to first convert from the input
 * color space to the CS_CIEXYZ color space, and then use the
 * <code>fromCIEXYZ</code> method of this color space to
 * convert from CS_CIEXYZ to the output color space.
 * See {@link #toCIEXYZ(float[]) toCIEXYZ} and
 * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
 * <p>
 * @param rgbvalue a float array with length of at least 3.
 * @return a float array with length equal to the number of
 *       components in this ColorSpace.
 * @throws ArrayIndexOutOfBoundsException if array length is not
 * at least 3.
 */
public float[]    fromRGB(float[] rgbvalue) {

    if (srgb2this == null) {
        ColorTransform[] transformList = new ColorTransform [2];
        ICC_ColorSpace srgbCS =
            (ICC_ColorSpace) ColorSpace.getInstance (CS_sRGB);
        PCMM mdl = CMSManager.getModule();
        transformList[0] = mdl.createTransform(
            srgbCS.getProfile(), ColorTransform.Any, ColorTransform.In);
        transformList[1] = mdl.createTransform(
            thisProfile, ColorTransform.Any, ColorTransform.Out);
        srgb2this = mdl.createTransform(transformList);
        if (needScaleInit) {
            setComponentScaling();
        }
    }

    short tmp[] = new short[3];
    for (int i = 0; i < 3; i++) {
        tmp[i] = (short) ((rgbvalue[i] * 65535.0f) + 0.5f);
    }
    tmp = srgb2this.colorConvert(tmp, null);
    int nc = this.getNumComponents();
    float[] result = new float [nc];
    for (int i = 0; i < nc; i++) {
        result[i] = (((float) (tmp[i] & 0xffff)) / 65535.0f) *
                    diffMinMax[i] + minVal[i];
    }
    return result;
}
 
Example #30
Source File: LCMS.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs ColorTransform object corresponding to an ICC_profile
 */
public ColorTransform createTransform(ICC_Profile profile,
                                                   int renderType,
                                                   int transformType)
{
    return new LCMSTransform(profile, renderType, renderType);
}