-
Bug
-
Resolution: Fixed
-
P3
-
1.2.1
-
None
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
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
- duplicates
-
JDK-6248951 IndexColorModel uses poor heuristics to match colors with alpha
- Closed
- relates to
-
JDK-6564923 Mouse cursor no longer supports transparency
- Closed