I wanted to do this for a long time. This improves the performance and
quality of the Shape rasterizer (that is used for rendering shapes and
text in the Escher peers for example).
Basically, the coverage information of the anti-aliasing rasterizer is
now no more stored in an array, but in a much more efficient data
structure. This makes the rasterizer code more concise, better
performing and it allows to rasterize with and without anti-aliasing
without penalty (non-AA is then only a special case of AA rasterization,
where the scanline resolution is 1 (2^0), rather than 2^N).
2007-05-18 Roman Kennke <[EMAIL PROTECTED]>
* gnu/java/awt/java2d/AbstractGraphics2D.java
(fillScanlineAA): Removed. Replaced by renderScanline().
(fillScanline): Dito.
(renderScanline): New method. Renders a scanline according to
the coverage information from the scanline converter.
* gnu/java/awt/java2d/Pixelizer.java: New interface. Describes
the targets of the rasterizer.
* gnu/java/awt/java2d/ScanlineConverter.java
(alphaRes): Removed.
(ONE): Removed.
(scanlineCoverage): New field. Manages the coverage information.
(scanlinesPerPixel): Removed.
(scanlineXCov): Removed.
(scanlineYCov): Removed.
(slPix0): Removed.
(ScanlineConverter): Initialize scanline coverage data
structure.
(clear): Also clear the scanline coverage.
(doScanline): Work with Pixelizer objects.
Use the ScanlineCoverage datastructure.
(main): New method. Performs some tests.
(renderShape): Work with pixelizer objects rather than directly
on AbstractGraphic2D. Adjust to use ScanlineCoverage
datastructure.
(setResolution): Set resolution on ScanlineCoverage data too.
* gnu/java/awt/java2d/ScanlineCoverage.java: New class. Stores
and manages scanline coverage information.
/Roman
--
Dipl.-Inf. Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/java2d/AbstractGraphics2D.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java,v
retrieving revision 1.15
diff -u -1 -5 -r1.15 AbstractGraphics2D.java
--- gnu/java/awt/java2d/AbstractGraphics2D.java 8 May 2007 13:27:30 - 1.15
+++ gnu/java/awt/java2d/AbstractGraphics2D.java 18 May 2007 16:22:00 -
@@ -39,54 +39,56 @@
import java.awt.AWTError;
import java.awt.AlphaComposite;
import java.awt.AWTPermission;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.CompositeContext;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.PaintContext;
+import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.Toolkit;
import java.awt.RenderingHints.Key;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.ImageObserver;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
+import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.HashMap;
import java.util.Map;
/**
* This is a 100% Java implementation of the Java2D rendering pipeline. It is
* meant as a base class for Graphics2D implementations.
*
* Backend interface
*
* The backend must at the very least provide a Raster which the the rendering
* pipeline can paint into. This must be implemented in
* [EMAIL PROTECTED] #getDestinationRaster()}. For some backends that might be enough, like
@@ -134,31 +136,31 @@
* using native code. These have proved to two of the most performance
* critical points in the rendering pipeline and cannot really be done quickly
* in plain Java because they involve lots of shuffling around with large
* arrays. In fact, you really would want to let the graphics card to the
* work, they are made for this.
* Provide an accelerated implementa