The Matrix object represents a transformation matrix that determines how to map points from one coordinate space to another. You can perform various graphical transformations on a display object by setting the properties of a Matrix object, applying that Matrix object to the matrix property of a Transform object, and then applying that Transform object as the transform property of the display object. These transformation functions include translation (x and y repositioning), rotation, scaling, and skewing.

Together these types of transformations are known as affine transformations. Affine transformations preserve the straightness of lines while transforming, so that parallel lines stay parallel.


To apply a transformation matrix to a display object, you create a Transform object, set its matrix property to the transformation matrix, and then set the transform property of the display object to the Transform object. Matrix objects are also used as parameters of some methods, such as the following:


The draw() method of a BitmapData object

The beginBitmapFill() method, beginGradientFill() method, or lineGradientStyle() method of a Graphics object


Can be created with method new:

Lib.Media.Geom.Matrix.new(a, b, c, d, tx, ty)

Creates a new Matrix object with the specified parameters.

a - (default = 1) - The value that affects the positioning of pixels along the x axis when scaling or rotating an image.

b - (default = 0) - The value that affects the positioning of pixels along the y axis when rotating or skewing an image.

c - (default = 0) - The value that affects the positioning of pixels along the x axis when rotating or skewing an image.

d - (default = 1) - The value that affects the positioning of pixels along the y axis when scaling or rotating an image..

tx - (default = 0) - The distance by which to translate each point along the x axis.

ty - (default = 0) - The distance by which to translate each point along the y axis.


Created Matrix object has proprties:

a

The value that affects the positioning of pixels along the x axis when scaling or rotating an image.

b

The value that affects the positioning of pixels along the y axis when rotating or skewing an image.

c

The value that affects the positioning of pixels along the x axis when rotating or skewing an image.

d

The value that affects the positioning of pixels along the y axis when scaling or rotating an image.

tx

The distance by which to translate each point along the x axis.

ty

The distance by which to translate each point along the y axis.


methods:

clone()

Returns a new Matrix object that is a clone of this matrix, with an exact copy of the contained object.


concat(m)

Concatenates a matrix with the current matrix, effectively combining the geometric effects of the two.

m - The matrix to be concatenated to the source matrix.

copyColumnFrom(column, vector3D)

Copies a Vector3D object into specific column of the calling Matrix3D object.

column - The column from which to copy the data from.

vector3D - The Vector3D object from which to copy the data.

copyColumnTo(column, vector3D)

Copies specific column of the calling Matrix object into the Vector3D object.

column - The column from which to copy the data from. 

vector3D - Vector3D object from which to copy the data.

copyFrom(sourceMatrix)

Copies all of the matrix data from the source Point object into the calling Matrix object.

sourceMatrix - The Matrix object from which to copy the data.

copyRowFrom(row, vector3D)

Copies a Vector3D object into specific row of the calling Matrix object.

row - The row from which to copy the data from.

vector3D - The Vector3D object from which to copy the data.

copyRowTo(row, vector3D)

Copies specific row of the calling Matrix object into the Vector3D object.

row - The row from which to copy the data from.

vector3D - The Vector3D object from which to copy the data.

createBox(scaleX, scaleY, rotation, tx, ty)

Includes parameters for scaling, rotation, and translation.

scaleX - The factor by which to scale horizontally.

scaleY - The factor by which scale vertically.

rotation - (default = 0) - The amount to rotate, in radians.

tx - (default = 0) - The number of pixels to translate (move) to the right along the x axis.

ty - (default = 0) - The number of pixels to translate (move) down along the y axis.

createGradientBox(width, height, rotation, tx, ty)

Creates the specific style of matrix expected by the beginGradientFill() and lineGradientStyle() methods of the Graphics class.

width - The width of the gradient box.

height - The height of the gradient box.

rotation - (default = 0) - The amount to rotate, in radians.

tx - (default = 0) - The distance, in pixels, to translate to the right along the x axis. This value is offset by half of the width parameter.

ty - (default = 0) - The distance, in pixels, to translate down along the y axis. This value is offset by half of the height parameter

deltaTransformPoint(point)

Given a point in the pretransform coordinate space, returns the coordinates of that point after the transformation occurs.

point - The point for which you want to get the result of the matrix transformation.

identity()

Sets each matrix property to a value that causes a null transformation.


invert()

Performs the opposite transformation of the original matrix.


rotate(angle)

Applies a rotation transformation to the Matrix object.

angle - The rotation angle in radians.

scale(sx, sy)

Applies a scaling transformation to the matrix.

sx - A multiplier used to scale the object along the x axis.

sy - A multiplier used to scale the object along the y axis.

setTo(aa, ba, ca, da, txa, tya)

Sets the members of Matrix to the specified values

aa - the values to set the matrix to.

ba

ca

da

txa

tya

toString()

Returns a text value listing the properties of the Matrix object.


transformPoint(point)

Returns the result of applying the geometric transformation represented by the Matrix object to the specified point.

point - The point for which you want to get the result of the Matrix transformation.

translate(dx, dy)

Translates the matrix along the x and y axes, as specified by the dx and dy parameters.

dx - The amount of movement along the x axis to the right, in pixels.

dy - The amount of movement down along the y axis, in pixels.


Created with the Personal Edition of HelpNDoc: Easily create Qt Help files