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
    Posts
    108
    Vote Rating
    7
    Andreas Samjeske is on a distinguished road

      0  

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

    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 - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      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 - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      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.

Thread Participants: 1

Tags for this Thread