> Should repeated antialiased renderings render pixels exactly
> the same on each pass with a rule like AlphaComposite.Src (or
> AlphaComposite.SrcOver on an onscreen buffer)?

Each AA operation will individually take each partially covered pixel,
compute the value that would be stored there if the pixel were
completely covered (== SRCPIXEL in the case of AC.Src) and then blend
that color into the destination with the ratio specified by the pixel
coverage.  If you render the exact same line again, it will reblend
again and slowly the pixel will start to approximate the result that
would have been achieved if the pixel had been completely covered.

For example, filling a path with white on a black destination, if one
of the pixels is 50% covered by the path then on the first pass you
get 50% gray (50% white plus 50% black).  On the second pass you
get 75% gray (50% halfgray plus 50% white).  On the third pass you get
87.5% gray (50% 3/4gray plus 50% white).  Etc.

Another drawback is if you have two paths which abut and together
completely cover a pixel, but individually each only cover half of
the pixel.  In this case they will fail to obliterate the background
color using our primitive-by-primitive AA technique.  If both paths
are filled with white and each covers a different half of a black
pixel (one path covers the left half and the other covers the right
half for instance), then you don't end up with a white pixel in the
end, you end up with a 75% gray pixel since each blend operation
moved the black pixel half way towards white in two separate steps.

If you want antialiasing where the repeated renderings don't accumulate
in this fashion then you need to keep track of the "history" of each
pixel and store subpixel masks of which parts are "covered" by which
color and recompute the total color on every pass.  An easy way to do
this is to oversample - render the entire frame at N times the size
and then scale down by 1/N when pushing the result to the screen using
an interpolative scaling algorithm (bilinear is OK if N is small, but
you would want a filter that averaged the colors together if N is
larger).  We don't implement these subpixel masks and you can do the
oversampling yourself if you want a better result at the cost of memory.

The provided AA in 2D does a great job on most rendering tasks, just
avoid situations where you repeatedly render the same path or render
paths that are supposed to be "abutting" each other...

                                ...jim

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to