JDK-4656755 : spec for AlphaComposite is incomprehensible
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 2002-03-22
  • Updated: 2006-08-28
  • Resolved: 2005-03-01
Related Reports
Duplicate :  
Description
Name: atR10191			Date: 03/22/2002


specification for the class AlphaComposite states:
" ...
  The alpha resulting from the compositing operation is stored in the
  destination if the destination has an alpha channel. Otherwise, the resulting
  color is divided by the resulting alpha before being stored in the destination
  and the alpha is discarded. If the alpha value is 0.0, the color values are
  set to 0.0.
"
The questions are:
1. What is such an "alpha channel"?
2. How can we determine if the destination has an alpha channel?
3. Is the rule "If the alpha value is 0.0, the color values are
  set to 0.0." applied always or only if the destination does not have an alpha
  channel?
======================================================================

Comments
EVALUATION To address the previous evaluation comments about whether or not issues have been resolved. First, the text quoted in the description no longer appears in the doc comments for AlphaComposite, so it is hard for it to remain "unclear" when it no longer exists. But, to show how the new spec addresses some of the issues raised: > 1. What is such an "alpha channel"? > 2. How can we determine if the destination has an alpha channel? These issues are not necessarily addressed in the AlphaComposite spec. The class is an instance of the Composite interface which works on Raster and ColorModel objects as inputs. Those classes contain much more information on what an alpha channel is and the various possibilities for image data to have or not have an alpha channel. It would be redundant to go into those details in this spec. > 3. Is the rule "If the alpha value is 0.0, the color values are > set to 0.0." applied always or only if the destination does not have an alpha > channel? That text no long appears. It was an over-simplification. Instead, much more detail is provided about odd cases in the results of the compositing math and various options are provided for how an implementation may treat such cases. In particular, the results are undefined and so the color values end up being irrelevant in the case where the alpha value is 0.0. The spec specifically states that results should always be considered in the premultiplied color space for determining accuracy and since the alpha is 0.0, the color values would have to be multiplied by that value before you can examine them for accuracy in which case the stored values for those colors do not matter as they are multiplied by 0 and become 0 before any such tests. Finally, it looks like the "Duplicate of" field is inaccurate as it refers to a completely unrelated bug. I will try to get it changed back to the correct bug id - 4654826.
28-08-2006

EVALUATION This fix for this will be included in the fix for 4654826. I'm closing this for ease of bookkeeping. ###@###.### 2003-10-21 ========================================================================== Reopened because following issues have not been resolved: > 2. How can we determine if the destination has an alpha channel? > 3. Is the rule "If the alpha value is 0.0, the color values are > set to 0.0." applied always or only if the destination does not have an alpha > channel? The fix for 4654826 does not address these issues. ###@###.### 2004-03-30
30-03-2004