Results 1 to 3 of 3

Thread: RGB out of HSL delivers wrong color if hue is 0

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTGWT-2763 in 3.1 beta.
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223
    Vote Rating
    24
      0  

    Default RGB out of HSL delivers wrong color if hue is 0

    Required Information

    Version(s) of Ext GWT
    Ext GWT 3.0b and 3.1

    Browser versions and OS
    doesn't matter

    Virtual Machine
    doesn't matter

    Description
    There is a bug in RGB calculation out of an HSL. It seem like, it only appears, if the hue is zero. The resulting RGB is always a shade of grey (r=g=b).

    Run mode
    Only tested in development mode.

    Steps to reproduce the problem
    Initilize an RGB with a given HSL with hue = 0.
    See example below.

    Expected result
    RGB in shade of red.

    Actual result
    RGB in shade of grey.

    Test case
    Code:
            RGB rgb = new RGB(new HSL(new RGB(255, 0, 0)));
            GWT.log(rgb.getColor());  // rgb(128, 128, 128)   <<<--- WRONG
            rgb = new RGB(new HSL(new RGB(255, 1, 0)));
            GWT.log(rgb.getColor());  // rgb(255, 1, 0)   <<<--- Right
    Debugging already done
    • In gxt-chart-3.0.0b.jar com.sencha.gxt.chart.client.draw.RGB line 112:
      if (h == 0 || s == 0) {
      shall be
      if (s == 0) {

      The shortcut to set r, g and b each to l seems only correct, if s==0.


    Workaround
    Don't use the RGB(HSL hsl) - Constructer. At least not when hue is zero.

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      0  

    Default

    Thanks for the report, and for the workaround. I have opened a bug in our bug tracker, and will update this thread when we have have made any changes for this.

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
      0  

    Default

    This issue has been fixed in the 3.1 branch, and will go out in the upcoming 3.1 beta. As part of this fix process I put together test cases from http://en.wikipedia.org/wiki/HSL_and_HSV#Examples to make sure that we have complete coverage over the color conversion process. This revealed a few other issues such as floating point precision, and our inconsistent handling of arguments passed into HSL vs HSV objects - these have also been changed to be more consistent.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •