Skip to main content

Class: SvgPathStream

A path stream which builds SVG path strings from its input path commands.

Implements

Constructors

constructor

new SvgPathStream(precision?): SvgPathStream

Constructor.

Parameters

NameTypeDefault valueDescription
precisionnumber0The precision of this stream. All coordinates will be rounded to this stream's precision when building the SVG path string. A value of 0 indicates infinite precision. Defaults to 0.

Returns

SvgPathStream

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:24

Methods

arc

arc(x, y, radius, startAngle, endAngle, counterClockwise?): void

Paths an arc.

Parameters

NameTypeDescription
xnumberThe x-coordinate of the center of the circle containing the arc.
ynumberThe y-coordinate of the center of the circle containing the arc.
radiusnumberThe radius of the arc.
startAnglenumberThe angle of the start of the arc, in radians.
endAnglenumberThe angle of the end of the arc, in radians.
counterClockwise?booleanWhether the arc should be drawn counterclockwise. False by default.

Returns

void

Implementation of

PathStream.arc

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:123


beginPath

beginPath(): void

Begins a path. Erases all previous path state.

Returns

void

Implementation of

PathStream.beginPath

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:59


bezierCurveTo

bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): void

Paths a cubic Bezier curve from the current point to a specified point.

Parameters

NameTypeDescription
cp1xnumberThe x-coordinate of the first control point.
cp1ynumberThe y-coordinate of the first control point.
cp2xnumberThe x-coordinate of the second control point.
cp2ynumberThe y-coordinate of the second control point.
xnumberThe x-coordinate of the end point.
ynumberThe y-coordinate of the end point.

Returns

void

Implementation of

PathStream.bezierCurveTo

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:93


closePath

closePath(): void

Paths a line from the current point to the first point defined by the current path.

Returns

void

Implementation of

PathStream.closePath

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:172


getPrecision

getPrecision(): number

Gets the precision of this stream. All coordinates will be rounded to this stream's precision when building the SVG path string. A value of 0 indicates infinite precision.

Returns

number

The precision of this stream.

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:44


getSvgPath

getSvgPath(): string

Gets the SVG path string describing all path commands consumed by this stream since the last call to beginPath().

Returns

string

The SVG path string describing all path commands consumed by this stream since the last call to beginPath().

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:35


lineTo

lineTo(x, y): void

Paths a straight line from the current point to a specified point.

Parameters

NameTypeDescription
xnumberThe x-coordinate of the end point.
ynumberThe y-coordinate of the end point.

Returns

void

Implementation of

PathStream.lineTo

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:78


moveTo

moveTo(x, y): void

Moves to a specified point.

Parameters

NameTypeDescription
xnumberThe x-coordinate of the point to which to move.
ynumberThe y-coordinate of the point to which to move.

Returns

void

Implementation of

PathStream.moveTo

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:64


quadraticCurveTo

quadraticCurveTo(cpx, cpy, x, y): void

Paths a quadrative Bezier curve from the current point to a specified point.

Parameters

NameTypeDescription
cpxnumberThe x-coordinate of the control point.
cpynumberThe y-coordinate of the control point.
xnumberThe x-coordinate of the end point.
ynumberThe y-coordinate of the end point.

Returns

void

Implementation of

PathStream.quadraticCurveTo

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:108


setPrecision

setPrecision(precision): void

Sets the precision of this stream. All coordinates will be rounded to this stream's precision when building the SVG path string. A value of 0 indicates infinite precision.

Parameters

NameTypeDescription
precisionnumberThe precision of this stream. Negative numbers will be converted to their absolute values.

Returns

void

Defined in

src/sdk/graphics/svg/SvgPathStream.ts:53