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

Color(int rgba, boolean hasalpha) documentation misleading

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 5.0
    • client-libs
    • Fix Understood
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_05"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
       Windows 2000 5.0

      A DESCRIPTION OF THE PROBLEM :
      Color(int rgba, boolean hasalpha)
                Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.

      This javadoc is misleading. The variable should be called argb not rgba to make it clear the alpha channel goes in the high order bits.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Look in the JDK docs for java.awt.Color

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The variable should follow the convention used elsewhere in the JDK when talking about mapping colours to ints.
      ACTUAL -
      The naming convention in violated.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      read the docs carefully not just the misleading one line summary.

            yan Yuri Nesterenko
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: