RFR: 8288633: The ICC_ColorSpace.fromCIEXYZ method uses the wrong rendering intent

Sergey Bylokhov serb at openjdk.org
Fri Jun 17 03:36:45 UTC 2022


On Fri, 17 Jun 2022 00:09:28 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> The specification of the  ICC_ColorSpace.fromCIEXYZ method [says](https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/9d4b25e7888098a866ff980e37b8d16d456906d8/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java*L428__;Iw!!ACWV5N9M2RV99hQ!O6u_5a2OIv7nQRvzuo8YPagpD5wweMTCcCMXjlAULI5kuKM3O6ylgYgAkXRlVnqJZwTMSj08ApwCsE_EIQeU5A$ ):
> 
>> * This method transforms color values using relative colorimetry, as defined by the ICC Specification.
> 
> The LCMS plugin implementation expects the rendering intent in the first part of transform:
> https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/9d4b25e7888098a866ff980e37b8d16d456906d8/src/java.desktop/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java*L116__;Iw!!ACWV5N9M2RV99hQ!O6u_5a2OIv7nQRvzuo8YPagpD5wweMTCcCMXjlAULI5kuKM3O6ylgYgAkXRlVnqJZwTMSj08ApwCsE-MkB32-w$ 
> 
> But the ICC_ColorSpace.fromCIEXYZ pass "ICC_Profile.icRelativeColorimetric" to the [second ](https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/9d4b25e7888098a866ff980e37b8d16d456906d8/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java*L534__;Iw!!ACWV5N9M2RV99hQ!O6u_5a2OIv7nQRvzuo8YPagpD5wweMTCcCMXjlAULI5kuKM3O6ylgYgAkXRlVnqJZwTMSj08ApwCsE8nfC5jpQ$ ) part of transform. 
> 
> Note that ICC_ColorSpace.toCIEXYZ has a similar [specification ](https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/9d4b25e7888098a866ff980e37b8d16d456906d8/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java*L288)is__;Iw!!ACWV5N9M2RV99hQ!O6u_5a2OIv7nQRvzuo8YPagpD5wweMTCcCMXjlAULI5kuKM3O6ylgYgAkXRlVnqJZwTMSj08ApwCsE9fNODMBw$  implemented [properly](https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/9d4b25e7888098a866ff980e37b8d16d456906d8/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java*L391__;Iw!!ACWV5N9M2RV99hQ!O6u_5a2OIv7nQRvzuo8YPagpD5wweMTCcCMXjlAULI5kuKM3O6ylgYgAkXRlVnqJZwTMSj08ApwCsE_VcZTZVA$ ).

src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java line 539:

> 537:                         transforms[1] = mdl.createTransform(thisProfile,
> 538:                                         ColorTransform.Any, ColorTransform.Out);
> 539:                     }

Note that this try/catch block is not needed, we never throw the exceptions here, but I follow this pattern for now. Will clean up it in the separate PR.

-------------

PR: https://git.openjdk.org/jdk/pull/9194



More information about the client-libs-dev mailing list