- All Known Implementing Classes:
AbstractSVGMatrix,SVGOMMatrix
public interface SVGMatrix
Many of SVG's graphics operations utilize 2x3 matrices of the form:
[a c e] [b d f]
which, when expanded into a 3x3 matrix for the purposes of matrix arithmetic, become:
[a c e] [b d f] [0 0 1]
-
Method Summary
Modifier and TypeMethodDescriptionflipX()Post-multiplies the transformation[-1 0 0 1 0 0]and returns the resulting matrix.flipY()Post-multiplies the transformation[1 0 0 -1 0 0]and returns the resulting matrix.floatgetA()floatgetB()floatgetC()floatgetD()floatgetE()floatgetF()inverse()Performs matrix multiplication.rotate(float angle) Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.rotateFromVector(float x, float y) Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.scale(float scaleFactor) Post-multiplies a uniform scale transformation on the current matrix and returns the resulting matrix.scaleNonUniform(float scaleFactorX, float scaleFactorY) Post-multiplies a non-uniform scale transformation on the current matrix and returns the resulting matrix.voidsetA(float a) Set theacomponent of the matrix.voidsetB(float b) Set thebcomponent of the matrix.voidsetC(float c) Set theccomponent of the matrix.voidsetD(float d) Set thedcomponent of the matrix.voidsetE(float e) Set theecomponent of the matrix.voidsetF(float f) Set thefcomponent of the matrix.skewX(float angle) Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.skewY(float angle) Post-multiplies a skewY transformation on the current matrix and returns the resulting matrix.translate(float x, float y) Post-multiplies a translation transformation on the current matrix and returns the resulting matrix.
-
Method Details
-
getA
float getA()- Returns:
- the
acomponent of the matrix.
-
setA
Set theacomponent of the matrix.- Parameters:
a- theacomponent of the matrix.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR on an attempt to change the value of a read only attribute.
-
getB
float getB()- Returns:
- the
bcomponent of the matrix.
-
setB
Set thebcomponent of the matrix.- Parameters:
b- thebcomponent of the matrix.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR on an attempt to change the value of a read only attribute.
-
getC
float getC()- Returns:
- the
ccomponent of the matrix.
-
setC
Set theccomponent of the matrix.- Parameters:
c- theccomponent of the matrix.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR on an attempt to change the value of a read only attribute.
-
getD
float getD()- Returns:
- the
dcomponent of the matrix.
-
setD
Set thedcomponent of the matrix.- Parameters:
d- thedcomponent of the matrix.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR on an attempt to change the value of a read only attribute.
-
getE
float getE()- Returns:
- the
ecomponent of the matrix.
-
setE
Set theecomponent of the matrix.- Parameters:
e- theecomponent of the matrix.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR on an attempt to change the value of a read only attribute.
-
getF
float getF()- Returns:
- the
fcomponent of the matrix.
-
setF
Set thefcomponent of the matrix.- Parameters:
f- thefcomponent of the matrix.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR on an attempt to change the value of a read only attribute.
-
multiply
Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting new matrix.- Parameters:
secondMatrix- the matrix which is post-multiplied to this matrix.- Returns:
- the resulting matrix.
-
inverse
- Returns:
- the inverse matrix.
- Throws:
SVGException- SVG_MATRIX_NOT_INVERTABLE if this matrix is not invertible.
-
translate
Post-multiplies a translation transformation on the current matrix and returns the resulting matrix.- Parameters:
x- the distance to translate along the x-axis.y- the distance to translate along the y-axis.- Returns:
- the resulting matrix.
-
scale
Post-multiplies a uniform scale transformation on the current matrix and returns the resulting matrix.- Parameters:
scaleFactor- the scale factor in both X and Y.- Returns:
- the resulting matrix.
-
scaleNonUniform
Post-multiplies a non-uniform scale transformation on the current matrix and returns the resulting matrix.- Parameters:
scaleFactorX- the scale factor in X.scaleFactorY- the scale factor in Y.- Returns:
- the resulting matrix.
-
rotate
Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.- Parameters:
angle- the rotation angle.- Returns:
- the resulting matrix.
-
rotateFromVector
Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix. The rotation angle is determined by taking(+/-) atan(y/x). The direction of the vector(x, y)determines whether the positive or negative angle value is used.- Parameters:
x- the X coordinate of the vector(x, y). Must not be zero.y- the Y coordinate of the vector(x, y). Must not be zero.- Returns:
- the resulting matrix.
- Throws:
SVGException- SVG_INVALID_VALUE_ERR if one of the parameters is an invalid value.
-
flipX
SVGMatrix flipX()Post-multiplies the transformation[-1 0 0 1 0 0]and returns the resulting matrix.- Returns:
- the resulting matrix.
-
flipY
SVGMatrix flipY()Post-multiplies the transformation[1 0 0 -1 0 0]and returns the resulting matrix.- Returns:
- the resulting matrix.
-
skewX
Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.- Parameters:
angle- the skew angle.- Returns:
- the resulting matrix.
-
skewY
Post-multiplies a skewY transformation on the current matrix and returns the resulting matrix.- Parameters:
angle- the skew angle.- Returns:
- the resulting matrix.
-