Class GeneralPath

  • All Implemented Interfaces:
    Shape, java.lang.Cloneable

    public final class GeneralPath
    extends java.lang.Object
    implements Shape, java.lang.Cloneable
    • Field Detail

      • BUFFER_CAPACITY

        private static final int BUFFER_CAPACITY
        The buffers capacity
        See Also:
        Constant Field Values
      • types

        byte[] types
        The point's types buffer
      • points

        float[] points
        The points buffer
      • typeSize

        int typeSize
        The point's type buffer size
      • pointSize

        int pointSize
        The points buffer size
      • rule

        int rule
        The path rule
      • pointShift

        static int[] pointShift
        The space amount in points buffer for different segmenet's types
    • Constructor Detail

      • GeneralPath

        public GeneralPath()
      • GeneralPath

        public GeneralPath​(int rule)
      • GeneralPath

        public GeneralPath​(int rule,
                           int initialCapacity)
      • GeneralPath

        public GeneralPath​(Shape shape)
    • Method Detail

      • setWindingRule

        public void setWindingRule​(int rule)
      • getWindingRule

        public int getWindingRule()
      • checkBuf

        void checkBuf​(int pointCount,
                      boolean checkMove)
        Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size.
        Parameters:
        pointCount - - the point count to be added in buffer
      • moveTo

        public void moveTo​(float x,
                           float y)
      • lineTo

        public void lineTo​(float x,
                           float y)
      • quadTo

        public void quadTo​(float x1,
                           float y1,
                           float x2,
                           float y2)
      • curveTo

        public void curveTo​(float x1,
                            float y1,
                            float x2,
                            float y2,
                            float x3,
                            float y3)
      • closePath

        public void closePath()
      • append

        public void append​(Shape shape,
                           boolean connect)
      • append

        public void append​(PathIterator path,
                           boolean connect)
      • getCurrentPoint

        public Point2D getCurrentPoint()
      • reset

        public void reset()
      • isInside

        boolean isInside​(int cross)
        Checks cross count according to path rule to define is it point inside shape or not.
        Parameters:
        cross - - the point cross count
        Returns:
        true if point is inside path, or false otherwise
      • contains

        public boolean contains​(double px,
                                double py)
        Specified by:
        contains in interface Shape
      • contains

        public boolean contains​(double rx,
                                double ry,
                                double rw,
                                double rh)
        Specified by:
        contains in interface Shape
      • intersects

        public boolean intersects​(double rx,
                                  double ry,
                                  double rw,
                                  double rh)
        Specified by:
        intersects in interface Shape
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object