The goog.graphics.ext.Path Class

goog.graphics.ext.Path
> goog.graphics.Path

goog.graphics.ext.Path()

Creates a path object

.appendPath(path)

Inherited from goog.graphics.Path .

Appends another path to the end of this path.

path {!goog.graphics.Path}
The path to append.
returns {!goog.graphics.Path}
This path.

.arcTo(rx, ry, fromAngle, extent)

Inherited from goog.graphics.Path .

Adds a path command to draw an arc starting at the path's current point, with radius {@code rx} along the x-axis and {@code ry} along the y-axis from {@code startAngle} through {@code extent} degrees. Positive rotation is in the direction from positive x-axis to positive y-axis. This method makes the path non-simple.

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.

.arcToAsCurves(rx, ry, fromAngle, extent)

Inherited from goog.graphics.Path .

Same as {@code 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 {@code java.awt.geom.ArcIterator}.

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.

.clear()

Inherited from goog.graphics.Path .

Clears the path.

returns {!goog.graphics.Path}
The path itself.

.clone()

Clones the path.

returns {!goog.graphics.ext.Path}
A clone of this path.

.close()

Inherited from 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.

.createTransformedPath(tx)

Inherited from goog.graphics.Path .

Creates a transformed copy of this path. The path is simplified {@see #createSimplifiedPath} prior to transformation.

tx {!goog.graphics.AffineTransform}
The transformation to perform.
returns {!goog.graphics.Path}
A new, transformed path.

.curveTo(var_args)

Inherited from 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.

var_args {...number}
The coordinates specifiying each curve in sets of 6 points: {@code [x1, y1]} the first control point, {@code [x2, y2]} the second control point and {@code [x, y]} the end point.
returns {!goog.graphics.Path}
The path itself.

.forEachSegment(callback)

Inherited from goog.graphics.Path .

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 {@code LINETO} and {@code 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 {@code ARCTO} segment also includes the end point as the last two arguments: {@code rx, ry, fromAngle, extent, x, y}.

callback {function(number, Array)}
The function to call with each path segment.

.getBoundingBox()

returns {goog.math.Rect?}
The bounding box of the path, or null if the path is empty.

.getCurrentPoint()

Inherited from goog.graphics.Path .

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 {@code [x, y]}.

.isEmpty()

Inherited from goog.graphics.Path .

returns {boolean}
Whether the path is empty.

.isSimple()

Inherited from goog.graphics.Path .

Returns true if this path contains no arcs. Simplified paths can be created using {@code createSimplifiedPath}.

returns {boolean}
True if the path contains no arcs.

.lineTo(var_args)

Inherited from goog.graphics.Path .

Adds points to the path by drawing a straight line to each point.

var_args {...number}
The coordinates of each destination point as x, y value pairs.
returns {!goog.graphics.Path}
The path itself.

.modifyBounds(deltaX, deltaY, xFactor, yFactor)

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.

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.

.moveTo(x, y)

Inherited from goog.graphics.Path .

Adds a point to the path by moving to the specified point. Repeated moveTo commands are collapsed into a single moveTo.

x {number}
X coordinate of destination point.
y {number}
Y coordinate of destination point.
returns {!goog.graphics.Path}
The path itself.

.transform(tx)

Transforms the path. Only simple paths are transformable. Attempting to transform a non-simple path will throw an error.

tx {!goog.graphics.AffineTransform}
The transformation to perform.
returns {!goog.graphics.ext.Path}
The path itself.

.useBoundingBox(bounds)

Set the precomputed bounds.

bounds {goog.math.Rect?}
The bounds to use, or set to null to clear and recompute on the next call to getBoundingBox.