Package snap.geom

Class Path2DUtils

java.lang.Object
snap.geom.Path2DUtils

public class Path2DUtils extends Object
Utility methods for Path2D.
  • Constructor Details

    • Path2DUtils

      public Path2DUtils()
  • Method Details

    • paintHandles

      public static void paintHandles(Path2D aPath, Painter aPntr, int selPointIndex)
      Handles painting a path showing control point handles.
    • setPointSmoothly

      public static Path2D setPointSmoothly(Shape aPath, int index, Point point)
      Resets the point at the given index to the given point, while preserving path smoothness.
    • addPathPointAtPoint

      public static Path2D addPathPointAtPoint(Shape aPath, Point aPoint)
      Add a point to the curve by subdividing the path segment at the hit point.
    • removePointAtIndexSmoothly

      public static Path2D removePointAtIndexSmoothly(Shape aPath, int pointIndex)
      Delete the selected control point and readjust shape bounds
    • removeSegAtIndexSmoothly

      public static void removeSegAtIndexSmoothly(Path2D aPath, int anIndex)
      Removes the seg at given index, reconnecting the segs on either side of deleted seg.
    • getControlPointBoundsWithSelPointIndex

      public static Rect getControlPointBoundsWithSelPointIndex(Path2D aPath, int selPointIndex)
      Returns the bounds for all the control points.
    • handleAtPoint

      public static int handleAtPoint(Path2D aPath, Point aPoint, int selPointIndex)
      Returns the handle index for a given point for given path. Only returns points that are on the path, except for the control points of selected point (if not -1)
    • isPointOnPath

      public static boolean isPointOnPath(Path2D aPath, int pointIndex)
      Returns true of the point at pointIndex is on the path, and false if it is on the convex hull.