NVGMatrix

Matrix class.

Constructors

this
this(const(float)[] amat)

Create Matrix with the given values.

Members

Functions

identity
NVGMatrix identity()

Sets this matrix to identity matrix.

invert
NVGMatrix invert()

Inverts this matrix. If inverted matrix cannot be calculated, this.valid fill be false.

inverted
NVGMatrix inverted()

Returns new inverse matrix. If inverted matrix cannot be calculated, res.valid fill be false.

mul
NVGMatrix mul(NVGMatrix s)

Sets this matrix to the result of multiplication of this and s (this * S).

opBinary
NVGMatrix opBinary(NVGMatrix s)

Multiply this matrix by s, return result as new matrix. Performs operations in this left-to-right order.

opOpAssign
NVGMatrix opOpAssign(NVGMatrix s)

Multiply this matrix by s. Performs operations in this left-to-right order.

point
void point(float* dx, float* dy, float sx, float sy)

Transform point with this matrix. null destinations are allowed. sx and sy is the source point. dx and dy may point to the same variables.

point
void point(float x, float y)

Transform point with this matrix.

premul
NVGMatrix premul(NVGMatrix s)

Sets this matrix to the result of multiplication of s and this (S * this). Sets the transform to the result of multiplication of two transforms, of A = B*A.

rotate
NVGMatrix rotate(float a)

Rotate this matrix.

rotateTransform
NVGMatrix rotateTransform(float a, float tx, float ty)

This is the same as doing: mat.identity.rotate(a).translate(tx, ty), only faster

scale
NVGMatrix scale(float sx, float sy)

Scale this matrix.

scaleRotateTransform
NVGMatrix scaleRotateTransform(float xscale, float yscale, float a, float tx, float ty)

Utility function to be used in setXXX(). This is the same as doing: mat.identity.rotate(a).scale(xs, ys).translate(tx, ty), only faster

skewX
NVGMatrix skewX(float a)

Skew this matrix by X axis.

skewY
NVGMatrix skewY(float a)

Skew this matrix by Y axis.

skewY
NVGMatrix skewY(float ax, float ay)

Skew this matrix by both axes.

translate
NVGMatrix translate(float tx, float ty)

Translate this matrix.

Properties

isIdentity
bool isIdentity [@property getter]

Returns true if this matrix is identity matrix.

valid
bool valid [@property getter]

Can be used to check validity of inverted result

Static functions

Identity
NVGMatrix Identity()

Returns new identity matrix.

Rotated
NVGMatrix Rotated(float a)

Returns new rotation matrix. Angle is specified in radians.

RotatedTransformed
NVGMatrix RotatedTransformed(float a, float tx, float ty)

This is the same as doing: NVGMatrix.Identity.rotate(a).translate(tx, ty), only faster

Scaled
NVGMatrix Scaled(float sx, float sy)

Returns new scaling matrix.

ScaledRotatedTransformed
NVGMatrix ScaledRotatedTransformed(float xscale, float yscale, float a, float tx, float ty)

Utility function to be used in setXXX(). This is the same as doing: NVGMatrix.Identity.rotate(a).scale(xs, ys).translate(tx, ty), only faster

SkewedX
NVGMatrix SkewedX(float a)

Returns new x-skewing matrix. Angle is specified in radians.

SkewedXY
NVGMatrix SkewedXY(float ax, float ay)

Returns new xy-skewing matrix. Angles are specified in radians.

SkewedY
NVGMatrix SkewedY(float a)

Returns new y-skewing matrix. Angle is specified in radians.

Translated
NVGMatrix Translated(float tx, float ty)

Returns new translation matrix.

Variables

mat
float[6] mat;

Matrix values. Initial value is identity matrix.

See Also

Meta