Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6528710

sRGB-ColorSpace to sRGB-ColorSpace Conversion

XMLWordPrintable

    • 2d
    • b26
    • x86
    • windows_xp

        FULL PRODUCT VERSION :
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

        A DESCRIPTION OF THE PROBLEM :
        sRGB-ColorSpace to sRGB-ColorSpace Conversion in JAVA6 has improved in comparision to JAVA5, but it is still erroneous.

        Included testcase should create a pure white color, but green-component is 254 instead of 255.

        ---

        ColorSpace cspace = ColorSpace.getInstance( ColorSpace.CS_sRGB );
        float fvalue[] = new float[] { 1.0f, 1.0f, 1.0f };
        Color c = new Color( cspace, fvalue, 1.0f );
        System.out.println( c );//should be "java.awt.Color[r=255,g=255,b=255]"

        float frgbvalue[] = cspace.toRGB( fvalue );
        for( int i = 0; i < 3; ++i )
          System.out.println( fvalue[i] + " -> " + frgbvalue[i] );//should always be "1.0 -> 1.0"

        ---

        Results for JAVA6 (1.6.0):
        java.awt.Color[r=255,g=254,b=255]
        1.0 -> 1.0
        1.0 -> 0.99998474
        1.0 -> 1.0

        Results for JAVA5 (1.5.0_10):
        java.awt.Color[r=251,g=253,b=253]
        1.0 -> 0.98770124
        1.0 -> 0.9933623
        1.0 -> 0.99574274


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class ColorSpaceTest
        {
        public static void main( String[] args )
        {
        ColorSpace cspace = ColorSpace.getInstance( ColorSpace.CS_sRGB );
        float fvalue[] = new float[] { 1.0f, 1.0f, 1.0f };
        Color c = new Color( cspace, fvalue, 1.0f );
        System.out.println( c );

        float frgbvalue[] = cspace.toRGB( fvalue );
        for( int i = 0; i < 3; ++i )
        System.out.println( fvalue[i] + " -> " + frgbvalue[i] );
        }
        }
        ---------- END SOURCE ----------

              serb Sergey Bylokhov
              ryeung Roger Yeung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: