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

bug in finding best color index in IndexColorModel.getDataElements()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.2.1
    • client-libs
    • None
    • 2d
    • 1.2.1
    • beta
    • generic
    • generic

      The current implementation of IndexColorModel.getDataElements()
      attempts to find the best pixel by matching first for best alpha
      and then within the pixels which have the best alpha match choosing
      the one with the best color match.

      The problem with the way the code is written, the idea of "best
      color match so far" is not reset when a better alpha match is found
      so that an older comparison with a color that had a radically
      different alpha value, but a very close color match might continue
      to be considered a close overall match despite the fact that more
      recent comparisons have had much better alpha matches.

      The canonical example of how this disrupts the process is that early
      on if an exact color match is found with the completely wrong alpha
      then a later exact color match with a better alpha will not be used
      because it doesn't have a *better* color match than the older color.
      A special case comparison in the code which tests quickly for an
      exact match will still cause an exact color match to win out, but
      only if all 4 color components match exactly.

      ###@###.### 2005-03-24 02:36:54 GMT

            flar Jim Graham
            flar Jim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: