org.w3c.dom.svg
Interface SVGMatrix


public interface SVGMatrix

This interface represents an "SVGMatrix" datatype, identified by an affine transform. It can be used to read and modify the values of transform attribute as per SVG specification. Note that the mTranslate, mMultiply, mScale and mRotate methods in this interface mutate the SVGMatrix object and return a reference to the SVGMatrix instance itself, after performing the necessary matrix operation.

This matrix transforms source coordinates (x, y) into destination coordinates (x', y') by considering them to be a column vector and multiplying the coordinate vector by the matrix according to the following process:

        [ x' ]    [  a  c  e  ]   [ x ]    [ a.x + c.y + e ]
        [ y' ] =  [  b  d  f  ]   [ y ] =  [ b.x + d.y + f ]
        [ 1  ]    [  0  0  1  ]   [ 1 ]    [        1      ]
  

Since:
BlackBerry API 4.6.0

Method Summary
 float getComponent(int index)
           Returns a component of the matrix by component's zero-based index.
 SVGMatrix inverse()
           Returns a new instance of SVGMatrix containing the inverse of the current matrix.
 SVGMatrix mMultiply(SVGMatrix secondMatrix)
           Performs matrix multiplication.
 SVGMatrix mRotate(float angle)
           Post-multiplies a rotation transformation on the current matrix and returns the resulting current matrix.
 SVGMatrix mScale(float scaleFactor)
           Post-multiplies a uniform scale transformation on the current matrix and returns the resulting current matrix.
 SVGMatrix mTranslate(float x, float y)
           Post-multiplies a translation transformation on the current matrix and returns the resulting current matrix.
 



Method Detail

getComponent

float getComponent(int index)
                   throws DOMException

Returns a component of the matrix by component's zero-based index. getComponent(0) is a, getComponent(1) is b, etc.

Parameters:
index - the index of the matrix component to retrieve.
Returns:
the component for the specified index.
Throws:
DOMException - INDEX_SIZE_ERR if the index is invalid.
Since:
BlackBerry API 4.6.0

mMultiply

SVGMatrix mMultiply(SVGMatrix secondMatrix)

Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting current matrix.

Parameters:
secondMatrix - the matrix to post-multiply with.
Returns:
the resulting current matrix after post-multiplication.
Throws:
NullPointerException - if secondMatrix is null.
Since:
BlackBerry API 4.6.0

inverse

SVGMatrix inverse()
                  throws SVGException

Returns a new instance of SVGMatrix containing the inverse of the current matrix.

Returns:
the inverse of the current matrix.
Throws:
SVGException - SVG_MATRIX_NOT_INVERTABLE when determinant of this matrix is zero.
Since:
BlackBerry API 4.6.0

mTranslate

SVGMatrix mTranslate(float x,
                     float y)

Post-multiplies a translation transformation on the current matrix and returns the resulting current matrix. This is equivalent to calling multiply(T), where T is an SVGMatrix object represented by the following matrix:

      [   1    0    x  ]
      [   0    1    y  ]
      [   0    0    1   ]
  

Parameters:
x - the distance by which coordinates are translated in the X axis direction.
y - the distance by which coordinates are translated in the Y axis direction.
Returns:
the resulting current matrix after post-multiplication.
Since:
BlackBerry API 4.6.0

mScale

SVGMatrix mScale(float scaleFactor)

Post-multiplies a uniform scale transformation on the current matrix and returns the resulting current matrix. This is equivalent to calling multiply(S), where S is an SVGMatrix object represented by the following matrix:

      [   scaleFactor      0          0   ]
      [   0          scaleFactor      0   ]
      [   0                0          1   ]
  

Parameters:
scaleFactor - the factor by which coordinates are scaled along the X and Y axis.
Returns:
the resulting current matrix after post-mutiplication.
Since:
BlackBerry API 4.6.0

mRotate

SVGMatrix mRotate(float angle)

Post-multiplies a rotation transformation on the current matrix and returns the resulting current matrix. This is equivalent to calling multiply(R), where R is an SVGMatrix object represented by the following matrix:

      [ cos(angle) -sin(angle) 0 ]
      [ sin(angle)  cos(angle) 0 ]
      [ 0           0          1 ]
  

Parameters:
angle - the angle of rotation in degrees.
Returns:
the resulting current matrix after post-multiplication.
Since:
BlackBerry API 4.6.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal