Class Path

java.lang.Object
icyllis.arc3d.core.Path
icyllis.modernui.graphics.Path
All Implemented Interfaces:
PathConsumer, PathIterable

public class Path extends Path
The Path object contains mutable path elements.

Path may be empty, or contain one or more verbs that outline a figure. Path always starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves. Adding a close verb makes the geometry into a continuous loop, a closed contour. Path may contain any number of contours, each beginning with a move verb.

Path contours may contain only a move verb, or may also contain lines, quadratic Béziers, and cubic Béziers. Path contours may be open or closed.

When used to draw a filled area, Path describes whether the fill is inside or outside the geometry. Path also describes the winding rule used to fill overlapping contours.

  • Constructor Details

    • Path

      public Path()
      Creates an empty Path with a default fill rule of Path.FILL_NON_ZERO.
    • Path

      public Path(@NonNull Path path)
      Creates a copy of an existing Path object.

      Internally, the two paths share reference values. The underlying verb array, coordinate array and weights are copied when modified.

  • Method Details

    • reset

      public void reset()
      Resets the path to its initial state, clears points and verbs and sets fill rule to Path.FILL_NON_ZERO.

      Preserves internal storage if it's unique, otherwise discards.

      Overrides:
      reset in class Path
    • clear

      public void clear()
      Resets the path to its initial state, clears points and verbs and sets fill rule to Path.FILL_NON_ZERO.

      Preserves internal storage if it's unique, otherwise allocates new storage with the same size.

      Overrides:
      clear in class Path
    • recycle

      public void recycle()
      Resets the path to its initial state, clears points and verbs and sets fill rule to Path.FILL_NON_ZERO.

      This explicitly discards the internal storage, it is recommended to call when the path object will be no longer used.

      Overrides:
      recycle in class Path
    • relativeMoveTo

      public final void relativeMoveTo(float dx, float dy)
      Relative version of "move to".
      Parameters:
      dx - offset from last point to contour start on x-axis
      dy - offset from last point to contour start on y-axis
    • relativeLineTo

      public final void relativeLineTo(float dx, float dy)
      Relative version of "line to".

      Adds a line from the last point to the specified vector (dx, dy).

      Parameters:
      dx - the offset from last point to line end on x-axis
      dy - the offset from last point to line end on y-axis
    • relativeQuadTo

      public final void relativeQuadTo(float dx1, float dy1, float dx2, float dy2)
      Relative version of "quad to".

      Adds quad from last point towards vector (dx1, dy1), to vector (dx2, dy2).

      Parameters:
      dx1 - offset from last point to quad control on x-axis
      dy1 - offset from last point to quad control on y-axis
      dx2 - offset from last point to quad end on x-axis
      dy2 - offset from last point to quad end on y-axis
    • relativeCubicTo

      public final void relativeCubicTo(float dx1, float dy1, float dx2, float dy2, float dx3, float dy3)
      Relative version of "cubic to".

      Adds cubic from last point towards vector (dx1, dy1), vector (dx2, dy2), to vector (dx3, dy3).

      Parameters:
      dx1 - offset from last point to first cubic control on x-axis
      dy1 - offset from last point to first cubic control on y-axis
      dx2 - offset from last point to second cubic control on x-axis
      dy2 - offset from last point to second cubic control on y-axis
      dx3 - offset from last point to cubic end on x-axis
      dy3 - offset from last point to cubic end on y-axis
    • getBounds

      public final void getBounds(@NonNull RectF out)