Package limn.graphics

Class Path2D

java.lang.Object
limn.graphics.Path2D

public final class Path2D extends Object
Mutable 2D path: move/line/quadratic/cubic segments and closed subpaths, in logical points. Curves are consumed via flatten(float, limn.graphics.Path2D.Flattened), which subdivides them adaptively into line segments within a given tolerance; backends never see curves.

V1 limitations (documented, revisited with the widget set): filling uses each closed subpath independently, with no even-odd/non-zero interaction between subpaths, so paths with holes render as overlapping fills; self-intersecting subpaths are unsupported.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Receives the flattened (curve-free) form of a path.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Closes the current subpath (straight line back to its starting point).
    cubicTo(float c1x, float c1y, float c2x, float c2y, float x, float y)
    Cubic Bézier to (x,y) with control points (c1x,c1y) and (c2x,c2y).
    void
    flatten(float tolerance, Path2D.Flattened out)
    Replays this path with curves adaptively subdivided so that no flattened segment deviates from the true curve by more than tolerance (same units as the path coordinates).
    boolean
    Whether the path has nothing to draw.
    lineTo(float x, float y)
    Extends the current subpath; a no-op before the first moveTo(float, float).
    moveTo(float x, float y)
    Starts a new subpath at a point, in logical points.
    quadTo(float cx, float cy, float x, float y)
    Quadratic Bézier to (x,y) with control point (cx,cy).
    void
    Clears every subpath, keeping the allocated capacity so the path can be reused per frame.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Path2D

      public Path2D()
  • Method Details

    • moveTo

      public Path2D moveTo(float x, float y)
      Starts a new subpath at a point, in logical points.
    • lineTo

      public Path2D lineTo(float x, float y)
      Extends the current subpath; a no-op before the first moveTo(float, float).
    • quadTo

      public Path2D quadTo(float cx, float cy, float x, float y)
      Quadratic Bézier to (x,y) with control point (cx,cy).
    • cubicTo

      public Path2D cubicTo(float c1x, float c1y, float c2x, float c2y, float x, float y)
      Cubic Bézier to (x,y) with control points (c1x,c1y) and (c2x,c2y).
    • close

      public Path2D close()
      Closes the current subpath (straight line back to its starting point).
    • isEmpty

      public boolean isEmpty()
      Whether the path has nothing to draw.
    • reset

      public void reset()
      Clears every subpath, keeping the allocated capacity so the path can be reused per frame.
    • flatten

      public void flatten(float tolerance, Path2D.Flattened out)
      Replays this path with curves adaptively subdivided so that no flattened segment deviates from the true curve by more than tolerance (same units as the path coordinates).