Skip to main content

Class: AffineTransformPathStream

A TransformingPathStream which applies an affine transformation to its input.

The types of transformation supported by this class are:

  • Translation.
  • Uniform scaling.
  • Rotation.

Hierarchy

Constructors

constructor

new AffineTransformPathStream(consumer): AffineTransformPathStream

Constructor.

Parameters

NameTypeDescription
consumerPathStreamThe path stream that consumes this stream's transformed output.

Returns

AffineTransformPathStream

Inherited from

AbstractTransformingPathStream.constructor

Defined in

src/sdk/graphics/path/PathStream.ts:144

Properties

consumer

Protected consumer: PathStream

The path stream that consumes this stream's transformed output.

Inherited from

AbstractTransformingPathStream.consumer

Defined in

src/sdk/graphics/path/PathStream.ts:144

Methods

addRotation

addRotation(angle, order?): this

Adds a rotation to this stream's transformation.

Parameters

NameTypeDefault valueDescription
anglenumberundefinedThe rotation angle, in radians.
order"after" | "before"'after'The order in which to add the translation (defaults to 'after'): 'before' - Applies the rotation before this stream's current transformation. 'after' - Applies the rotation after this stream's current transformation.

Returns

this

This stream, after its transformation has been changed.

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:82


addScale

addScale(factor, order?): this

Adds a uniform scaling to this stream's transformation.

Parameters

NameTypeDefault valueDescription
factornumberundefinedThe scaling factor.
order"after" | "before"'after'The order in which to add the translation (defaults to 'after'): 'before' - Applies the scaling before this stream's current transformation. 'after' - Applies the scaling after this stream's current transformation.

Returns

this

This stream, after its transformation has been changed.

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:56


addTranslation

addTranslation(x, y, order?): this

Adds a translation to this stream's transformation.

Parameters

NameTypeDefault valueDescription
xnumberundefinedThe x translation.
ynumberundefinedThe y translation.
order"after" | "before"'after'The order in which to add the translation (defaults to 'after'): 'before' - Applies the translation before this stream's current transformation. 'after' - Applies the translation after this stream's current transformation.

Returns

this

This stream, after its transformation has been changed.

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:32


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

Overrides

AbstractTransformingPathStream.arc

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:158


beginPath

beginPath(): void

Begins a path. Erases all previous path state.

Returns

void

Overrides

AbstractTransformingPathStream.beginPath

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:111


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

Overrides

AbstractTransformingPathStream.bezierCurveTo

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:128


closePath

closePath(): void

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

Returns

void

Overrides

AbstractTransformingPathStream.closePath

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:165


getConsumer

getConsumer(): PathStream

Gets the path stream that is consuming this stream's transformed output.

Returns

PathStream

The path stream that is consuming this stream's transformed output.

Inherited from

AbstractTransformingPathStream.getConsumer

Defined in

src/sdk/graphics/path/PathStream.ts:148


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

Overrides

AbstractTransformingPathStream.lineTo

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:122


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

Overrides

AbstractTransformingPathStream.moveTo

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:116


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

Overrides

AbstractTransformingPathStream.quadraticCurveTo

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:145


resetTransform

resetTransform(): this

Resets this stream's transformation to the identity transformation.

Returns

this

This stream, after its transformation has been changed.

Defined in

src/sdk/graphics/path/AffineTransformPathStream.ts:104


setConsumer

setConsumer(consumer): void

Sets the path stream that consumes this stream's transformed output.

Parameters

NameTypeDescription
consumerPathStreamThe new consuming path stream.

Returns

void

Inherited from

AbstractTransformingPathStream.setConsumer

Defined in

src/sdk/graphics/path/PathStream.ts:153