|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 ]
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 |
---|
float getComponent(int index) throws DOMException
getComponent(0)
is a, getComponent(1)
is b, etc.
index
- the index of the matrix component to retrieve.
DOMException
- - INDEX_SIZE_ERR if the index
is invalid.SVGMatrix mMultiply(SVGMatrix secondMatrix)
secondMatrix
- the matrix to post-multiply with.
java.lang.NullPointerException
- - if secondMatrix is null.SVGMatrix inverse() throws SVGException
SVGException
- - SVG_MATRIX_NOT_INVERTABLE when determinant of this matrix is zero.SVGMatrix mTranslate(float x, float y)
multiply(T)
, where T
is an
SVGMatrix
object represented by the following
matrix:
[ 1 0 x ] [ 0 1 y ] [ 0 0 1 ]
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.
SVGMatrix mScale(float scaleFactor)
multiply(S)
, where S
is an SVGMatrix
object represented by the following matrix:
[ scaleFactor 0 0 ] [ 0 scaleFactor 0 ] [ 0 0 1 ]
scaleFactor
- the factor by which coordinates are scaled along the
X and Y axis.
SVGMatrix mRotate(float angle)
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 ]
angle
- the angle of rotation in degrees.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |