[OpenJDK 2D-Dev] Java's definition of the SRC operator
Clemens Eisserer
linuxhippy at gmail.com
Fri Oct 29 19:50:12 UTC 2010
Hi Jim,
> blendresult = PORTER_DUFF(rule, rendercolor, dstcolor, extraalpha)
> // For SRC, blendresult = rendercolor modulated by extra alpha
> storedresult = INTERP(dstcolor, blendresult, aacoverage)
> // For full aa coverage, storedresult = blendresult
>
> The only part of this that could possibly be interpreted as "behaving like
> SRC_OVER" would be the second INTERP and it depends on the aa coverage, not
> on the alpha of the colors involved. Is that what they were talking about?
Thanks for the detailed explanation.
What confuses me is that pixels wich don't have full AA coverage take
the src's alpha into the calculation.
Shouldn't the following operations both yield the same result when
rendered to an opaque destination?
/*SRC*/
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(new Color(255, 0, 0, 1));
g2d.drawLine(100, 120, 200, 220);
/*SRC_OVER*/
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
g2d.setColor(Color.red);
g2d.drawLine(100, 140, 200, 240);
Thanks, Clemens
More information about the 2d-dev
mailing list