Class SimpleRasterizer


  • public class SimpleRasterizer
    extends java.lang.Object
    Simple scanline rasterizer. Caller provides a callback to draw pixels to actual surface.
    • Constructor Detail

      • SimpleRasterizer

        public SimpleRasterizer()
    • Method Detail

      • getWidth

        public final int getWidth()
      • getHeight

        public final int getHeight()
      • flush

        public final void flush()
        Flushes any cached scans.
      • addTriangle

        public final void addTriangle​(double x1,
                                      double y1,
                                      double x2,
                                      double y2,
                                      double x3,
                                      double y3)
        Adds edges of a triangle.
      • addRing

        public final void addRing​(double[] xy)
        Adds edges of the ring to the rasterizer.
        Parameters:
        xy - interleaved coordinates x1, y1, x2, y2,...
      • startAddingEdges

        public final void startAddingEdges()
        Call before starting the edges. For example to render two polygons that consist of a single ring: startAddingEdges(); addRing(...); renderEdges(Rasterizer.EVEN_ODD); addRing(...); renderEdges(Rasterizer.EVEN_ODD); For example to render a polygon consisting of three rings: startAddingEdges(); addRing(...); addRing(...); addRing(...); renderEdges(Rasterizer.EVEN_ODD);
      • renderEdges

        public final void renderEdges​(int fillMode)
        Renders all edges added so far, and removes them. Calls startAddingEdges after it's done.
        Parameters:
        fillMode - Fill mode for the polygon fill can be one of two values: EVEN_ODD or WINDING. Note, as any other graphics algorithm, the scan line rasterizer doesn't require polygons to be topologically simple, or have correct ring orientation.
      • addEdge

        public final void addEdge​(double x1,
                                  double y1,
                                  double x2,
                                  double y2)
        Add a single edge.
        Parameters:
        x1 -
        y1 -
        x2 -
        y2 -
      • fillEnvelope

        public final void fillEnvelope​(Envelope2D envIn)
      • addSegmentStroke

        final boolean addSegmentStroke​(double x1,
                                       double y1,
                                       double x2,
                                       double y2,
                                       double half_width,
                                       boolean skip_short,
                                       double[] helper_xy_10_elm)
      • estimateMemorySize

        public long estimateMemorySize()
      • advanceAET_

        private final void advanceAET_()
      • addNewEdgesToAET_

        private final void addNewEdgesToAET_​(int y)
      • snap_

        private static int snap_​(int x,
                                 int mi,
                                 int ma)
      • emitScans_

        private final void emitScans_()