number |
$sx
Scaling x element |
number |
$rx
Shearing x element |
number |
$tx
Translation x element |
number |
$ry
Shearing y element |
number |
$sy
Scaling y element |
number |
$ty
Translation y element |
|
$_rx
Shearing x element |
|
$_ry
Shearing y element |
|
$_sx
Scaling x element |
|
$_sy
Scaling y element |
|
$_tx
Translation x element |
|
$_ty
Translation y element |
|
__construct ([number|array|Sgss_Graphics_Transform $sx = 1], [number $rx = 0], [number $tx = 0], [number $ry = 0], [number $sy = 1], [number $ty = 0])
The constructor |
Sgss_Graphics_Transform |
composite (number|array|Sgss_Graphics_Transform $sx, [number $rx = 0], [number $tx = 0], [number $ry = 0], [number $sy = 1], [number $ty = 0])
Composites this transformation matrix with another |
Sgss_Graphics_Transform |
composition (number|array|Sgss_Graphics_Transform $sx, [number $rx = 0], [number $tx = 0], [number $ry = 0], [number $sy = 1], [number $ty = 0])
Returns the composited transformation matrix with another |
|
createReflection ([boolean $vert = false], [boolean $hori = false], [number $x = 0], [number $y = 0])
Creates an returns the specified reflection transformation matrix |
|
createRotation (number $theta, [number $x = 0], [number $y = 0])
Creates an returns the specified rotation transformation matrix |
|
createScale (number $sx, number $sy)
Creates an returns the specified scaling transformation matrix |
|
createShear (number $rx, number $ry)
Creates an returns the specified shearing transformation matrix |
|
createTranslation (number $tx, number $ty)
Creates an returns the specified translation transformation matrix |
number |
determinant ()
Returns the determinant of this matrix |
boolean |
drawImagick (Imagick|ImagickDraw $imagick, [number $x = 0], [number $y = 0])
Applies this transformation matrix to the specified ImagickDraw instance |
array |
getImagick ()
Converts this transformation matrix to an array used with Imagick |
number |
getScaleX ()
Returns the scaling x element |
number |
getScaleY ()
Returns the scaling y element |
number |
getShearX ()
Returns the shearing x element |
number |
getShearY ()
Returns the shearing y element |
Sgss_Graphics_Transform |
getTransform ()
Returns another object representing this transformation matrix |
number |
getTranslateX ()
Returns the translation x element |
number |
getTranslateY ()
Returns the translation y element |
Sgss_Graphics_Transform |
inverse ()
Returns the inversed transformation matrix |
boolean |
offsetExists (mixed $offset)
|
mixed |
offsetGet (mixed $offset)
|
mixed |
offsetSet (mixed $offset, mixed $value)
|
void |
offsetUnset (mixed $offset)
|
Sgss_Graphics_Transform |
reflect ([boolean $vert = false], [boolean $hori = false], [number $x = 0], [number $y = 0])
Reflects this transformation matrix |
Sgss_Graphics_Transform |
rotate (number $theta, [number $x = 0], [number $y = 0])
Rotates this transformation matrix |
Sgss_Graphics_Transform |
scale (number $sx, number $sy)
Scales this transformation |
void |
setScaleX (number $sx)
Sets the scaling x element to the specified value |
void |
setScaleY (number $sy)
Sets the scaling y element to the specified value |
void |
setShearX (number $rx)
Sets the shearing x element to the specified value |
void |
setShearY (number $ry)
Sets the shearing y element to the specified value |
void |
setTransform (Sgss_Graphics_Transform $t)
Sets this transformation matrix to the specified value |
void |
setTranslateX (number $tx)
Sets the translation x element to the specified value |
void |
setTranslateY (number $ty)
Sets the translation y element to the specified value |
Sgss_Graphics_Transform |
shear (number $rx, number $ry)
Shears this transformation matrix |
array |
toArray ()
Converts this transformation matrix to an array |
Sgss_Graphics_Transform |
toReflection ([boolean $vert = false], [boolean $hori = false], [number $x = 0], [number $y = 0])
Sets this transformation matrix to the specified reflection transformation |
Sgss_Graphics_Transform |
toRotation (number $theta, [number $x = 0], [number $y = 0])
Sets this transformation matrix to the specified rotation transformation |
Sgss_Graphics_Transform |
toScale (number $sx, number $sy)
Sets this transformation matrix to the specified scaling transformation |
Sgss_Graphics_Transform |
toShear (number $rx, number $ry)
Sets this transformation matrix to the specified shearing transformation |
Sgss_Graphics_Transform |
toTranslation (number $tx, number $ty)
Sets this transformation matrix to the specified translation transformation |
array |
transform (number $x, number $y)
Transform the specified vector with this transformation matrix |
Sgss_Graphics_Transform |
translate (number $tx, number $ty)
Translates this transformation matrix |
mixed |
__get (mixed $name)
|
mixed |
__set (mixed $name, mixed $value)
|
string |
__toString ()
|
Shearing x element
protected number $_rx
Shearing y element
protected number $_ry
Scaling x element
protected number $_sx
Scaling y element
protected number $_sy
Translation x element
protected number $_tx
Translation y element
protected number $_ty
The constructor
number|array|Sgss_Graphics_Transform $sx
Scaling x element or a transformation matrix
number $rx
Shearing x element
number $tx
Translation x element
number $ry
Shearing y element
number $sy
Scaling y element
number $ty
Translation y element
public __construct ([number|array|Sgss_Graphics_Transform $sx = 1], [number $rx = 0], [number $tx = 0], [number $ry = 0], [number $sy = 1], [number $ty = 0])
Composites this transformation matrix with another
The resulting transformation matrix A' is equivalent to the following:
A' = A x T
where A denotes this transformation matrix and T denotes another.
number|array|Sgss_Graphics_Transform $sx
Scaling x element or a transformation matrix to be applied to this transformation matrix
number $rx
Shearing x element to be applied to this transformation matrix
number $tx
Translation x element to be applied to this transformation matrix
number $ry
Shearing y element to be applied to this transformation matrix
number $sy
Scaling y element to be applied to this transformation matrix
number $ty
Translation y element to be applied to this transformation matrix
public Sgss_Graphics_Transform composite (number|array|Sgss_Graphics_Transform $sx, [number $rx = 0], [number $tx = 0], [number $ry = 0], [number $sy = 1], [number $ty = 0])
Returns the composited transformation matrix with another
This is the same as composition() except the returned value is a new object.
number|array|Sgss_Graphics_Transform $sx
Scaling x element or transformation matrix to be applied to this transformation matrix
number $rx
Shearing x element to be applied to this transformation matrix
number $tx
Translation x element to be applied to this transformation matrix
number $ry
Shearing y element to be applied to this transformation matrix
number $sy
Scaling y element to be applied to this transformation matrix
number $ty
Translation y element to be applied to this transformation matrix
public Sgss_Graphics_Transform composition (number|array|Sgss_Graphics_Transform $sx, [number $rx = 0], [number $tx = 0], [number $ry = 0], [number $sy = 1], [number $ty = 0])
Creates an returns the specified reflection transformation matrix
The resulting transformation matrix A is equivalent to the following:
[ hori 0 x (1 - hori) ]
A = [ 0 vert y (1 - vert) ]
[ 0 0 1 ]where hori and vert denote -1 or 1 depending on whether the $vert and $hori are true or false.
boolean $vert
Wheter to reflect the resulting transformation matrix
boolean $hori
Wheter to reflect the resulting transformation matrix
number $x
Location of x axis along which the resulting transformation matrix to be refrected
number $y
Location of y axis along which the resulting transformation matrix to be refrected
public static Sgss_Graphics_Transform createReflection ([boolean $vert = false], [boolean $hori = false], [number $x = 0], [number $y = 0])
Creates an returns the specified rotation transformation matrix
The resulting transformation matrix A is equivalent to the following:
[ cos(r) -sin(r) x - x cos(r) + y sin(r) ]
A' = [ sin(r) cos(r) x - y cos(r) - x sin(r) ]
[ 0 0 1 ]where sin(r) and cos(r) denote the sine and cosine values of the $theta parameter.
number $theta
Rotation angle of the resulting transformation matrix in degree
number $x
X coordinate of the rotation center
number $y
Y coordinate of the rotation center
public static Sgss_Graphics_Transform createRotation (number $theta, [number $x = 0], [number $y = 0])
Creates an returns the specified scaling transformation matrix
The resulting transformation matrix A is equivalent to the following:
[ sx 0 0 ]
A' = [ 0 sy 0 ]
[ 0 0 1 ]
number $sx
Scaling x element of the resulting transformation matrix
number $sy
Scaling y element of the resulting transformation matrix
public static Sgss_Graphics_Transform createScale (number $sx, number $sy)
Creates an returns the specified shearing transformation matrix
The resulting transformation matrix A is equivalent to the following:
[ 1 rx 0 ]
A = [ ry 1 0 ]
[ 0 0 1 ]
number $rx
Shearing x element of the resulting transformation matrix
number $ry
Shearing y element of the resulting transformation matrix
public static Sgss_Graphics_Transform createShear (number $rx, number $ry)
Creates an returns the specified translation transformation matrix
The resulting transformation matrix A is equivalent to the following:
[ 1 0 tx ]
A = [ 0 1 ty ]
[ 0 0 1 ]
number $tx
Translation x element of the resulting transformation matrix
number $ty
Translation y element of the resulting transformation matrix
public static Sgss_Graphics_Transform createTranslation (number $tx, number $ty)
Returns the determinant of this matrix
The determinant is caluculated by the following formula:
| sx rx tx |
det(A) = | ry sy ty | = sx sy - rx ry
| 0 0 1 |where A denotes this transformation matrix.
public number determinant ()
Applies this transformation matrix to the specified ImagickDraw instance
Imagick|ImagickDraw $imagick
ImagickDraw instance
number $x
Offset x (ignored)
number $y
Offset y (ignored)
Draws to the specified ImagickDraw instance
public boolean drawImagick (Imagick|ImagickDraw $imagick, [number $x = 0], [number $y = 0])
Converts this transformation matrix to an array used with Imagick
Returned array takes the following form:
array('sx' => $sx, 'ry' => $rx, 'tx' => $tx,'rx' => $ry, 'sy' => $sy, 'ty' => $ty)Note that it seems not equivalent to the common naming of affine transformation matrix (rx and ry), but Imagick recognizes rx to be ry and vice versa. Probably because the y axis of the image is reversed to its apparance.
Returns the representation for the Imagick or ImagickDraw
public array getImagick ()
Returns the scaling x element
public number getScaleX ()
Returns the scaling y element
public number getScaleY ()
Returns the shearing x element
public number getShearX ()
Returns the shearing y element
public number getShearY ()
Returns another object representing this transformation matrix
public Sgss_Graphics_Transform getTransform ()
Returns the translation x element
public number getTranslateX ()
Returns the translation y element
public number getTranslateY ()
Returns the inversed transformation matrix
The resulting transformation matrix A' is equivalent to the following:
[ sy / det(A) -rx / det(A) (rx ty - sy tx) / det(A) ]
A' = [ -ry / det(A) sx / det(A) (ry tx - sx ty) / det(A) ]
[ 0 0 1 ]where A denotes this transformation matrix, and:
det(A) = sx sy - rx ry != 0
The A and A' are in the following relation:
A' x A = A x A' = I(3)
where I(3) denotes the 3x3 identity matrix.
When the determinant is 0
public Sgss_Graphics_Transform inverse ()
mixed $offset
public boolean offsetExists (mixed $offset)
mixed $offset
public mixed offsetGet (mixed $offset)
mixed $offset
mixed $value
public mixed offsetSet (mixed $offset, mixed $value)
mixed $offset
public void offsetUnset (mixed $offset)
Reflects this transformation matrix
The resulting transformation matrix A' is equivalent to the following:
[ hori 0 x (1 - hori) ]
A' = A x [ 0 vert y (1 - vert) ]
[ 0 0 1 ]where A denotes this transformation matrix, and hori and vert denote -1 or 1 depending on whether the $vert and $hori are true or false.
boolean $vert
Wheter to reflect this transformation matrix
boolean $hori
Wheter to reflect this transformation matrix
number $x
Location of x axis along which this transformation matrix to be refrected
number $y
Location of y axis along which this transformation matrix to be refrected
public Sgss_Graphics_Transform reflect ([boolean $vert = false], [boolean $hori = false], [number $x = 0], [number $y = 0])
Rotates this transformation matrix
The resulting transformation matrix A' is equivalent to the following:
[ cos(r) -sin(r) x - x cos(r) + y sin(r) ]
A' = A x [ sin(r) cos(r) x - y cos(r) - x sin(r) ]
[ 0 0 1 ]where A denotes this transformation matrix, and sin(r) and cos(r) denote the sine and cosine values of the $theta parameter.
number $theta
Rotation angle to be applied to this transformation matrix in degree
number $x
X coordinate of the rotation center
number $y
Y coordinate of the rotation center
public Sgss_Graphics_Transform rotate (number $theta, [number $x = 0], [number $y = 0])
Scales this transformation
The resulting transformation matrix A' is equivalent to the following:
[ sx 0 0 ]
A' = A x [ 0 sy 0 ]
[ 0 0 1 ]where A denotes this transformation matrix.
number $sx
Scaling x element to be applied to this transformation matrix
number $sy
Scaling y element to be applied to this transformation matrix
public Sgss_Graphics_Transform scale (number $sx, number $sy)
Sets the scaling x element to the specified value
number $sx
Scaling x element to set
public void setScaleX (number $sx)
Sets the scaling y element to the specified value
number $sy
Scaling y element to set
public void setScaleY (number $sy)
Sets the shearing x element to the specified value
number $rx
Shearing x element to set
public void setShearX (number $rx)
Sets the shearing y element to the specified value
number $ry
Shearing y element to set
public void setShearY (number $ry)
Sets this transformation matrix to the specified value
Sgss_Graphics_Transform $t
Transformation matrix to set
public void setTransform (Sgss_Graphics_Transform $t)
Sets the translation x element to the specified value
number $tx
Translation x element to set
public void setTranslateX (number $tx)
Sets the translation y element to the specified value
number $ty
Translation y element to set
public void setTranslateY (number $ty)
Shears this transformation matrix
The resulting transformation matrix A' is equivalent to the following:
[ 1 rx 0 ]
A' = A x [ ry 1 0 ]
[ 0 0 1 ]where A denotes this transformation matrix.
number $rx
Shearing x element to be applied to this transformation matrix
number $ry
Shearing y element to be applied to this transformation matrix
public Sgss_Graphics_Transform shear (number $rx, number $ry)
Converts this transformation matrix to an array
Returned array takes the following form:
array($sx, $rx, $tx,$ry, $sy, $ty)public array toArray ()
Sets this transformation matrix to the specified reflection transformation
The resulting transformation matrix A is equivalent to the following:
[ hori 0 x (1 - hori) ]
A = [ 0 vert y (1 - vert) ]
[ 0 0 1 ]where hori and vert denote -1 or 1 depending on whether the $vert and $hori are true or false.
boolean $vert
Wheter to reflect the resulting transformation matrix
boolean $hori
Wheter to reflect the resulting transformation matrix
number $x
Location of x axis along which the resulting transformation matrix to be refrected
number $y
Location of y axis along which the resulting transformation matrix to be refrected
public Sgss_Graphics_Transform toReflection ([boolean $vert = false], [boolean $hori = false], [number $x = 0], [number $y = 0])
Sets this transformation matrix to the specified rotation transformation
The resulting transformation matrix A is equivalent to the following:
[ cos(r) -sin(r) x - x cos(r) + y sin(r) ]
A' = [ sin(r) cos(r) x - y cos(r) - x sin(r) ]
[ 0 0 1 ]where sin(r) and cos(r) denote the sine and cosine values of the $theta parameter.
number $theta
Rotation angle to set in degree
number $x
X coordinate of the rotation center
number $y
Y coordinate of the rotation center
public Sgss_Graphics_Transform toRotation (number $theta, [number $x = 0], [number $y = 0])
Sets this transformation matrix to the specified scaling transformation
The resulting transformation matrix A is equivalent to the following:
[ sx 0 0 ]
A' = [ 0 sy 0 ]
[ 0 0 1 ]
number $sx
Scaling x element to set
number $sy
Scaling y element to set
public Sgss_Graphics_Transform toScale (number $sx, number $sy)
Sets this transformation matrix to the specified shearing transformation
The resulting transformation matrix A is equivalent to the following:
[ 1 rx 0 ]
A = [ ry 1 0 ]
[ 0 0 1 ]
number $rx
Shearing x element to set
number $ry
Shearing y element to set
public Sgss_Graphics_Transform toShear (number $rx, number $ry)
Sets this transformation matrix to the specified translation transformation
The resulting transformation matrix A is equivalent to the following:
[ 1 0 tx ]
A = [ 0 1 ty ]
[ 0 0 1 ]
number $tx
Translation x element to set
number $ty
Translation y element to set
public Sgss_Graphics_Transform toTranslation (number $tx, number $ty)
Transform the specified vector with this transformation matrix
The resulting vector (x', y') is equivalent to the following:
[ x'] [ x ]
[ y'] = [ y ] x A
[ 1 ] [ 1 ]where A denotes this transformation matrix.
number $x
X coodinate of the vector to be transformed
number $y
Y coodinate of the vector to be transformed
public array transform (number $x, number $y)
Translates this transformation matrix
The resulting transformation matrix A' is equivalent to the following:
[ 1 0 tx ]
A' = A x [ 0 1 ty ]
[ 0 0 1 ]where A denotes this transformation matrix.
number $tx
Translation x element to be applied to this transformation matrix
number $ty
Translation y element to be applied to this transformation matrix
public Sgss_Graphics_Transform translate (number $tx, number $ty)
mixed $name
public mixed __get (mixed $name)
mixed $name
mixed $value
public mixed __set (mixed $name, mixed $value)
public string __toString ()