sun.java2d.cmm.CMSManager Java Examples
The following examples show how to use
sun.java2d.cmm.CMSManager.
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 jdk8u60 with GNU General Public License v2.0 | 6 votes |
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 #2
Source File: ICC_Profile.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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 JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 #5
Source File: ICC_Profile.java From JDKSourceCode1.8 with MIT License | 6 votes |
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 #6
Source File: ICC_Profile.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * 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(ID); profileData = new byte [profileSize]; /* get the data for the profile */ mdl.getProfileData(ID, profileData); return profileData; }
Example #7
Source File: ICC_Profile.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Returns a byte array corresponding to the data of this * {@code 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-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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 jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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_Profile.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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 #11
Source File: ICC_Profile.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * 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 #12
Source File: ICC_Profile.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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 #13
Source File: ICC_Profile.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * 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 #14
Source File: ICC_Profile.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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 #15
Source File: ICC_Profile.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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 #16
Source File: ICC_Profile.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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 #17
Source File: ICC_Profile.java From Java8CN with Apache License 2.0 | 6 votes |
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 #18
Source File: ICC_Profile.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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 #19
Source File: ICC_Profile.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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 #20
Source File: ICC_Profile.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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 #21
Source File: ICC_ColorSpace.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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 jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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_Profile.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Frees the resources associated with an ICC_Profile object. */ protected void finalize () { if (cmmProfile != null) { CMSManager.getModule().freeProfile(cmmProfile); } else if (profileActivator != null) { ProfileDeferralMgr.unregisterDeferral(profileActivator); } }
Example #24
Source File: ICC_ColorSpace.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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 #25
Source File: ICC_ColorSpace.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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: ICC_Profile.java From Java8CN with Apache License 2.0 | 5 votes |
/** * Frees the resources associated with an ICC_Profile object. */ protected void finalize () { if (cmmProfile != null) { CMSManager.getModule().freeProfile(cmmProfile); } else if (profileActivator != null) { ProfileDeferralMgr.unregisterDeferral(profileActivator); } }
Example #27
Source File: ICC_ColorSpace.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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 #28
Source File: ICC_Profile.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Frees the resources associated with an ICC_Profile object. */ protected void finalize () { if (cmmProfile != null) { CMSManager.getModule().freeProfile(cmmProfile); } else if (profileActivator != null) { ProfileDeferralMgr.unregisterDeferral(profileActivator); } }
Example #29
Source File: ICC_ColorSpace.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * 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 #30
Source File: ICC_ColorSpace.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * 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; }