graphics.ext.Path Extends goog.graphics.Path
Creates a path object

Inheritance

Constructor

goog.graphics.ext.Path()

Instance Methods

Public Protected Private
clone() !goog.graphics.ext.Path
Clones the path.
Returns: !goog.graphics.ext.Path  A clone of this path.
code »
getBoundingBox() ?goog.math.Rect
No description.
Returns: ?goog.math.Rect  The bounding box of the path, or null if the path is empty.
code »
modifyBounds(deltaXdeltaYxFactoryFactor) !goog.graphics.ext.Path
Modify the bounding box of the path. This may cause the path to be simplified (i.e. arcs converted to curves) as a side-effect.
Arguments:
deltaX : number
How far to translate the x coordinates.
deltaY : number
How far to translate the y coordinates.
xFactor : number
After translation, all x coordinates are multiplied by this number.
yFactor : number
After translation, all y coordinates are multiplied by this number.
Returns: !goog.graphics.ext.Path  The path itself.
code »
transform(tx) !goog.graphics.ext.Path
Transforms the path. Only simple paths are transformable. Attempting to transform a non-simple path will throw an error.
Arguments:
tx : !goog.graphics.AffineTransform
The transformation to perform.
Returns: !goog.graphics.ext.Path  The path itself.
code »
useBoundingBox(bounds)
Set the precomputed bounds.
Arguments:
bounds : ?goog.math.Rect
The bounds to use, or set to null to clear and recompute on the next call to getBoundingBox.
code »
appendPath(path) !goog.graphics.Path
Appends another path to the end of this path.
Arguments:
path : !goog.graphics.Path
The path to append.
Returns: !goog.graphics.Path  This path.
code »
arc(cxcyrxryfromAngleextentconnect) !goog.graphics.Path
Use arcTo or arcToAsCurves instead. Adds a path command to draw an arc centered at the point (cx, cy) with radius rx along the x-axis and ry along the y-axis from startAngle through extent degrees. Positive rotation is in the direction from positive x-axis to positive y-axis.
Arguments:
cx : number
X coordinate of center of ellipse.
cy : number
Y coordinate of center of ellipse.
rx : number
Radius of ellipse on x axis.
ry : number
Radius of ellipse on y axis.
fromAngle : number
Starting angle measured in degrees from the positive x-axis.
extent : number
The span of the arc in degrees.
connect : boolean
If true, the starting point of the arc is connected to the current point.
Returns: !goog.graphics.Path  The path itself.
code »
arcTo(rxryfromAngleextent) !goog.graphics.Path
Adds a path command to draw an arc starting at the path's current point, with radius rx along the x-axis and ry along the y-axis from startAngle through extent degrees. Positive rotation is in the direction from positive x-axis to positive y-axis. This method makes the path non-simple.
Arguments:
rx : number
Radius of ellipse on x axis.
ry : number
Radius of ellipse on y axis.
fromAngle : number
Starting angle measured in degrees from the positive x-axis.
extent : number
The span of the arc in degrees.
Returns: !goog.graphics.Path  The path itself.
code »
arcToAsCurves(rxryfromAngleextent) !goog.graphics.Path
Same as arcTo, but approximates the arc using bezier curves. As a result, this method does not affect the simplified status of this path. The algorithm is adapted from java.awt.geom.ArcIterator.
Arguments:
rx : number
Radius of ellipse on x axis.
ry : number
Radius of ellipse on y axis.
fromAngle : number
Starting angle measured in degrees from the positive x-axis.
extent : number
The span of the arc in degrees.
Returns: !goog.graphics.Path  The path itself.
code »
clear() !goog.graphics.Path
Clears the path.
Returns: !goog.graphics.Path  The path itself.
code »
clone() !goog.graphics.Path
No description.
Returns: !goog.graphics.Path  A copy of this path.
code »
close() !goog.graphics.Path
Adds a path command to close the path by connecting the last point to the first point.
Returns: !goog.graphics.Path  The path itself.
code »
createTransformedPath(tx) !goog.graphics.Path
Creates a transformed copy of this path. The path is simplified prior to transformation.
Arguments:
tx : !goog.graphics.AffineTransform
The transformation to perform.
Returns: !goog.graphics.Path  A new, transformed path.
code »
curveTo(var_args) !goog.graphics.Path
Adds points to the path by drawing cubic Bezier curves. Each curve is specified using 3 points (6 coordinates) - two control points and the end point of the curve.
Arguments:
var_args : ...number
The coordinates specifiying each curve in sets of 6 points: [x1, y1] the first control point, [x2, y2] the second control point and [x, y] the end point.
Returns: !goog.graphics.Path  The path itself.
code »
forEachSegment(callback)
Iterates over the path calling the supplied callback once for each path segment. The arguments to the callback function are the segment type and an array of its arguments. The LINETO and CURVETO arrays can contain multiple segments of the same type. The number of segments is the length of the array divided by the segment length (2 for lines, 6 for curves). As a convenience the ARCTO segment also includes the end point as the last two arguments: rx, ry, fromAngle, extent, x, y.
Arguments:
callback : function(number, Array)
The function to call with each path segment.
code »
getCurrentPoint() ?Array.<number>
Returns the coordinates most recently added to the end of the path.
Returns: ?Array.<number>  An array containing the ending coordinates of the path of the form [x, y].
code »
isEmpty() boolean
No description.
Returns: boolean  Whether the path is empty.
code »
isSimple() boolean
Returns true if this path contains no arcs. Simplified paths can be created using createSimplifiedPath.
Returns: boolean  True if the path contains no arcs.
code »
lineTo(var_args) !goog.graphics.Path
Adds points to the path by drawing a straight line to each point.
Arguments:
var_args : ...number
The coordinates of each destination point as x, y value pairs.
Returns: !goog.graphics.Path  The path itself.
code »
moveTo(xy) !goog.graphics.Path
Adds a point to the path by moving to the specified point. Repeated moveTo commands are collapsed into a single moveTo.
Arguments:
x : number
X coordinate of destination point.
y : number
Y coordinate of destination point.
Returns: !goog.graphics.Path  The path itself.
code »
transform(tx) !goog.graphics.Path
Transforms the path. Only simple paths are transformable. Attempting to transform a non-simple path will throw an error.
Arguments:
tx : !goog.graphics.AffineTransform
The transformation to perform.
Returns: !goog.graphics.Path  The path itself.
code »

Instance Properties

bounds_ : goog.math.Rect
Optional cached or user specified bounding box. A user may wish to precompute a bounding box to save time and include more accurate computations.
Code »
constructor :
No description.
Code »
arguments_ :
The arguments corresponding to each of the segments.
Code »
closePoint_ :
The coordinates of the point which closes the path (the point of the last moveTo command).
Code »
count_ :
The number of repeated segments of the current type.
Code »
currentPoint_ :
The coordinates most recently added to the end of the path.
Code »
segments_ :
The segment types that constitute this path.
Code »
simple_ :
Flag for whether this is a simple path (contains no arc segments).
Code »

Static Properties

goog.graphics.ext.Path.superClass_ :
No description.
Code »

Package graphics.ext

Package Reference