Class CAAT.PathUtil.PathSegment
Defined in: PathSegment.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
Segment bounding box.
|
|
Color to draw the segment.
|
|
Segment length.
|
|
Path this segment belongs to.
|
Method Attributes | Method Name and Description |
---|---|
<private> |
__init()
|
applyAsPath(ctx)
Draw this path using RenderingContext2D drawing primitives.
|
|
drawHandle(ctx, x, y)
|
|
Get path's last coordinate.
|
|
endPath()
Instruments the path has finished building, and that no more segments will be added to it.
|
|
getBoundingBox(rectangle)
Gets the path bounding box (or the rectangle that contains the whole path).
|
|
getContour(iSize)
Gets a polyline describing the path contour.
|
|
getControlPoint(index)
Gets CAAT.Point instance with the 2d position of a control point.
|
|
Gets Path length.
|
|
getPosition(time)
Get a coordinate on path.
|
|
Gets the number of control points needed to create the path.
|
|
setColor(color)
|
|
setParent(parent)
Set a PathSegment's parent
|
|
setPoint(point, index)
Set a point from this path segment.
|
|
setPoints(points)
Set this path segment's points information.
|
|
Get path's starting coordinate.
|
|
transform(matrix)
Transform this path with the given affinetransform matrix.
|
|
updatePath(point)
Recalculate internal path structures.
|
Field Detail
bbox
Segment bounding box.
color
Color to draw the segment.
length
Segment length.
parent
Path this segment belongs to.
Method Detail
<private>
__init()
applyAsPath(ctx)
Draw this path using RenderingContext2D drawing primitives.
The intention is to set a path or pathsegment as a clipping region.
- Parameters:
- ctx
- {RenderingContext2D}
drawHandle(ctx, x, y)
- Parameters:
- ctx
- x
- y
{CAAT.Point}
endCurvePosition()
Get path's last coordinate.
- Returns:
- {CAAT.Point}
endPath()
Instruments the path has finished building, and that no more segments will be added to it.
You could later add more PathSegments and
endPath
must be called again.
{CAAT.Rectangle}
getBoundingBox(rectangle)
Gets the path bounding box (or the rectangle that contains the whole path).
- Parameters:
- rectangle
- a CAAT.Rectangle instance with the bounding box.
- Returns:
- {CAAT.Rectangle}
{[CAAT.Point]}
getContour(iSize)
Gets a polyline describing the path contour. The contour will be defined by as mush as iSize segments.
- Parameters:
- iSize
- an integer indicating the number of segments of the contour polyline.
- Returns:
- {[CAAT.Point]}
{CAAT.Point}
getControlPoint(index)
Gets CAAT.Point instance with the 2d position of a control point.
- Parameters:
- index
- an integer indicating the desired control point coordinate.
- Returns:
- {CAAT.Point}
{number}
getLength()
Gets Path length.
- Returns:
- {number}
{CAAT.Point}
getPosition(time)
Get a coordinate on path.
The parameter time is normalized, that is, its values range from zero to one.
zero will mean
startCurvePosition
and one will be endCurvePosition
. Other values
will be a position on the path relative to the path length. if the value is greater that 1, if will be set
to modulus 1.
- Parameters:
- time
- a float with a value between zero and 1 inclusive both.
- Returns:
- {CAAT.Point}
{number}
numControlPoints()
Gets the number of control points needed to create the path.
Each PathSegment type can have different control points.
- Returns:
- {number} an integer with the number of control points.
setColor(color)
- Parameters:
- color
setParent(parent)
Set a PathSegment's parent
- Parameters:
- parent
setPoint(point, index)
Set a point from this path segment.
- Parameters:
- point
- {CAAT.Point}
- index
- {integer} a point index.
setPoints(points)
Set this path segment's points information.
- Parameters:
- points
- {Array
}
{CAAT.Point}
startCurvePosition()
Get path's starting coordinate.
- Returns:
- {CAAT.Point}
transform(matrix)
Transform this path with the given affinetransform matrix.
- Parameters:
- matrix
updatePath(point)
Recalculate internal path structures.
- Parameters:
- point