[]
        
(Showing Draft Content)

Transform

DsPdfJS API v9.1.0


DsPdfJS API / Transform

Class: Transform

Represents a 3x2 transformation matrix.

Extends

Accessors

id

Get Signature

get id(): number

Gets the reference to the object.

Returns

number

Inherited from

ObjectBase.id


matrix

Get Signature

get matrix(): number[]

Gets or sets the transformation matrix. The matrix consists of six numbers (their meaning is simplified for clarity): m11 - scales the drawing horizontally m12 - skew the the drawing horizontally m21 - skew the the drawing vertically m22 - scales the drawing vertically m31 - moves the the drawing horizontally m32 - moves the the drawing vertically

Returns

number[]

Set Signature

set matrix(matrix): void

Gets or sets the transformation matrix. The matrix consists of six numbers (their meaning is simplified for clarity): m11 - scales the drawing horizontally m12 - skew the the drawing horizontally m21 - skew the the drawing vertically m22 - scales the drawing vertically m31 - moves the the drawing horizontally m32 - moves the the drawing vertically

Parameters
matrix

number[]

Returns

void


om

Get Signature

get om(): ObjectManager

Gets the owner ObjectManager instance.

Returns

ObjectManager

Inherited from

ObjectBase.om

Methods

createIdentity()

Call Signature

static createIdentity(): Transform

Creates an identity transformation.

Returns

Transform

A new instance of Transform.

Call Signature

static createIdentity(om): Transform

Creates an identity transformation.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

Returns

Transform

A new instance of Transform.


createMatrix()

Call Signature

static createMatrix(m11, m12, m21, m22, m31, m32): Transform

Creates a transformation based on the specified 3x2 matrix.

Parameters
m11

number

Scales the drawing horizontally

m12

number

Skew the the drawing horizontally

m21

number

Skew the the drawing vertically

m22

number

Scales the drawing vertically

m31

number

Moves the the drawing horizontally

m32

number

Moves the the drawing vertically

Returns

Transform

A new instance of Transform.

Call Signature

static createMatrix(om, m11, m12, m21, m22, m31, m32): Transform

Creates a transformation based on the specified 3x2 matrix.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

m11

number

Scales the drawing horizontally

m12

number

Skew the the drawing horizontally

m21

number

Skew the the drawing vertically

m22

number

Scales the drawing vertically

m31

number

Moves the the drawing horizontally

m32

number

Moves the the drawing vertically

Returns

Transform

A new instance of Transform.


createRotation()

Call Signature

static createRotation(angle, angleUnits?, cx?, cy?): Transform

Creates a rotation transformation.

Parameters
angle

number

The rotation angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.

Call Signature

static createRotation(om, angle, angleUnits?, cx?, cy?): Transform

Creates a rotation transformation.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

angle

number

The rotation angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.


createScale()

Call Signature

static createScale(scaleFactor, cx?, cy?): Transform

Creates a scaling transformation.

Parameters
scaleFactor

number

The value to scale by on the X and Y axes.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.

Call Signature

static createScale(om, scaleFactor, cx?, cy?): Transform

Creates a scaling transformation.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

scaleFactor

number

The value to scale by on the X and Y axes.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.


createScaleXY()

Call Signature

static createScaleXY(scaleX, scaleY, cx?, cy?): Transform

Creates a scaling transformation.

Parameters
scaleX

number

The value to scale by on the X axis.

scaleY

number

The value to scale by on the Y axis.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.

Call Signature

static createScaleXY(om, scaleX, scaleY, cx?, cy?): Transform

Creates a scaling transformation.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

scaleX

number

The value to scale by on the X axis.

scaleY

number

The value to scale by on the Y axis.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.


createSkew()

Call Signature

static createSkew(angleX, angleY, angleUnits?, cx?, cy?): Transform

Creates a skew transformation.

Parameters
angleX

number

The X angle.

angleY

number

The Y angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.

Call Signature

static createSkew(om, angleX, angleY, angleUnits?, cx?, cy?): Transform

Creates a skew transformation.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

angleX

number

The X angle.

angleY

number

The Y angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

Transform

A new instance of Transform.


createTranslation()

Call Signature

static createTranslation(offsetX, offsetY): Transform

Creates a translation transformation.

Parameters
offsetX

number

The horizontal offset.

offsetY

number

The vertical offset.

Returns

Transform

A new instance of Transform.

Call Signature

static createTranslation(om, offsetX, offsetY): Transform

Creates a translation transformation.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Transform object.

offsetX

number

The horizontal offset.

offsetY

number

The vertical offset.

Returns

Transform

A new instance of Transform.


applyTransform()

applyTransform(transform): void

Applies the transformation to the current instance.

Parameters

transform

Transform

The Transform object to be multiplied by the current transformation matrix.

Returns

void


clone()

clone(): Transform

Creates a copy of the current transformation.

Returns

Transform

A copy of the current Transform object.


free()

free(): void

Detaches the object from the ObjectManager and deallocates its memory, if possible.

Returns

void

Inherited from

ObjectBase.free


pop()

pop(): void

Restores the previously pushed transformation from the stack.

Returns

void


push()

push(): void

Saves the current transformation to the stack.

Returns

void


rebind()

rebind(omTo): void

Rebinds the object from the current ObjectManager to the specified one.

Parameters

omTo

ObjectManager

The new ObjectManager for the object.

Returns

void

Inherited from

ObjectBase.rebind


reset()

reset(): void

Resets the transformation to the identity matrix.

Returns

void


rotate()

rotate(angle, angleUnits?, cx?, cy?): void

Applies the rotation transformation.

Parameters

angle

number

The rotation angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

void


scale()

scale(scaleFactor, cx?, cy?): void

Applies the scaling transformation.

Parameters

scaleFactor

number

The value to scale by on the X and Y axes.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

void


scaleXY()

scaleXY(scaleX, scaleY, cx?, cy?): void

Applies the scaling transformation.

Parameters

scaleX

number

The value to scale by on the X axis.

scaleY

number

The value to scale by on the Y axis.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

void


setTransform()

setTransform(transform): void

Sets the transformation to the current instance.

Parameters

transform

Transform

The Transform object to replace the current transformation.

Returns

void


skew()

skew(angleX, angleY, angleUnits?, cx?, cy?): void

Applies the skew transformation.

Parameters

angleX

number

The X angle.

angleY

number

The Y angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

cx?

number

The optional center point X offset.

cy?

number

The optional center point Y offset.

Returns

void


skewX()

skewX(angle, angleUnits?): void

Applies the skew transformation along the X axis.

Parameters

angle

number

The X angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

Returns

void


skewY()

skewY(angle, angleUnits?): void

Applies the skew transformation along the Y axis.

Parameters

angle

number

The Y angle.

angleUnits?

AngleUnits

The angle units. The default is Degrees.

Returns

void


transformPoint()

transformPoint(point): Point

Transforms a Point by the transformation matrix.

Parameters

point

Point

The original Point.

Returns

Point

The transformed Point.


transformPoints()

transformPoints(points): Point[]

Transforms an array of Points by the transformation matrix.

Parameters

points

Point[]

The original array of Points.

Returns

Point[]

The array of transformed Points.


transformQuadrilateral()

transformQuadrilateral(quad): Quadrilateral

Transforms a ds.Quadrilateral by the transformation matrix.

Parameters

quad

Quadrilateral

The original ds.Quadrilateral.

Returns

Quadrilateral

The transformed ds.Quadrilateral.


translate()

translate(offsetX, offsetY): void

Applies the translation transformation.

Parameters

offsetX

number

The horizontal offset.

offsetY

number

The vertical offset.

Returns

void


tryInvert()

tryInvert(): boolean

Inverts the transformation matrix, if possible.

Returns

boolean

true on success, false otherwise.