Class PathGenerator

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class PathGenerator
    extends NativeObject
    implements java.lang.AutoCloseable
    • Constructor Summary

      Constructors 
      Constructor Description
      PathGenerator​(Path path)
      Create a new path generator for appending to a path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addArc​(Rectangle rectangle, double alpha1, double alpha2)
      Add an elliptical arc to the current path.
      void addCircle​(Point center, double radius)
      Append a circle to the current path as a complete subpath.
      void addEllipse​(Rectangle rectangle)
      Add an ellipse to the current path as a complete subpath.
      void addPie​(Rectangle rectangle, double alpha1, double alpha2)
      Add an elliptical piece of pie to the current path as a complete subpath.
      void addRectangle​(Rectangle rectangle)
      Append a rectangle to the current path as a complete subpath.
      void bezierTo​(Point controlPoint1, Point controlPoint2, Point target)
      Draw a bezier curve.
      void close()
      Close the object
      void closeSubpath()
      Close the current subpath.
      void lineTo​(Point target)
      Draw a line.
      void moveTo​(Point target)
      Move the current position.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathGenerator

        public PathGenerator​(Path path)

        Create a new path generator for appending to a path.

        Parameters:
        path - the path object
        Throws:
        java.lang.IllegalArgumentException - if path is null
    • Method Detail

      • moveTo

        public void moveTo​(Point target)

        Move the current position.

        Begin a new subpath by moving the current point to the specified coordinates, omitting any connecting line segment. If the previous path construction operator in the current path was also MoveTo, the new MoveTo overrides it; no vestige of the previous MoveTo operation remains in the path.
        Parameters:
        target - the target coordinates
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if target is null
      • lineTo

        public void lineTo​(Point target)

        Draw a line.

        Append a straight line segment from the current point to the target coordinates. The current position is changed to the target position.
        Parameters:
        target - the target coordinates
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if target is null
      • bezierTo

        public void bezierTo​(Point controlPoint1,
                             Point controlPoint2,
                             Point target)

        Draw a bezier curve.

        Append a cubic Bézier curve to the current path. The curve extends from the current point to the target position, using controlPoint1 and controlPoint2 as the Bézier control points.

        The current position is changed to the target position.

        Parameters:
        controlPoint1 - the first bezier control point
        controlPoint2 - the second bezier control point
        target - the target coordinates
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if controlPoint1 is null
        java.lang.IllegalArgumentException - if controlPoint2 is null
        java.lang.IllegalArgumentException - if target is null
      • closeSubpath

        public void closeSubpath()

        Close the current subpath.

        Close the current subpath by appending a straight line segment from the current point to the starting point of the subpath. This operator terminates the current subpath; appending another segment to the current path will begin a new subpath, even if the new segment begins at the endpoint reached by the closeSubpath() operation. If the current subpath has already been closed, CloseSubpath() does nothing.
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
      • addRectangle

        public void addRectangle​(Rectangle rectangle)

        Append a rectangle to the current path as a complete subpath.

        Parameters:
        rectangle - the rectangle to be added to the path
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if rectangle is null
      • addCircle

        public void addCircle​(Point center,
                              double radius)

        Append a circle to the current path as a complete subpath.

        Parameters:
        center - the center of the circle
        radius - the radius of the circle
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if center is null
      • addEllipse

        public void addEllipse​(Rectangle rectangle)

        Add an ellipse to the current path as a complete subpath.

        Parameters:
        rectangle - the surrounding rectangle of the ellipse
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if rectangle is null
      • addArc

        public void addArc​(Rectangle rectangle,
                           double alpha1,
                           double alpha2)

        Add an elliptical arc to the current path.

        Parameters:
        rectangle - the surrounding rectangle of the ellipse
        alpha1 - the angle between the x-axis and the begin of the arc
        alpha2 - the angle between the x-axis and the end of the arc
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if rectangle is null
      • addPie

        public void addPie​(Rectangle rectangle,
                           double alpha1,
                           double alpha2)

        Add an elliptical piece of pie to the current path as a complete subpath.

        Parameters:
        rectangle - the surrounding rectangle of the ellipse
        alpha1 - the angle between the x-axis and the begin of the arc
        alpha2 - the angle between the x-axis and the end of the arc
        Throws:
        java.lang.IllegalStateException - if the object has already been closed
        java.lang.IllegalStateException - if the path object has already been closed
        java.lang.IllegalArgumentException - if rectangle is null
      • close

        public void close()
                   throws ToolboxException,
                          java.io.IOException

        Close the object

        Release all native resources associated with the object.
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        ToolboxException - only explicitly stated in a superclass
        java.io.IOException