scenic.path
Class Path

java.lang.Object
  extended by scenic.path.Path

public class Path
extends java.lang.Object

This class defines a path that can be used for stroking and filling. A path consists of one or more subpaths. Each subpath consists of one or more connected segments. There are different kinds of segments: straight lines, Bezier curves and elliptical arcs. Path, subpaths and segments are constant. Their values cannot be changed after they are created.


Constructor Summary
Path(java.awt.Shape shape, java.awt.geom.AffineTransform transform, double flatness)
          Creates a path from the given java.awt.Shape object.
Path(SubPath[] subPaths)
          Creates a path that has the given subpaths.
 
Method Summary
static void addPointToBounds(java.awt.geom.AffineTransform tm, java.awt.Rectangle r, double xp, double yp)
          Helper method which modifies the rectangle so that it contains the given point when using the given transform.
 java.awt.Rectangle getBounds(java.awt.geom.AffineTransform transform)
          Calculates the bounds of this path using the given transform.
 SubPath[] getSubPaths()
          Gets the subpaths.
 void walk(PathWalker walker, java.awt.geom.AffineTransform error)
          Walks the given walker through the path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Path

public Path(SubPath[] subPaths)
Creates a path that has the given subpaths.

Parameters:
subPaths - the subpaths.

Path

public Path(java.awt.Shape shape,
            java.awt.geom.AffineTransform transform,
            double flatness)
Creates a path from the given java.awt.Shape object.

Parameters:
shape - the source path
transform - matrix that is used to transform the path (can be null)
flatness - maximum deviation from correct path (only used for arcs and ellipses)
Method Detail

getSubPaths

public SubPath[] getSubPaths()
Gets the subpaths.


walk

public void walk(PathWalker walker,
                 java.awt.geom.AffineTransform error)
Walks the given walker through the path.

Parameters:
walker - the walker.
error - the error matrix.

getBounds

public java.awt.Rectangle getBounds(java.awt.geom.AffineTransform transform)
Calculates the bounds of this path using the given transform.

Parameters:
transform - the transform.
Returns:
the bounds.

addPointToBounds

public static void addPointToBounds(java.awt.geom.AffineTransform tm,
                                    java.awt.Rectangle r,
                                    double xp,
                                    double yp)
Helper method which modifies the rectangle so that it contains the given point when using the given transform.

Parameters:
tm - the transform.
r - the rectangle.
xp - the x coordinate of the point.
yp - the y coordinate of the point.