java.awt.geom

Class GeneralPath

Implemented Interfaces:
Cloneable, Shape

public final class GeneralPath
extends Object
implements Shape, Cloneable

The GeneralPath class represents a geometric path constructed from straight lines, and quadratic and cubic (Bézier) curves. It can contain multiple subpaths.

The winding rule specifies how the interior of a path is determined. There are two types of winding rules: EVEN_ODD and NON_ZERO.

An EVEN_ODD winding rule means that enclosed regions of the path alternate between interior and exterior areas as traversed from the outside of the path towards a point inside the region.

A NON_ZERO winding rule means that if a ray is drawn in any direction from a given point to infinity and the places where the path intersects the ray are examined, the point is inside of the path if and only if the number of times that the path crosses the ray from left to right does not equal the number of times that the path crosses the ray from right to left.

Field Summary

static int
WIND_EVEN_ODD
An even-odd winding rule for determining the interior of a path.
static int
WIND_NON_ZERO
A non-zero winding rule for determining the interior of a path.

Constructor Summary

GeneralPath()
Constructs a new GeneralPath object.
GeneralPath(int rule)
Constructs a new GeneralPath object with the specified winding rule to control operations that require the interior of the path to be defined.
GeneralPath(int rule, int initialCapacity)
Constructs a new GeneralPath object with the specified winding rule and the specified initial capacity to store path coordinates.
GeneralPath(Shape s)
Constructs a new GeneralPath object from an arbitrary Shape object.

Method Summary

void
append(Shape s, boolean connect)
Appends the geometry of the specified Shape object to the path, possibly connecting the new geometry to the existing path segments with a line segment.
void
append(PathIterator pi, boolean connect)
Appends the geometry of the specified PathIterator object to the path, possibly connecting the new geometry to the existing path segments with a line segment.
Object
clone()
Creates a new object of the same class as this object.
void
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo.
boolean
contains(double x, double y)
Tests if the specified coordinates are inside the boundary of this Shape.
boolean
contains(double x, double y, double w, double h)
Tests if the specified rectangular area is inside the boundary of this Shape.
boolean
contains(Point2D p)
Tests if the specified Point2D is inside the boundary of this Shape.
boolean
contains(Rectangle2D r)
Tests if the specified Rectangle2D is inside the boundary of this Shape.
Shape
createTransformedShape(AffineTransform at)
Returns a new transformed Shape.
void
curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
Adds a curved segment, defined by three new points, to the path by drawing a Bézier curve that intersects both the current coordinates and the coordinates (x3, y3), using the specified points (x1, y1) and (x2, y2) as Bézier control points.
Rectangle
getBounds()
Return the bounding box of the path.
Rectangle2D
getBounds2D()
Returns the bounding box of the path.
Point2D
getCurrentPoint()
Returns the coordinates most recently added to the end of the path as a Point2D object.
PathIterator
getPathIterator(AffineTransform at)
Returns a PathIterator object that iterates along the boundary of this Shape and provides access to the geometry of the outline of this Shape.
PathIterator
getPathIterator(AffineTransform at, double flatness)
Returns a PathIterator object that iterates along the boundary of the flattened Shape and provides access to the geometry of the outline of the Shape.
int
getWindingRule()
Returns the fill style winding rule.
boolean
intersects(double x, double y, double w, double h)
Tests if the interior of this Shape intersects the interior of a specified set of rectangular coordinates.
boolean
intersects(Rectangle2D r)
Tests if the interior of this Shape intersects the interior of a specified Rectangle2D.
void
lineTo(float x, float y)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates.
void
moveTo(float x, float y)
Adds a point to the path by moving to the specified coordinates.
void
quadTo(float x1, float y1, float x2, float y2)
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current coordinates and the coordinates (x2, y2), using the specified point (x1, y1) as a quadratic parametric control point.
void
reset()
Resets the path to empty.
void
setWindingRule(int rule)
Sets the winding rule for this path to the specified value.
void
transform(AffineTransform at)
Transforms the geometry of this path using the specified AffineTransform.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

WIND_EVEN_ODD

public static final int WIND_EVEN_ODD
An even-odd winding rule for determining the interior of a path.
Field Value:
0
Usages and Demos :

View More Examples of GeneralPath.WIND_EVEN_ODD
   1:     
   2:     p.setWindingRule( GeneralPath.WIND_EVEN_ODD );
   3:     
   4:     g2.setColor( Color.RED );

View Full Code Here
   1: 
   2:         p.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   3:         g2.setColor(Color.lightGray);
   4:         g2.fill(p);
   5:         g2.setColor(Color.black);

View Full Code Here
   1:         public int getWindingRule() {
   2:             return GeneralPath.WIND_EVEN_ODD;
   3:         }
   4: 
   5:         public boolean isDone() {

View Full Code Here
   1:             if (clipRule.equals("evenodd")) {
   2:               path.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   3:             } else {
   4:         ...
   5:                   if (clipRule.equals("evenodd")) {
   6:                     path.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   7:                   } else {
   8:                     path.setWindingRule(GeneralPath.WIND_NON_ZERO);
   9:                   }

View Full Code Here
   1:       } else {
   2:         polygon.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   3:       }
   4: 
   5:       stroke = getStroke();

View Full Code Here

WIND_NON_ZERO

public static final int WIND_NON_ZERO
A non-zero winding rule for determining the interior of a path.
Field Value:
1
Usages and Demos :

View More Examples of GeneralPath.WIND_NON_ZERO
   1: 
   2:     p.setWindingRule( GeneralPath.WIND_NON_ZERO );
   3:     
   4:     g2.setColor( Color.BLUE );
   5:     

View Full Code Here
   1:             } else {
   2:               path.setWindingRule(GeneralPath.WIND_NON_ZERO);
   3:             }
   4:         ...
   5:                   } else {
   6:                     path.setWindingRule(GeneralPath.WIND_NON_ZERO);
   7:                   }
   8: 
   9:                   Area childClipArea = new Area(path);

View Full Code Here
   1:       if (fillRule.equalsIgnoreCase("nonzero")) {
   2:         polygon.setWindingRule(GeneralPath.WIND_NON_ZERO);
   3:       } else {
   4:         polygon.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   5:       }

View Full Code Here
   1:       if (fillRule.equalsIgnoreCase("nonzero")) {
   2:         polyline.setWindingRule(GeneralPath.WIND_NON_ZERO);
   3:       } else {
   4:         polyline.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   5:       }

View Full Code Here
   1:         this.graphics.fill(this.state.path);
   2:         this.state.path.setWindingRule(GeneralPath.WIND_NON_ZERO);
   3:         this.newpath();
   4:     }

View Full Code Here

Constructor Details

GeneralPath

public GeneralPath()
Constructs a new GeneralPath object. If an operation performed on this path requires the interior of the path to be defined then the default NON_ZERO winding rule is used.
See Also:
WIND_NON_ZERO
Usages and Demos :

View More Examples of GeneralPath()
   1: public class generalPath extends JFrame {
   2:  public generalPath(){
   3:    super( "Drawing 2D Shapes" );
   4:         ...
   5:    Graphics2D g2d = ( Graphics2D ) g;
   6:    GeneralPath star = new GeneralPath();
   7:    star.moveTo( xPoints[ 0 ], yPoints[ 0 ] );
   8:         ...
   9:  public static void main( String args[] ){
  10:    generalPath application = new generalPath();
  11:    application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );

View Full Code Here
   1:     public void paintFlower(Graphics2D g) {
   2:         GeneralPath path = new GeneralPath();
   3:         path.moveTo(-POT_TOP_WIDTH/2, 0);
   4:         path.lineTo(-POT_BASE_WIDTH/2, POT_HEIGHT);
   5:         path.lineTo(POT_BASE_WIDTH/2, POT_HEIGHT);

View Full Code Here
   1:         Polygon p = isTransformed? transformed(): polygon;
   2:         GeneralPath gp = new GeneralPath();
   3:         gp.moveTo((float)(p.xpoints[0]), (float)(p.ypoints[0]));
   4:         for (int i = 1; i < p.npoints; i++) {
   5:         gp.lineTo((float)(p.xpoints[i]), (float)(p.ypoints[i]));

View Full Code Here
   1:         Polygon p = isTransformed? transformed(): polygon;
   2:         GeneralPath gp = new GeneralPath();
   3:         gp.moveTo((float)(p.xpoints[0]), (float)(p.ypoints[0]));
   4:         for (int i = 1; i < p.npoints; i++) {
   5:         gp.lineTo((float)(p.xpoints[i]), (float)(p.ypoints[i]));

View Full Code Here
   1:     public void setUp() {
   2:         GeneralPath p = new GeneralPath();
   3:         p.append(new Ellipse2D.Double(0, 0, 10, 10), true);
   4:         p.append(new Rectangle2D.Double(10, 4, 2, 2), true);
   5:         path = new ZPath(p);

View Full Code Here

GeneralPath

public GeneralPath(int rule)
Constructs a new GeneralPath object with the specified winding rule to control operations that require the interior of the path to be defined.
Parameters:
rule - the winding rule
Usages and Demos :

View More Examples of GeneralPath(int rule)
   1:     Point2D.Float point = start;
   2:     p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   3:     p.moveTo(point.x, point.y);
   4:     point = (Point2D.Float)p.getCurrentPoint();
   5:     point = (Point2D.Float)p.getCurrentPoint();

View Full Code Here
   1: static PointList strokeList(PointList list, int offset) {
   2:     GeneralPath path = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   3: 
   4:     Point p = list.getPoint(0);
   5:     path.moveTo(p.x, p.y);

View Full Code Here
   1:     if (path == null) {
   2:         path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
   3:     }
   4:     path.reset();
   5:     path.moveTo(startPoint.x, startPoint.y);

View Full Code Here
   1:     public void render(int w, int h, Graphics2D g2) {
   2:         GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
   3:         p.moveTo(w*.2f, h*.25f);
   4:         p.curveTo(w*.4f, h*.5f, w*.6f, 0.0f, w*.8f, h*.25f);
   5:         p.moveTo(w*.2f, h*.6f);

View Full Code Here
   1:     public void render(int w, int h, Graphics2D g2) {
   2:         GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
   3:         p.moveTo( w*.5f, h*.15f);
   4:         p.lineTo( w*.8f, h*.75f);
   5:         p.lineTo( w*.2f, h*.75f);

View Full Code Here

GeneralPath

public GeneralPath(int rule,
                   int initialCapacity)
Constructs a new GeneralPath object with the specified winding rule and the specified initial capacity to store path coordinates. This number is an initial guess as to how many path segments are in the path, but the storage is expanded as needed to store whatever path segments are added to this path.
Parameters:
rule - the winding rule
initialCapacity - the estimate for the number of path segments in the path
Usages and Demos :

View More Examples of GeneralPath(int rule,int initialCapacity)
   1:     GeneralPath triangle = 
   2:       new GeneralPath(GeneralPath.WIND_EVEN_ODD,3);
   3:     triangle.moveTo(startX,topY);
   4:     triangle.lineTo(endX,topY);
   5:     triangle.lineTo(tailEnd.x,tailEnd.y);

View Full Code Here
   1:             
   2:             GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3);
   3:             polygon.moveTo(x0, y0);
   4:             polygon.lineTo(x1, y1);
   5:             polygon.lineTo(x2, y2);

View Full Code Here
   1:     g2.setStroke(new BasicStroke(2.0f));
   2:     GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD, numberPeriods);
   3: 
   4:     nl = root.getElementsByTagName("Close");
   5:     for (int i = 0; i < nl.getLength(); i++) {

View Full Code Here
   1:     space = s ; 
   2:     arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 1);
   3:     
   4:         ...
   5:     
   6:     arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 5);
   7:     
   8:     arrow.moveTo(xPoints[0], yPoints[0]);
   9:     for ( int index = 1; index < xPoints.length ; index++ ) {

View Full Code Here
   1:             int childX = graphX + (int)(childSize.getWidth() / 2);
   2:             GeneralPath link = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 4);
   3:             link.moveTo(x + BOXW / 2, y + BOXH);
   4:             link.lineTo(x + BOXW / 2, y + BOXH + GAPV / 6);
   5:             link.lineTo(childX, y + BOXH + GAPV / 6);

View Full Code Here

GeneralPath

public GeneralPath(Shape s)
Constructs a new GeneralPath object from an arbitrary Shape object. All of the initial geometry and the winding rule for this path are taken from the specified Shape object.
Parameters:
s - the specified Shape object
Usages and Demos :

View More Examples of GeneralPath(Shape s)
   1:     Point2D.Float point = start;
   2:     p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   3:     p.moveTo(point.x, point.y);
   4:     point = (Point2D.Float)p.getCurrentPoint();
   5:     point = (Point2D.Float)p.getCurrentPoint();

View Full Code Here
   1: static PointList strokeList(PointList list, int offset) {
   2:     GeneralPath path = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   3: 
   4:     Point p = list.getPoint(0);
   5:     path.moveTo(p.x, p.y);

View Full Code Here
   1:     if (path == null) {
   2:         path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
   3:     }
   4:     path.reset();
   5:     path.moveTo(startPoint.x, startPoint.y);

View Full Code Here
   1:     public void render(int w, int h, Graphics2D g2) {
   2:         GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
   3:         p.moveTo(w*.2f, h*.25f);
   4:         p.curveTo(w*.4f, h*.5f, w*.6f, 0.0f, w*.8f, h*.25f);
   5:         p.moveTo(w*.2f, h*.6f);

View Full Code Here
   1:     public void render(int w, int h, Graphics2D g2) {
   2:         GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
   3:         p.moveTo( w*.5f, h*.15f);
   4:         p.lineTo( w*.8f, h*.75f);
   5:         p.lineTo( w*.2f, h*.75f);

View Full Code Here

Method Details

append

public void append(Shape s,
                   boolean connect)
Appends the geometry of the specified Shape object to the path, possibly connecting the new geometry to the existing path segments with a line segment. If the connect parameter is true and the path is not empty then any initial moveTo in the geometry of the appended Shape is turned into a lineTo segment. If the destination coordinates of such a connecting lineTo segment match the ending coordinates of a currently open subpath then the segment is omitted as superfluous. The winding rule of the specified Shape is ignored and the appended geometry is governed by the winding rule specified for this path.
Parameters:
s - the Shape whose geometry is appended to this path
connect - a boolean to control whether or not to turn an initial moveTo segment into a lineTo segment to connect the new geometry to the existing path
Usages and Demos :

View More Examples of append(Shape s,boolean connect)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     GeneralPath newPath = new GeneralPath();
   7:     PathLength pl = new PathLength(path);
   8:         ...
   9:         glyph = glyphTrans.createTransformedShape(glyph);
  10:         newPath.append(glyph, false);

View Full Code Here
   1: 
   2:       GeneralPath sedanPath = new GeneralPath();
   3:         ...
   4:       sedanPath.append(frontTire, false);
   5:         ...
   6:       sedanPath.append(rearTire, false);
   7:         ...
   8:       sedanPath.append(body, false);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:             }
   6:             GeneralPath glyphOutline = null;
   7:             if (dShape != null && glyphChildrenOutline != null) {
   8:         ...
   9:                 glyphOutline = new GeneralPath(dShape);
  10:         ...
  11:                 glyphOutline.append(glyphChildrenOutline, false);

View Full Code Here
   1:   Shape getCompositeShape() {
   2:     GeneralPath path = new GeneralPath();
   3:     if (hasChildNodes()) {
   4:         ...
   5:         if (childShape != null) {
   6:           path.append(childShape, false);
   7:         }
   8:       }
   9:     }

View Full Code Here
   1:   Shape getCompositeShape() {
   2:     GeneralPath path = new GeneralPath();
   3:     if (hasChildNodes()) {
   4:         ...
   5:         if (childShape != null) {
   6:           path.append(childShape, false);
   7:         }
   8:       }
   9:     }

View Full Code Here

append

public void append(PathIterator pi,
                   boolean connect)
Appends the geometry of the specified PathIterator object to the path, possibly connecting the new geometry to the existing path segments with a line segment. If the connect parameter is true and the path is not empty then any initial moveTo in the geometry of the appended Shape is turned into a lineTo segment. If the destination coordinates of such a connecting lineTo segment match the ending coordinates of a currently open subpath then the segment is omitted as superfluous. The winding rule of the specified Shape is ignored and the appended geometry is governed by the winding rule specified for this path.
Parameters:
pi - the PathIterator whose geometry is appended to this path
connect - a boolean to control whether or not to turn an initial moveTo segment into a lineTo segment to connect the new geometry to the existing path
Usages and Demos :

View More Examples of append(PathIterator pi,boolean connect)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     GeneralPath newPath = new GeneralPath();
   7:     PathLength pl = new PathLength(path);
   8:         ...
   9:         glyph = glyphTrans.createTransformedShape(glyph);
  10:         newPath.append(glyph, false);

View Full Code Here
   1: 
   2:       GeneralPath sedanPath = new GeneralPath();
   3:         ...
   4:       sedanPath.append(frontTire, false);
   5:         ...
   6:       sedanPath.append(rearTire, false);
   7:         ...
   8:       sedanPath.append(body, false);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:             }
   6:             GeneralPath glyphOutline = null;
   7:             if (dShape != null && glyphChildrenOutline != null) {
   8:         ...
   9:                 glyphOutline = new GeneralPath(dShape);
  10:         ...
  11:                 glyphOutline.append(glyphChildrenOutline, false);

View Full Code Here
   1:   Shape getCompositeShape() {
   2:     GeneralPath path = new GeneralPath();
   3:     if (hasChildNodes()) {
   4:         ...
   5:         if (childShape != null) {
   6:           path.append(childShape, false);
   7:         }
   8:       }
   9:     }

View Full Code Here
   1:   Shape getCompositeShape() {
   2:     GeneralPath path = new GeneralPath();
   3:     if (hasChildNodes()) {
   4:         ...
   5:         if (childShape != null) {
   6:           path.append(childShape, false);
   7:         }
   8:       }
   9:     }

View Full Code Here

clone

public Object clone()
Creates a new object of the same class as this object.
Overrides:
clone in interface Object
Returns:
a clone of this instance.
Since:
1.2
See Also:
Cloneable
Usages and Demos :

View More Examples of clone()
   1: import java.awt.Shape;
   2: import java.awt.geom.GeneralPath;
   3: import org.opensourcephysics.numerics.Function;
   4:         ...
   5:   private int numpts = 0;
   6:   private GeneralPath generalPath = new GeneralPath();
   7:   private Function function;
   8:         ...
   9:   public GeneralPath getPath() {
  10:     return (GeneralPath) (generalPath.clone());
  11:   }

View Full Code Here
   1: import java.awt.geom.Area;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Line2D;
   4:         ...
   5:             Line2D line = (Line2D) shape;
   6:             result = (Shape) line.clone();    
   7:         }
   8:         ...
   9:             RectangularShape rectangle = (RectangularShape) shape;
  10:             result = (Shape) rectangle.clone();
  11:         }
  12:         ...
  13:             Area area = (Area) shape;
  14:             result = (Shape) area.clone();

View Full Code Here
   1: import java.awt.Shape;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5:         
   6:         GeneralPath left = new GeneralPath();
   7:         GeneralPath right = new GeneralPath();
   8:         ...
   9:                 left.lineTo(transXLeft, transStackLeft);
  10:                 left.clone();
  11:             }
  12:         ...
  13:     public Object clone() throws CloneNotSupportedException {
  14:         return super.clone();

View Full Code Here
   1: 
   2:     private transient GeneralPath firstArrowHead = null;
   3:         ...
   4:     private transient GeneralPath lastArrowHead = null;
   5:     private transient Point2D     firstArrowHeadPoint = null;
   6:         ...
   7:         if (firstArrowHead != null) {
   8:             newPoly.firstArrowHead = (GeneralPath)firstArrowHead.clone();
   9:         }
  10:         ...
  11:         if (lastArrowHead != null) {
  12:             newPoly.lastArrowHead = (GeneralPath)lastArrowHead.clone();

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5:     
   6:     protected transient GeneralPath sharedPath;
   7:     
   8:         ...
   9:         fontGraphics = (new BufferedImage(1, 1, 1)).getGraphics();
  10:         sharedPath = new GeneralPath(1);
  11:         defaultForeground = UIManager.getColor("Tree.textForeground");
  12:         ...
  13:                 }
  14:                 lineShape = (GeneralPath)sharedPath.clone();

View Full Code Here

closePath

public void closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo. If the path is already closed then this method has no effect.
Usages and Demos :

View More Examples of closePath()
   1: import javax.swing.*;
   2: public class generalPath extends JFrame {
   3:         ...
   4:  public generalPath (){
   5:    super( "Drawing 2D Shapes" );
   6:         ...
   7:    Graphics2D g2d = ( Graphics2D ) g;
   8:    GeneralPath star = new GeneralPath();
   9:    star.moveTo( xPoints[ 0 ], yPoints[ 0 ] );
  10:         ...
  11:      star.lineTo( xPoints[ count ], yPoints[ count ] );
  12:    star.closePath();

View Full Code Here
   1: import java.awt.geom.Arc2D;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:         
   6:         GeneralPath path = new GeneralPath();
   7:         path.moveTo(0, 0);
   8:         ...
   9:         path.append(new Arc2D.Float(0, 0, 300, 300, 90, -90, Arc2D.OPEN), true);
  10:         path.closePath();

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.Shape;
   4:         ...
   5:     Point2D.Float point = start;
   6:     p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:     p.moveTo(point.x, point.y);
   8:     point = (Point2D.Float)p.getCurrentPoint();
   9:     point = (Point2D.Float)p.getCurrentPoint();

View Full Code Here
   1:     float centerX = size.width/2;
   2:     GeneralPath triangle = new GeneralPath();
   3:     triangle.moveTo(insets.left, size.height - insets.bottom);
   4:         ...
   5:     triangle.lineTo(size.width - insets.right, size.height - insets.bottom);
   6:     triangle.closePath();        
   7: 
   8:     g2.setPaint(attributes.getColor());
   9:     g2.fill(triangle);

View Full Code Here
   1:     this.setLayout(borderLayout1);
   2:     gPath1 = new GeneralPath();
   3:       gPath1.moveTo(0,-50);
   4:         ...
   5:       gPath1.lineTo(-50,50);
   6:       gPath1.closePath();
   7:       AffineTransform1 = new AffineTransform();
   8:       setRotate(45.0f);
   9:   }

View Full Code Here

contains

public boolean contains(double x,
                        double y)
Tests if the specified coordinates are inside the boundary of this Shape.
Specified by:
contains in interface Shape
Parameters:
Returns:
true if the specified coordinates are inside this Shape; false otherwise
Usages and Demos :

View More Examples of contains(double x,double y)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.contains(x,y);
  11:     }

View Full Code Here
   1:       return false;
   2:     GeneralPath pg= new GeneralPath();
   3:     GrPoint[] pts;
   4:         ...
   5:     pg.closePath();
   6:     return pg.contains(_pt.x, _pt.y);
   7:   }
   8:         ...
   9:   public GrPoint getPointInterne() {
  10:     GeneralPath pg= new GeneralPath();
  11:     GrPoint[] pts;
  12:         ...
  13:     yInt= box.getCenterY();
  14:     if (pg.contains(xInt, yInt))

View Full Code Here

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Tests if the specified rectangular area is inside the boundary of this Shape.
Specified by:
contains in interface Shape
Parameters:
w - the width of the specified rectangular area
h - the height of the specified rectangular area
Returns:
true if this Shape contains the specified rectangluar area; false otherwise.
Usages and Demos :

View More Examples of contains(double x,double y,double w,double h)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.contains(x,y,w,h);
  11:     }

View Full Code Here

contains

public boolean contains(Point2D p)
Tests if the specified Point2D is inside the boundary of this Shape.
Specified by:
contains in interface Shape
Parameters:
p - the specified Point2D
Returns:
true if this Shape contains the specified Point2D, false otherwise.
Usages and Demos :

View More Examples of contains(Point2D p)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.contains(r);
  11:     }
  12:         ...
  13:     {
  14:         return m_arrow.contains(p);

View Full Code Here
   1:         if (connectedShape != null) {
   2:             if (!aggregation.getChildConnection().contains(conn)) {
   3:                 aggregation.getChildConnection().add(conn);
   4:         ...
   5:     public class TrianglePanel extends JPanel {
   6:         private GeneralPath             triangle;
   7:         ...
   8:         private GeneralPath             typeShape;
   9:         private float                   triangleWidth = TRIANGLE_WIDTH;
  10:         ...
  11:         private void initTriangle() {
  12:           triangle = new GeneralPath();

View Full Code Here

contains

public boolean contains(Rectangle2D r)
Tests if the specified Rectangle2D is inside the boundary of this Shape.
Specified by:
contains in interface Shape
Parameters:
r - a specified Rectangle2D
Returns:
true if this Shape bounds the specified Rectangle2D; false otherwise.
Usages and Demos :

View More Examples of contains(Rectangle2D r)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.contains(r);
  11:     }
  12:         ...
  13:     {
  14:         return m_arrow.contains(p);

View Full Code Here
   1:         if (connectedShape != null) {
   2:             if (!aggregation.getChildConnection().contains(conn)) {
   3:                 aggregation.getChildConnection().add(conn);
   4:         ...
   5:     public class TrianglePanel extends JPanel {
   6:         private GeneralPath             triangle;
   7:         ...
   8:         private GeneralPath             typeShape;
   9:         private float                   triangleWidth = TRIANGLE_WIDTH;
  10:         ...
  11:         private void initTriangle() {
  12:           triangle = new GeneralPath();

View Full Code Here

createTransformedShape

public Shape createTransformedShape(AffineTransform at)
Returns a new transformed Shape.
Parameters:
at - the AffineTransform used to transform a new Shape.
Returns:
a new Shape, transformed with the specified AffineTransform.

curveTo

public void curveTo(float x1,
                    float y1,
                    float x2,
                    float y2,
                    float x3,
                    float y3)
Adds a curved segment, defined by three new points, to the path by drawing a Bézier curve that intersects both the current coordinates and the coordinates (x3, y3), using the specified points (x1, y1) and (x2, y2) as Bézier control points.
Parameters:
Usages and Demos :

View More Examples of curveTo(float x1,float y1,float x2,float y2,float x3,float y3)
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Line2D;
   4:         ...
   5:         
   6:         GeneralPath g1 = new GeneralPath();
   7:         g1.moveTo(1.0f, 2.0f);
   8:         ...
   9:         g1.lineTo(3.0f, 4.0f);
  10:         g1.curveTo(5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);
  11:         g1.quadTo(1.0f, 2.0f, 3.0f, 4.0f);
  12:         ...
  13:         g2.lineTo(3.0f, 4.0f);
  14:         g2.curveTo(5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);

View Full Code Here
   1: import java.awt.geom.Arc2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Line2D;
   4:         ...
   5:     public void testGeneralPathSerialization() {
   6:         GeneralPath g1 = new GeneralPath();
   7:         g1.moveTo(1.0f, 2.0f);
   8:         ...
   9:         g1.lineTo(3.0f, 4.0f);
  10:         g1.curveTo(5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);
  11:         g1.quadTo(1.0f, 2.0f, 3.0f, 4.0f);

View Full Code Here
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:         } else {
   6:             return new GeneralPath(s);
   7:         }
   8:         ...
   9:         } else {
  10:             GeneralPath cloud = new GeneralPath();
  11:             cloud.moveTo(25.53f, 25.00f);
  12:         ...
  13:             cloud.curveTo(25.18f, 23.42f, 25.0f, 21.75f, 25.0f, 20.0f);

View Full Code Here

getBounds

public Rectangle getBounds()
Return the bounding box of the path.
Specified by:
getBounds in interface Shape
Returns:
a Rectangle object that bounds the current path.
Usages and Demos :

View More Examples of getBounds()
   1:         Polygon p = isTransformed? transformed(): polygon;
   2:         GeneralPath gp = new GeneralPath();
   3:         gp.moveTo((float)(p.xpoints[0]), (float)(p.ypoints[0]));
   4:         ...
   5:         if (validBounds) {
   6:         setBounds(gp.getBounds());
   7:         }
   8:     }
   9:     }

View Full Code Here
   1:         Polygon p = isTransformed? transformed(): polygon;
   2:         GeneralPath gp = new GeneralPath();
   3:         gp.moveTo((float)(p.xpoints[0]), (float)(p.ypoints[0]));
   4:         ...
   5:         if (validBounds) {
   6:         setBounds(gp.getBounds());
   7:         }
   8:     }
   9:     }

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.getBounds();
  11:     }

View Full Code Here
   1: import java.awt.Stroke;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:     protected Color color;
   6:     protected GeneralPath path;
   7:     protected Stroke stroke;
   8:         ...
   9:     public Rectangle getBounds() {
  10:     return path.getBounds();
  11:     }

View Full Code Here

getBounds2D

public Rectangle2D getBounds2D()
Returns the bounding box of the path.
Specified by:
getBounds2D in interface Shape
Returns:
a Rectangle2D object that bounds the current path.
Usages and Demos :

View More Examples of getBounds2D()
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.getBounds2D();
  11:     }

View Full Code Here
   1:       return false;
   2:     GeneralPath pg= new GeneralPath();
   3:     GrPoint[] pts;
   4:         ...
   5:   public GrPoint getPointInterne() {
   6:     GeneralPath pg= new GeneralPath();
   7:     GrPoint[] pts;
   8:         ...
   9:     pg.closePath();
  10:     box= pg.getBounds2D();
  11:     xInt= box.getCenterX();

View Full Code Here
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:     
   6:     private transient GeneralPath path;
   7:         ...
   8:     private transient GeneralPath resizePath;
   9:     private transient Stroke stroke;
  10:         ...
  11: 
  12:         Rectangle2D pathBounds = path.getBounds2D();

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Line2D;
   4:         ...
   5:             g.setColor(track.getColor());
   6:             GeneralPath path = track.getPath();
   7: 
   8:         ...
   9:         protected String name;
  10:         protected GeneralPath path = new GeneralPath();
  11:         protected boolean started = false;
  12:         ...
  13:             if (rect == null)
  14:                 rect = path.getBounds2D();

View Full Code Here
   1: 
   2:     private transient GeneralPath firstArrowHead = null;
   3:         ...
   4:     private transient GeneralPath lastArrowHead = null;
   5:     private transient Point2D     firstArrowHeadPoint = null;
   6:         ...
   7:         if (firstArrowHead != null) {
   8:             newPoly.firstArrowHead = (GeneralPath)firstArrowHead.clone();
   9:         }
  10:         ...
  11:             if (arrowHeadType == ARROW_CLOSED) {
  12:                 bounds.add(firstArrowHead.getBounds2D());

View Full Code Here

getCurrentPoint

public Point2D getCurrentPoint()
Returns the coordinates most recently added to the end of the path as a Point2D object.
Returns:
a Point2D object containing the ending coordinates of the path or null if there are no points in the path.
Usages and Demos :

View More Examples of getCurrentPoint()
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.Shape;
   4:         ...
   5:     Point2D.Float point = start;
   6:     p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:     p.moveTo(point.x, point.y);
   8:         ...
   9:     point = (Point2D.Float)p.getCurrentPoint();
  10:         ...
  11:     point = (Point2D.Float)p.getCurrentPoint();

View Full Code Here
   1: import java.awt.Shape;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:         {
   6:             GeneralPath path = DefaultVerticalPainter.generateConnection(globalSourceOutLocation,
   7:                                                                          globalTargetInLocation,
   8:         ...
   9: 
  10:     public static GeneralPath generateConnection (Point sourceOutLocation,
  11:                                                   Point targetInLocation,
  12:         ...
  13:     {
  14:         Point2D endPoint = path.getCurrentPoint();

View Full Code Here
   1:     Point2D.Float lastMoveTo = new Point2D.Float(0,0);
   2:     GeneralPath path = new GeneralPath();
   3: 
   4:         ...
   5:     if(fillRule == GNode.NONZERO) {        
   6:         path.setWindingRule(GeneralPath.WIND_NON_ZERO);
   7:     } else if(fillRule == GNode.EVENODD) {
   8:         ...
   9:             
  10:             Point2D upLeft = path.getCurrentPoint();
  11:             Point2D upRight = new Point2D.Double(current.getX()+rx, current.getY());

View Full Code Here

getPathIterator

public PathIterator getPathIterator(AffineTransform at)
Returns a PathIterator object that iterates along the boundary of this Shape and provides access to the geometry of the outline of this Shape. The iterator for this class is not multi-threaded safe, which means that this GeneralPath class does not guarantee that modifications to the geometry of this GeneralPath object do not affect any iterations of that geometry that are already in process.
Specified by:
getPathIterator in interface Shape
Parameters:
at - an AffineTransform
Returns:
a new PathIterator that iterates along the boundary of this Shape and provides access to the geometry of this Shape's outline
Usages and Demos :

View More Examples of getPathIterator(AffineTransform at)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.getPathIterator(at);
  11:     }

View Full Code Here
   1: import java.awt.Stroke;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5: 
   6:     public static GeneralPath readPath(ObjectInputStream in) throws IOException, ClassNotFoundException {
   7:         ...
   8:         GeneralPath path = new GeneralPath();
   9:     
  10:         ...
  11:     public static void writePath(GeneralPath path, ObjectOutputStream out) throws IOException {        
  12:         PathIterator i = path.getPathIterator(null);

View Full Code Here
   1: import java.awt.event.WindowEvent;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5: 
   6:         PathIterator i = shape.getPathIterator(null);
   7: 
   8:         ...
   9:         }
  10:         final GeneralPath shape = new GeneralPath();

View Full Code Here
   1: 
   2:     transient protected GeneralPath path;
   3: 
   4:         ...
   5: 
   6:     public ZPath(GeneralPath path) {
   7:         setPath(path);
   8:         ...
   9: 
  10:     public void setPath(GeneralPath aPath) {
  11:         path = aPath;
  12:         ...
  13:         AffineTransform at = new AffineTransform();
  14:         PathIterator i = path.getPathIterator(at);

View Full Code Here
   1: import java.awt.event.*;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:             float midy = (cury + prevy) / 2.0f;
   6:             GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:             gp.moveTo(midx, midy);
   8:         ...
   9: 
  10:             PathIterator pi = gp.getPathIterator(null);
  11:             float pts[] = new float[6];

View Full Code Here

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Returns a PathIterator object that iterates along the boundary of the flattened Shape and provides access to the geometry of the outline of the Shape. The iterator for this class is not multi-threaded safe, which means that this GeneralPath class does not guarantee that modifications to the geometry of this GeneralPath object do not affect any iterations of that geometry that are already in process.
Specified by:
getPathIterator in interface Shape
Parameters:
at - an AffineTransform
flatness - the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve
Returns:
a new PathIterator that iterates along the flattened Shape boundary.
Usages and Demos :

View More Examples of getPathIterator(AffineTransform at,double flatness)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.getPathIterator(at, flatness);
  11:     }

View Full Code Here
   1: package org.opensourcephysics.display;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:   public void saveObject(XMLControl control, Object obj) {
   6:     GeneralPath shape = (GeneralPath) obj;
   7:         ...
   8:     PathIterator it = shape.getPathIterator(null, 0.001);
   9:     control.setValue("winding rule", it.getWindingRule());

View Full Code Here
   1: 
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5: 
   6:     public void setPositions(GeneralPath path) {
   7:         ...
   8:         PathIterator pi = path.getPathIterator(null, 1);
   9:         ArrayList points = new ArrayList();

View Full Code Here

getWindingRule

public int getWindingRule()
Returns the fill style winding rule.
Returns:
an integer representing the current winding rule.

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Tests if the interior of this Shape intersects the interior of a specified set of rectangular coordinates.
Specified by:
intersects in interface Shape
Parameters:
w - the width of the specified rectangular coordinates
h - the height of the specified rectangular coordinates
Returns:
true if this Shape and the interior of the specified set of rectangular coordinates intersect each other; false otherwise.
Usages and Demos :

View More Examples of intersects(double x,double y,double w,double h)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.intersects(x,y,w,h);
  11:     }

View Full Code Here

intersects

public boolean intersects(Rectangle2D r)
Tests if the interior of this Shape intersects the interior of a specified Rectangle2D.
Specified by:
intersects in interface Shape
Parameters:
r - the specified Rectangle2D
Returns:
true if this Shape and the interior of the specified Rectangle2D intersect each other; false otherwise.
Usages and Demos :

View More Examples of intersects(Rectangle2D r)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         return m_arrow.intersects(r);
  11:     }

View Full Code Here

lineTo

public void lineTo(float x,
                   float y)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates.
Parameters:
Usages and Demos :

View More Examples of lineTo(float x,float y)
   1: import java.awt.image.DataBuffer;
   2: import java.awt.geom.GeneralPath;
   3: import java.io.*;
   4:         ...
   5:         big.setColor(Color.green.darker());
   6:         GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:         p.moveTo(- w / 2.0f, - hh / 8.0f);
   8:         ...
   9:         p.lineTo(+ w / 2.0f, - hh / 8.0f);
  10:         ...
  11:         p.lineTo(- w / 4.0f, + hh / 2.0f);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import javax.swing.*;
   4:         ...
   5:                                     BasicStroke.CAP_BUTT, joinType);
   6:         GeneralPath p = new GeneralPath();
   7:         p.moveTo(- w / 4.0f, - h / 12.0f);
   8:         ...
   9:         p.lineTo(+ w / 4.0f, - h / 12.0f);
  10:         ...
  11:         p.lineTo(- w / 6.0f, + h / 4.0f);

View Full Code Here
   1:     private double ih = SINC[1];
   2:     private GeneralPath p = new GeneralPath();
   3:     private AffineTransform at = new AffineTransform();
   4:         ...
   5:         p.moveTo(- w / 2.0f, - h / 8.0f);
   6:         p.lineTo(+ w / 2.0f, - h / 8.0f);
   7:         ...
   8:         p.lineTo(- w / 4.0f, + h / 2.0f);
   9:         ...
  10:         p.lineTo(+         0.0f, - h / 2.0f);

View Full Code Here
   1:                 switch (i % 7) {
   2:                     case 0 : obj = new GeneralPath(); break;
   3:                     case 1 : obj = new Rectangle2D.Double(); break;
   4:         ...
   5:                     ((CubicCurve2D) object).setCurve(0,0,30,-60,60,60,90,0);
   6:             } else if (object instanceof GeneralPath) {
   7:         ...
   8:                 GeneralPath p = new GeneralPath();
   9:                 float size = (float) ww;
  10:         ...
  11:                 p.moveTo(- size / 2.0f, - size / 8.0f);
  12:                 p.lineTo(+ size / 2.0f, - size / 8.0f);

View Full Code Here
   1:                 switch (i % 7) {
   2:                     case 0 : obj = new GeneralPath(); break;
   3:                     case 1 : obj = new Rectangle2D.Double(); break;
   4:         ...
   5:                     ((CubicCurve2D) object).setCurve(0,0,30,-60,60,60,90,0);
   6:             } else if (object instanceof GeneralPath) {
   7:         ...
   8:                 GeneralPath p = new GeneralPath();
   9:                 float size = (float) ww;
  10:         ...
  11:                 p.moveTo(- size / 2.0f, - size / 8.0f);
  12:                 p.lineTo(+ size / 2.0f, - size / 8.0f);

View Full Code Here

moveTo

public void moveTo(float x,
                   float y)
Adds a point to the path by moving to the specified coordinates.
Parameters:
Usages and Demos :

View More Examples of moveTo(float x,float y)
   1: import java.awt.geom.Arc2D;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:     public void paintFlower(Graphics2D g) {
   6:         GeneralPath path = new GeneralPath();
   7:         ...
   8:         path.moveTo(-POT_TOP_WIDTH/2, 0);
   9:         path.lineTo(-POT_BASE_WIDTH/2, POT_HEIGHT);

View Full Code Here
   1: import java.awt.geom.Arc2D;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:         
   6:         GeneralPath path = new GeneralPath();
   7:         ...
   8:         path.moveTo(0, 0);
   9:         path.lineTo(300, 300);

View Full Code Here
   1:     this.setLayout(borderLayout1);
   2:     gPath1 = new GeneralPath();
   3:         ...
   4:       gPath1.moveTo(0,-50);
   5:       gPath1.lineTo(50,50);
   6:       gPath1.lineTo(-50,50);
   7:       gPath1.closePath();

View Full Code Here
   1: import java.awt.Shape;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:     {
   6:         private GeneralPath filledArrow = null;
   7: 
   8:         ...
   9:         {
  10:             filledArrow = new GeneralPath();
  11:         ...
  12:             filledArrow.moveTo(0,0);

View Full Code Here
   1: 
   2:         GeneralPath crossHair = new GeneralPath();
   3:         ...
   4:         crossHair.moveTo(-5, 0);
   5:         crossHair.lineTo(5, 0);
   6:         ...
   7:         crossHair.moveTo(0, -5);
   8:         crossHair.lineTo(0, 5);

View Full Code Here

quadTo

public void quadTo(float x1,
                   float y1,
                   float x2,
                   float y2)
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current coordinates and the coordinates (x2, y2), using the specified point (x1, y1) as a quadratic parametric control point.
Parameters:
Usages and Demos :

View More Examples of quadTo(float x1,float y1,float x2,float y2)
   1: 
   2:         g.drawString("GeneralPath", 10, 20);
   3:         ...
   4:         GeneralPath path = new GeneralPath();
   5:         path.moveTo(30, 30);
   6:         ...
   7:         path.quadTo(30, 50, 50, 60);
   8:         ...
   9:         path.quadTo(30, 50, 10, 60);

View Full Code Here
   1:         Graphics2D g2 = (Graphics2D) g;
   2:         GeneralPath gp = gp();
   3: 
   4:         ...
   5:     
   6:     private GeneralPath gp() {
   7:         Point p0 = getPosition();
   8:         ...
   9:         Point p2 = getTarget().getBorderpoint(p0);
  10:         GeneralPath gp = new GeneralPath();
  11:         gp.moveTo(p1.x,p1.y);
  12:         ...
  13:         gp.quadTo(p0.x,p0.y,p2.x,p2.y);

View Full Code Here
   1: import java.awt.Shape;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5: 
   6:         GeneralPath path = new GeneralPath();
   7:         path.moveTo(120,240);
   8:         ...
   9:         path.lineTo(240,240);
  10:         path.quadTo(180,120,120,240);
  11:         path.closePath();

View Full Code Here
   1:         
   2:         GeneralPath s = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   3:         s.moveTo(10,10);
   4:         ...
   5:         s.quadTo(100,0,100,90);
   6:         ...
   7:         s.quadTo(40,120,20,80);
   8:         ...
   9:         s.quadTo(20,20,10,10);

View Full Code Here
   1: import java.awt.geom.Ellipse2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Line2D;
   4:         ...
   5:         
   6:         GeneralPath g1 = new GeneralPath();
   7:         g1.moveTo(1.0f, 2.0f);
   8:         ...
   9:         g1.curveTo(5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);
  10:         g1.quadTo(1.0f, 2.0f, 3.0f, 4.0f);
  11:         g1.closePath();
  12:         ...
  13:         g2.curveTo(5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);
  14:         g2.quadTo(1.0f, 2.0f, 3.0f, 4.0f);

View Full Code Here

reset

public void reset()
Resets the path to empty. The append position is set back to the beginning of the path and all coordinates and point types are forgotten.
Usages and Demos :

View More Examples of reset()
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.Shape;
   4:         ...
   5:     Point2D.Float point = start;
   6:     p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:     p.moveTo(point.x, point.y);
   8:     point = (Point2D.Float)p.getCurrentPoint();
   9:     point = (Point2D.Float)p.getCurrentPoint();

View Full Code Here
   1: import java.awt.Shape;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:     
   6:     private GeneralPath m_path = new GeneralPath();
   7:     
   8:         ...
   9:         if ( m_edgeType == EDGE_LINE ) {
  10:             m_path.reset();
  11:             m_path.moveTo(x+poly[0],y+poly[1]);
  12:         ...
  13:         } else if ( m_edgeType == EDGE_CURVE ) {
  14:             m_path.reset();

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:     public final static int ARROW_SEGMENT = 10;
   6:     private GeneralPath m_arrow = new GeneralPath();
   7:     
   8:         ...
   9:     {
  10:         m_arrow.reset();
  11:         

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5:     public void render(int w, int h, Graphics2D g2) {
   6:         GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:         p.moveTo(w*0.25f, h*0.2f);
   8:         ...
   9: 
  10:         p.reset();
  11:         p.moveTo(w*0.25f, h*0.6f);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.geom.GeneralPath;
   3: import java.util.List;
   4:         ...
   5: {
   6:     private GeneralPath generalPath;
   7: 
   8:         ...
   9:         List points = graphic.getFreehandPoints();
  10:         generalPath.reset();
  11:         double startX = ((Number) points.get(0)).doubleValue();

View Full Code Here

setWindingRule

public void setWindingRule(int rule)
Sets the winding rule for this path to the specified value.
Parameters:
rule - an integer representing the specified winding rule
Usages and Demos :

View More Examples of setWindingRule(int rule)
   1: import java.awt.*;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5: {
   6:   static GeneralPath makeRect( int x, int y, int width, int height )
   7:   {
   8:         ...
   9:     GeneralPath p = new GeneralPath();
  10:     
  11:         ...
  12: 
  13:     p.setWindingRule( GeneralPath.WIND_NON_ZERO );

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.geom.GeneralPath;
   3: import java2d.Surface;
   4:         ...
   5: 
   6:         GeneralPath p = new GeneralPath(GeneralPath.WIND_NON_ZERO);
   7:         p.moveTo(0.0f, 0.0f);
   8:         ...
   9: 
  10:         p.setWindingRule(GeneralPath.WIND_EVEN_ODD);
  11:         g2.setColor(Color.lightGray);

View Full Code Here
   1: import java.awt.geom.Area;
   2: import java.awt.geom.GeneralPath;
   3: 
   4:         ...
   5:             int wr = CSSUtilities.convertClipRule(child);
   6:             GeneralPath path = new GeneralPath(clipNode.getOutline());
   7:         ...
   8:             path.setWindingRule(wr);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.PathIterator;
   4:         ...
   5:   {
   6:     this(GeneralPath.class);
   7:   }
   8:         ...
   9: 
  10:     final GeneralPath path = new GeneralPath();
  11:         ...
  12:     path.setWindingRule(wRule);

View Full Code Here
   1: 
   2:             GeneralPath path = new GeneralPath(childShape);
   3:             path.transform(childAffineTransform);
   4:         ...
   5:             if (clipRule.equals("evenodd")) {
   6:               path.setWindingRule(GeneralPath.WIND_EVEN_ODD);
   7:             } else {
   8:         ...
   9:               path.setWindingRule(GeneralPath.WIND_NON_ZERO);
  10:             }
  11:         ...
  12: 
  13:                   GeneralPath path = new GeneralPath(childShape);

View Full Code Here

transform

public void transform(AffineTransform at)
Transforms the geometry of this path using the specified AffineTransform. The geometry is transformed in place, which permanently changes the boundary defined by this object.
Parameters:
at - the AffineTransform used to transform the area
Usages and Demos :

View More Examples of transform(AffineTransform at)
   1: import java.awt.geom.Arc2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:         GeneralPath shape = new GeneralPath();
   7:         shape.append(new Arc2D.Double(
   8:         ...
   9:         getTransform().scale(plotArea.getWidth(), plotArea.getHeight() / 3);
  10:         shape.transform(getTransform());
  11: 
  12:         ...
  13:             getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
  14:             shape.transform(getTransform());

View Full Code Here
   1: import java.awt.Graphics2D;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:         GeneralPath shape1 = new GeneralPath();
   7:         GeneralPath shape2 = new GeneralPath();
   8:         ...
   9:             getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
  10:             shape1.transform(getTransform());
  11:         ...
  12:             shape2.transform(getTransform());

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.util.Hashtable;
   4:         ...
   5:                 double scale = width / factor;
   6:                 GeneralPath path = new GeneralPath();
   7:                 path.append(medium.getPath(), false);
   8:         ...
   9:                 t.rotate(Math.PI / 2);
  10:                 path.transform(t);
  11:                 context.getGraphics().fill(path);
  12:         ...
  13:             t.scale((mirror ? -1.0 : 1.0) / MAX_NARROWING_FACTOR, 1);
  14:             path.transform(t);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.GeneralPath;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:   private native GeneralPath getGlyphOutlineNative(int glyphIndex);
   7: 
   8:         ...
   9:   {
  10:     GeneralPath gp = getGlyphOutlineNative( glyphCodes[ glyphIndex ] );
  11:     if (glyphTransforms[glyphIndex] != null)
  12:         ...
  13:       gp.transform( glyphTransforms[glyphIndex]);

View Full Code Here
   1:     public class TrianglePanel extends JPanel {
   2:         private GeneralPath             triangle;
   3:         ...
   4:         private GeneralPath             typeShape;
   5:         private float                   triangleWidth = TRIANGLE_WIDTH;
   6:         ...
   7:         private void initTriangle() {
   8:           triangle = new GeneralPath();
   9:           typeShape = new GeneralPath();
  10:         ...
  11:           triangle.closePath();
  12:           triangle.transform(TRANS_TO_CENTER);

View Full Code Here