<Swing Dev> RFR JDK-8042055: Nimbus DerivedColor incorrectly clamps hue
Prasanta Sadhukhan
prasanta.sadhukhan at oracle.com
Wed Jul 15 09:01:19 UTC 2020
Hi All,
Please review a fix for a nimbus issue where it is seen that "hue" color
in Nimbus.DerivedColor.rederiveColor is being incorrectly clamped.
rederiveColor() calls Color.HSBtoRGB() to get the RGB color from
Hue/Saturation/Brightness color and as per HSBtoRGB spec
https://docs.oracle.com/en/java/javase/14/docs/api/java.desktop/java/awt/Color.html#HSBtoRGB(float,float,float)
it is mentioned "The |hue| component can be any floating-point number.
The floor of this number is subtracted from it to create a fraction
between 0 and 1"
whereas "The |saturation| and |brightness| components should be
floating-point values between zero and one (numbers in the range 0.0-1.0)".
So, although it is alright to clamp saturation and brightness value
within 0.0-1.0 before calling Color.HSBtoRGB(), it is not supposed to be
done for "hue" color as it is getting clamped inside HSBtoRGB() method.
Proposed fix is to do away with this incorrect clamp.
Bug: https://bugs.openjdk.java.net/browse/JDK-8042055
webrev: http://cr.openjdk.java.net/~psadhukhan/8042055/webrev.0/
Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20200715/9fe1a3b6/attachment.htm>
More information about the swing-dev
mailing list