United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4654826 : spec for AlphaComposite is incomprehensible

Details
Type:
Bug
Submit Date:
2002-03-19
Status:
Closed
Updated Date:
2004-09-13
Project Name:
JDK
Resolved Date:
2003-12-08
Component:
docs
OS:
solaris_2.6,generic
Sub-Component:
guides
CPU:
sparc,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0,5.0
Fixed Versions:
5.0 (b31)

Related Reports
Duplicate:
Duplicate:

Sub Tasks

Description
Name: atR10191			Date: 03/19/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.How color is divided? Does it mean that it's red, green and blue
  components are divided by the value?
2.What does "alpha is discarded" mean? Does it become 1.0f or 0.0?

Note also that specification for the static members of the class do
not recall about this.

For example, CLEAR:
"...
Fs = 0 and Fd = 0, thus:

        Cd = 0
        Ad = 0
"

But when "alpha is discarded", Ad becomes 1.0.
It's quite confusing and ambiguous.


Another contradictory place is the following:
"A constant alpha value can also be specified to be multiplied with the alpha
 value of the source pixels.

 The following abbreviations are used in the description of the rules:

 Cs = one of the color components of the source pixel.
 Cd = one of the color components of the destination pixel.
 As = alpha component of the source pixel.
 Ad = alpha component of the destination pixel.
 Fs = fraction of the source pixel that contributes to the output.
 Fd = fraction of the input destination pixel that contributes to the output.
"
I guess that "A constant alpha value ... " refers to Fs.
So fraction is alpha.
I think it would be much better to name the same thing with the same
term, especially in the complicated documentation.
And I think "fraction" is better than "alpha", because there is
"alpha value of the source pixels" already.
See for example spec for Src field:
"AlphaComposite object that implements the opaque SRC_OVER rule with an alpha
 of 1.0f."
Here I guess alpha is not "alpha value of the source pixels" but rather Fs.
It's quite confusing.
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
generic
tiger-beta

FIXED IN:
tiger-beta

INTEGRATED IN:
tiger-b31
tiger-beta

VERIFIED IN:
1.5


                                     
2004-09-14
EVALUATION

We've fixed this by fleshing out the AlphaComposite and
BufferedImage specs.
###@###.### 2003-12-01
                                     
2003-12-01



Hardware and Software, Engineered to Work Together