Java Code Examples for sun.java2d.cmm.CMSManager#getModule()

The following examples show how to use sun.java2d.cmm.CMSManager#getModule() . 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_Profile.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
static byte[] getData(long profileID, int tagSignature) {
int tagSize;
byte[] tagData;

    try {
        PCMM mdl = CMSManager.getModule();

        /* get the number of bytes needed for this tag */
        tagSize = mdl.getTagSize(profileID, tagSignature);

        tagData = new byte[tagSize]; /* get an array for the tag */

        /* get the tag's data */
        mdl.getTagData(profileID, tagSignature, tagData);
    } catch(CMMException c) {
        tagData = null;
    }

    return tagData;
}
 
Example 2
Source File: ICC_Profile.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static byte[] getData(Profile p, int tagSignature) {
int tagSize;
byte[] tagData;

    try {
        PCMM mdl = CMSManager.getModule();

        /* get the number of bytes needed for this tag */
        tagSize = mdl.getTagSize(p, tagSignature);

        tagData = new byte[tagSize]; /* get an array for the tag */

        /* get the tag's data */
        mdl.getTagData(p, tagSignature, tagData);
    } catch(CMMException c) {
        tagData = null;
    }

    return tagData;
}
 
Example 3
Source File: ICC_Profile.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a byte array corresponding to the data of this ICC_Profile.
 * @return A byte array that contains the profile data.
 * @see #setData(int, byte[])
 */
public byte[] getData() {
int profileSize;
byte[] profileData;

    if (ProfileDeferralMgr.deferring) {
        ProfileDeferralMgr.activateProfiles();
    }

    PCMM mdl = CMSManager.getModule();

    /* get the number of bytes needed for this profile */
    profileSize = mdl.getProfileSize(cmmProfile);

    profileData = new byte [profileSize];

    /* get the data for the profile */
    mdl.getProfileData(cmmProfile, profileData);

    return profileData;
}
 
Example 4
Source File: ICC_Profile.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Returns a byte array corresponding to the data of this ICC_Profile.
 * @return A byte array that contains the profile data.
 * @see #setData(int, byte[])
 */
public byte[] getData() {
int profileSize;
byte[] profileData;

    if (ProfileDeferralMgr.deferring) {
        ProfileDeferralMgr.activateProfiles();
    }

    PCMM mdl = CMSManager.getModule();

    /* get the number of bytes needed for this profile */
    profileSize = mdl.getProfileSize(cmmProfile);

    profileData = new byte [profileSize];

    /* get the data for the profile */
    mdl.getProfileData(cmmProfile, profileData);

    return profileData;
}
 
Example 5
Source File: ICC_Profile.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a byte array corresponding to the data of this ICC_Profile.
 * @return A byte array that contains the profile data.
 * @see #setData(int, byte[])
 */
public byte[] getData() {
int profileSize;
byte[] profileData;

    if (ProfileDeferralMgr.deferring) {
        ProfileDeferralMgr.activateProfiles();
    }

    PCMM mdl = CMSManager.getModule();

    /* get the number of bytes needed for this profile */
    profileSize = mdl.getProfileSize(cmmProfile);

    profileData = new byte [profileSize];

    /* get the data for the profile */
    mdl.getProfileData(cmmProfile, profileData);

    return profileData;
}
 
Example 6
Source File: ICC_Profile.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a byte array corresponding to the data of this ICC_Profile.
 * @return A byte array that contains the profile data.
 * @see #setData(int, byte[])
 */
public byte[] getData() {
int profileSize;
byte[] profileData;

    if (ProfileDeferralMgr.deferring) {
        ProfileDeferralMgr.activateProfiles();
    }

    PCMM mdl = CMSManager.getModule();

    /* get the number of bytes needed for this profile */
    profileSize = mdl.getProfileSize(cmmProfile);

    profileData = new byte [profileSize];

    /* get the data for the profile */
    mdl.getProfileData(cmmProfile, profileData);

    return profileData;
}
 
Example 7
Source File: ICC_Profile.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a byte array corresponding to the data of this ICC_Profile.
 * @return A byte array that contains the profile data.
 * @see #setData(int, byte[])
 */
public byte[] getData() {
int profileSize;
byte[] profileData;

    if (ProfileDeferralMgr.deferring) {
        ProfileDeferralMgr.activateProfiles();
    }

    PCMM mdl = CMSManager.getModule();

    /* get the number of bytes needed for this profile */
    profileSize = mdl.getProfileSize(cmmProfile);

    profileData = new byte [profileSize];

    /* get the data for the profile */
    mdl.getProfileData(cmmProfile, profileData);

    return profileData;
}
 
Example 8
Source File: ICC_Profile.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a byte array corresponding to the data of this ICC_Profile.
 * @return A byte array that contains the profile data.
 * @see #setData(int, byte[])
 */
public byte[] getData() {
int profileSize;
byte[] profileData;

    if (ProfileDeferralMgr.deferring) {
        ProfileDeferralMgr.activateProfiles();
    }

    PCMM mdl = CMSManager.getModule();

    /* get the number of bytes needed for this profile */
    profileSize = mdl.getProfileSize(cmmProfile);

    profileData = new byte [profileSize];

    /* get the data for the profile */
    mdl.getProfileData(cmmProfile, profileData);

    return profileData;
}
 
Example 9
Source File: ICC_Profile.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
static byte[] getData(Profile p, int tagSignature) {
int tagSize;
byte[] tagData;

    try {
        PCMM mdl = CMSManager.getModule();

        /* get the number of bytes needed for this tag */
        tagSize = mdl.getTagSize(p, tagSignature);

        tagData = new byte[tagSize]; /* get an array for the tag */

        /* get the tag's data */
        mdl.getTagData(p, tagSignature, tagData);
    } catch(CMMException c) {
        tagData = null;
    }

    return tagData;
}
 
Example 10
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 11
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 12
Source File: ICC_ColorSpace.java    From jdk1.8-source-analysis 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 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 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 14
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 15
Source File: ColorConvertOp.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void updateBITransform(ICC_Profile srcProfile,
                               ICC_Profile destProfile) {
    ICC_Profile[]    theProfiles;
    int              i1, nProfiles, nTransforms, whichTrans, renderState;
    ColorTransform[]  theTransforms;
    boolean          useSrc = false, useDest = false;

    nProfiles = profileList.length;
    nTransforms = nProfiles;
    if ((nProfiles == 0) || (srcProfile != profileList[0])) {
        nTransforms += 1;
        useSrc = true;
    }
    if ((nProfiles == 0) || (destProfile != profileList[nProfiles - 1]) ||
        (nTransforms < 2)) {
        nTransforms += 1;
        useDest = true;
    }

    /* make the profile list */
    theProfiles = new ICC_Profile[nTransforms]; /* the list of profiles
                                                   for this Op */

    int idx = 0;
    if (useSrc) {
        /* insert source as first profile */
        theProfiles[idx++] = srcProfile;
    }

    for (i1 = 0; i1 < nProfiles; i1++) {
                               /* insert profiles defined in this Op */
        theProfiles[idx++] = profileList [i1];
    }

    if (useDest) {
        /* insert dest as last profile */
        theProfiles[idx] = destProfile;
    }

    /* make the transform list */
    theTransforms = new ColorTransform [nTransforms];

    /* initialize transform get loop */
    if (theProfiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                    /* if first profile is a printer
                                       render as colorimetric */
        renderState = ICC_Profile.icRelativeColorimetric;
    }
    else {
        renderState = ICC_Profile.icPerceptual; /* render any other
                                                   class perceptually */
    }

    whichTrans = ColorTransform.In;

    PCMM mdl = CMSManager.getModule();

    /* get the transforms from each profile */
    for (i1 = 0; i1 < nTransforms; i1++) {
        if (i1 == nTransforms -1) {         /* last profile? */
            whichTrans = ColorTransform.Out; /* get output transform */
        }
        else {      /* check for abstract profile */
            if ((whichTrans == ColorTransform.Simulation) &&
                (theProfiles[i1].getProfileClass () ==
                 ICC_Profile.CLASS_ABSTRACT)) {
            renderState = ICC_Profile.icPerceptual;
                whichTrans = ColorTransform.In;
            }
        }

        theTransforms[i1] = mdl.createTransform (
            theProfiles[i1], renderState, whichTrans);

        /* get this profile's rendering intent to select transform
           from next profile */
        renderState = getRenderingIntent(theProfiles[i1]);

        /* "middle" profiles use simulation transform */
        whichTrans = ColorTransform.Simulation;
    }

    /* make the net transform */
    thisTransform = mdl.createTransform(theTransforms);

    /* update corresponding source and dest profiles */
    thisSrcProfile = srcProfile;
    thisDestProfile = destProfile;
}
 
Example 16
Source File: ColorConvertOp.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void updateBITransform(ICC_Profile srcProfile,
                               ICC_Profile destProfile) {
    ICC_Profile[]    theProfiles;
    int              i1, nProfiles, nTransforms, whichTrans, renderState;
    ColorTransform[]  theTransforms;
    boolean          useSrc = false, useDest = false;

    nProfiles = profileList.length;
    nTransforms = nProfiles;
    if ((nProfiles == 0) || (srcProfile != profileList[0])) {
        nTransforms += 1;
        useSrc = true;
    }
    if ((nProfiles == 0) || (destProfile != profileList[nProfiles - 1]) ||
        (nTransforms < 2)) {
        nTransforms += 1;
        useDest = true;
    }

    /* make the profile list */
    theProfiles = new ICC_Profile[nTransforms]; /* the list of profiles
                                                   for this Op */

    int idx = 0;
    if (useSrc) {
        /* insert source as first profile */
        theProfiles[idx++] = srcProfile;
    }

    for (i1 = 0; i1 < nProfiles; i1++) {
                               /* insert profiles defined in this Op */
        theProfiles[idx++] = profileList [i1];
    }

    if (useDest) {
        /* insert dest as last profile */
        theProfiles[idx] = destProfile;
    }

    /* make the transform list */
    theTransforms = new ColorTransform [nTransforms];

    /* initialize transform get loop */
    if (theProfiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                    /* if first profile is a printer
                                       render as colorimetric */
        renderState = ICC_Profile.icRelativeColorimetric;
    }
    else {
        renderState = ICC_Profile.icPerceptual; /* render any other
                                                   class perceptually */
    }

    whichTrans = ColorTransform.In;

    PCMM mdl = CMSManager.getModule();

    /* get the transforms from each profile */
    for (i1 = 0; i1 < nTransforms; i1++) {
        if (i1 == nTransforms -1) {         /* last profile? */
            whichTrans = ColorTransform.Out; /* get output transform */
        }
        else {      /* check for abstract profile */
            if ((whichTrans == ColorTransform.Simulation) &&
                (theProfiles[i1].getProfileClass () ==
                 ICC_Profile.CLASS_ABSTRACT)) {
            renderState = ICC_Profile.icPerceptual;
                whichTrans = ColorTransform.In;
            }
        }

        theTransforms[i1] = mdl.createTransform (
            theProfiles[i1], renderState, whichTrans);

        /* get this profile's rendering intent to select transform
           from next profile */
        renderState = getRenderingIntent(theProfiles[i1]);

        /* "middle" profiles use simulation transform */
        whichTrans = ColorTransform.Simulation;
    }

    /* make the net transform */
    thisTransform = mdl.createTransform(theTransforms);

    /* update corresponding source and dest profiles */
    thisSrcProfile = srcProfile;
    thisDestProfile = destProfile;
}
 
Example 17
Source File: ColorConvertOp.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void updateBITransform(ICC_Profile srcProfile,
                               ICC_Profile destProfile) {
    ICC_Profile[]    theProfiles;
    int              i1, nProfiles, nTransforms, whichTrans, renderState;
    ColorTransform[]  theTransforms;
    boolean          useSrc = false, useDest = false;

    nProfiles = profileList.length;
    nTransforms = nProfiles;
    if ((nProfiles == 0) || (srcProfile != profileList[0])) {
        nTransforms += 1;
        useSrc = true;
    }
    if ((nProfiles == 0) || (destProfile != profileList[nProfiles - 1]) ||
        (nTransforms < 2)) {
        nTransforms += 1;
        useDest = true;
    }

    /* make the profile list */
    theProfiles = new ICC_Profile[nTransforms]; /* the list of profiles
                                                   for this Op */

    int idx = 0;
    if (useSrc) {
        /* insert source as first profile */
        theProfiles[idx++] = srcProfile;
    }

    for (i1 = 0; i1 < nProfiles; i1++) {
                               /* insert profiles defined in this Op */
        theProfiles[idx++] = profileList [i1];
    }

    if (useDest) {
        /* insert dest as last profile */
        theProfiles[idx] = destProfile;
    }

    /* make the transform list */
    theTransforms = new ColorTransform [nTransforms];

    /* initialize transform get loop */
    if (theProfiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                    /* if first profile is a printer
                                       render as colorimetric */
        renderState = ICC_Profile.icRelativeColorimetric;
    }
    else {
        renderState = ICC_Profile.icPerceptual; /* render any other
                                                   class perceptually */
    }

    whichTrans = ColorTransform.In;

    PCMM mdl = CMSManager.getModule();

    /* get the transforms from each profile */
    for (i1 = 0; i1 < nTransforms; i1++) {
        if (i1 == nTransforms -1) {         /* last profile? */
            whichTrans = ColorTransform.Out; /* get output transform */
        }
        else {      /* check for abstract profile */
            if ((whichTrans == ColorTransform.Simulation) &&
                (theProfiles[i1].getProfileClass () ==
                 ICC_Profile.CLASS_ABSTRACT)) {
            renderState = ICC_Profile.icPerceptual;
                whichTrans = ColorTransform.In;
            }
        }

        theTransforms[i1] = mdl.createTransform (
            theProfiles[i1], renderState, whichTrans);

        /* get this profile's rendering intent to select transform
           from next profile */
        renderState = getRenderingIntent(theProfiles[i1]);

        /* "middle" profiles use simulation transform */
        whichTrans = ColorTransform.Simulation;
    }

    /* make the net transform */
    thisTransform = mdl.createTransform(theTransforms);

    /* update corresponding source and dest profiles */
    thisSrcProfile = srcProfile;
    thisDestProfile = destProfile;
}
 
Example 18
Source File: ColorConvertOp.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void updateBITransform(ICC_Profile srcProfile,
                               ICC_Profile destProfile) {
    ICC_Profile[]    theProfiles;
    int              i1, nProfiles, nTransforms, whichTrans, renderState;
    ColorTransform[]  theTransforms;
    boolean          useSrc = false, useDest = false;

    nProfiles = profileList.length;
    nTransforms = nProfiles;
    if ((nProfiles == 0) || (srcProfile != profileList[0])) {
        nTransforms += 1;
        useSrc = true;
    }
    if ((nProfiles == 0) || (destProfile != profileList[nProfiles - 1]) ||
        (nTransforms < 2)) {
        nTransforms += 1;
        useDest = true;
    }

    /* make the profile list */
    theProfiles = new ICC_Profile[nTransforms]; /* the list of profiles
                                                   for this Op */

    int idx = 0;
    if (useSrc) {
        /* insert source as first profile */
        theProfiles[idx++] = srcProfile;
    }

    for (i1 = 0; i1 < nProfiles; i1++) {
                               /* insert profiles defined in this Op */
        theProfiles[idx++] = profileList [i1];
    }

    if (useDest) {
        /* insert dest as last profile */
        theProfiles[idx] = destProfile;
    }

    /* make the transform list */
    theTransforms = new ColorTransform [nTransforms];

    /* initialize transform get loop */
    if (theProfiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                    /* if first profile is a printer
                                       render as colorimetric */
        renderState = ICC_Profile.icRelativeColorimetric;
    }
    else {
        renderState = ICC_Profile.icPerceptual; /* render any other
                                                   class perceptually */
    }

    whichTrans = ColorTransform.In;

    PCMM mdl = CMSManager.getModule();

    /* get the transforms from each profile */
    for (i1 = 0; i1 < nTransforms; i1++) {
        if (i1 == nTransforms -1) {         /* last profile? */
            whichTrans = ColorTransform.Out; /* get output transform */
        }
        else {      /* check for abstract profile */
            if ((whichTrans == ColorTransform.Simulation) &&
                (theProfiles[i1].getProfileClass () ==
                 ICC_Profile.CLASS_ABSTRACT)) {
            renderState = ICC_Profile.icPerceptual;
                whichTrans = ColorTransform.In;
            }
        }

        theTransforms[i1] = mdl.createTransform (
            theProfiles[i1], renderState, whichTrans);

        /* get this profile's rendering intent to select transform
           from next profile */
        renderState = getRenderingIntent(theProfiles[i1]);

        /* "middle" profiles use simulation transform */
        whichTrans = ColorTransform.Simulation;
    }

    /* make the net transform */
    thisTransform = mdl.createTransform(theTransforms);

    /* update corresponding source and dest profiles */
    thisSrcProfile = srcProfile;
    thisDestProfile = destProfile;
}
 
Example 19
Source File: ColorConvertOp.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void updateBITransform(ICC_Profile srcProfile,
                               ICC_Profile destProfile) {
    ICC_Profile[]    theProfiles;
    int              i1, nProfiles, nTransforms, whichTrans, renderState;
    ColorTransform[]  theTransforms;
    boolean          useSrc = false, useDest = false;

    nProfiles = profileList.length;
    nTransforms = nProfiles;
    if ((nProfiles == 0) || (srcProfile != profileList[0])) {
        nTransforms += 1;
        useSrc = true;
    }
    if ((nProfiles == 0) || (destProfile != profileList[nProfiles - 1]) ||
        (nTransforms < 2)) {
        nTransforms += 1;
        useDest = true;
    }

    /* make the profile list */
    theProfiles = new ICC_Profile[nTransforms]; /* the list of profiles
                                                   for this Op */

    int idx = 0;
    if (useSrc) {
        /* insert source as first profile */
        theProfiles[idx++] = srcProfile;
    }

    for (i1 = 0; i1 < nProfiles; i1++) {
                               /* insert profiles defined in this Op */
        theProfiles[idx++] = profileList [i1];
    }

    if (useDest) {
        /* insert dest as last profile */
        theProfiles[idx] = destProfile;
    }

    /* make the transform list */
    theTransforms = new ColorTransform [nTransforms];

    /* initialize transform get loop */
    if (theProfiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                    /* if first profile is a printer
                                       render as colorimetric */
        renderState = ICC_Profile.icRelativeColorimetric;
    }
    else {
        renderState = ICC_Profile.icPerceptual; /* render any other
                                                   class perceptually */
    }

    whichTrans = ColorTransform.In;

    PCMM mdl = CMSManager.getModule();

    /* get the transforms from each profile */
    for (i1 = 0; i1 < nTransforms; i1++) {
        if (i1 == nTransforms -1) {         /* last profile? */
            whichTrans = ColorTransform.Out; /* get output transform */
        }
        else {      /* check for abstract profile */
            if ((whichTrans == ColorTransform.Simulation) &&
                (theProfiles[i1].getProfileClass () ==
                 ICC_Profile.CLASS_ABSTRACT)) {
            renderState = ICC_Profile.icPerceptual;
                whichTrans = ColorTransform.In;
            }
        }

        theTransforms[i1] = mdl.createTransform (
            theProfiles[i1], renderState, whichTrans);

        /* get this profile's rendering intent to select transform
           from next profile */
        renderState = getRenderingIntent(theProfiles[i1]);

        /* "middle" profiles use simulation transform */
        whichTrans = ColorTransform.Simulation;
    }

    /* make the net transform */
    thisTransform = mdl.createTransform(theTransforms);

    /* update corresponding source and dest profiles */
    thisSrcProfile = srcProfile;
    thisDestProfile = destProfile;
}
 
Example 20
Source File: ColorConvertOp.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void updateBITransform(ICC_Profile srcProfile,
                               ICC_Profile destProfile) {
    ICC_Profile[]    theProfiles;
    int              i1, nProfiles, nTransforms, whichTrans, renderState;
    ColorTransform[]  theTransforms;
    boolean          useSrc = false, useDest = false;

    nProfiles = profileList.length;
    nTransforms = nProfiles;
    if ((nProfiles == 0) || (srcProfile != profileList[0])) {
        nTransforms += 1;
        useSrc = true;
    }
    if ((nProfiles == 0) || (destProfile != profileList[nProfiles - 1]) ||
        (nTransforms < 2)) {
        nTransforms += 1;
        useDest = true;
    }

    /* make the profile list */
    theProfiles = new ICC_Profile[nTransforms]; /* the list of profiles
                                                   for this Op */

    int idx = 0;
    if (useSrc) {
        /* insert source as first profile */
        theProfiles[idx++] = srcProfile;
    }

    for (i1 = 0; i1 < nProfiles; i1++) {
                               /* insert profiles defined in this Op */
        theProfiles[idx++] = profileList [i1];
    }

    if (useDest) {
        /* insert dest as last profile */
        theProfiles[idx] = destProfile;
    }

    /* make the transform list */
    theTransforms = new ColorTransform [nTransforms];

    /* initialize transform get loop */
    if (theProfiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                    /* if first profile is a printer
                                       render as colorimetric */
        renderState = ICC_Profile.icRelativeColorimetric;
    }
    else {
        renderState = ICC_Profile.icPerceptual; /* render any other
                                                   class perceptually */
    }

    whichTrans = ColorTransform.In;

    PCMM mdl = CMSManager.getModule();

    /* get the transforms from each profile */
    for (i1 = 0; i1 < nTransforms; i1++) {
        if (i1 == nTransforms -1) {         /* last profile? */
            whichTrans = ColorTransform.Out; /* get output transform */
        }
        else {      /* check for abstract profile */
            if ((whichTrans == ColorTransform.Simulation) &&
                (theProfiles[i1].getProfileClass () ==
                 ICC_Profile.CLASS_ABSTRACT)) {
            renderState = ICC_Profile.icPerceptual;
                whichTrans = ColorTransform.In;
            }
        }

        theTransforms[i1] = mdl.createTransform (
            theProfiles[i1], renderState, whichTrans);

        /* get this profile's rendering intent to select transform
           from next profile */
        renderState = getRenderingIntent(theProfiles[i1]);

        /* "middle" profiles use simulation transform */
        whichTrans = ColorTransform.Simulation;
    }

    /* make the net transform */
    thisTransform = mdl.createTransform(theTransforms);

    /* update corresponding source and dest profiles */
    thisSrcProfile = srcProfile;
    thisDestProfile = destProfile;
}