public class OMSVGTransform
extends com.google.gwt.core.client.JavaScriptObject
OMSVGTransform
is the interface for one
of the component transformations within an OMSVGTransformList
;
thus, an OMSVGTransform
object corresponds
to a single component (e.g., 'scale(…)'
or 'matrix(…)') within a transform
attribute specification.Modifier and Type | Field and Description |
---|---|
static short |
SVG_TRANSFORM_MATRIX
A 'matrix(…)' transformation.
|
static short |
SVG_TRANSFORM_ROTATE
A 'rotate(…)' transformation.
|
static short |
SVG_TRANSFORM_SCALE
A 'scale(…)' transformation.
|
static short |
SVG_TRANSFORM_SKEWX
A 'skewX(…)' transformation.
|
static short |
SVG_TRANSFORM_SKEWY
A 'skewY(…)' transformation.
|
static short |
SVG_TRANSFORM_TRANSLATE
A 'translate(…)' transformation.
|
static short |
SVG_TRANSFORM_UNKNOWN
The unit type is not one of predefined types.
|
Modifier | Constructor and Description |
---|---|
protected |
OMSVGTransform() |
Modifier and Type | Method and Description |
---|---|
float |
getAngle()
A convenience attribute for SVG_TRANSFORM_ROTATE, SVG_TRANSFORM_SKEWX
and SVG_TRANSFORM_SKEWY.
|
String |
getDescription()
Returns a textual description of the transform for debugging purposes.
|
OMSVGMatrix |
getMatrix()
The matrix that represents this transformation.
|
short |
getType()
The type of the value as specified by one of the SVG_TRANSFORM_ constants
defined on this interface.
|
void |
setMatrix(OMSVGMatrix matrix)
Sets the transform type to SVG_TRANSFORM_MATRIX, with parameter matrix defining the new transformation. |
void |
setRotate(float angle,
float cx,
float cy)
Sets the transform type to SVG_TRANSFORM_ROTATE, with parameter angle
defining the rotation angle and parameters cx and cy
defining the optional center of rotation.
|
void |
setScale(float sx,
float sy)
Sets the transform type to SVG_TRANSFORM_SCALE, with parameters sx
and sy defining the scale amounts.
|
void |
setScale(float sx,
float sy,
float tx,
float ty)
Specifies a scaling transform around a center point.
|
void |
setSkewX(float angle)
Sets the transform type to SVG_TRANSFORM_SKEWX, with parameter angle
defining the amount of skew.
|
void |
setSkewY(float angle)
Sets the transform type to SVG_TRANSFORM_SKEWY, with parameter angle
defining the amount of skew.
|
void |
setTranslate(float tx,
float ty)
Sets the transform type to SVG_TRANSFORM_TRANSLATE, with parameters tx
and ty defining the translation amounts.
|
public static final short SVG_TRANSFORM_UNKNOWN
public static final short SVG_TRANSFORM_MATRIX
public static final short SVG_TRANSFORM_TRANSLATE
public static final short SVG_TRANSFORM_SCALE
public static final short SVG_TRANSFORM_ROTATE
public static final short SVG_TRANSFORM_SKEWX
public static final short SVG_TRANSFORM_SKEWY
public final short getType()
public final OMSVGMatrix getMatrix()
The matrix that represents this transformation. The matrix object is live, meaning that any changes made to the SVGTransform object are immediately reflected in the matrix object and vice versa. In case the matrix object is changed directly (i.e., without using the methods on the SVGTransform interface itself) then the type of the SVGTransform changes to SVG_TRANSFORM_MATRIX.
OMSVGMatrix.getA()
, OMSVGMatrix.getB()
,
OMSVGMatrix.getC()
, OMSVGMatrix.getD()
,
OMSVGMatrix.getE()
, OMSVGMatrix.getF()
values supplied by the user.OMSVGMatrix.getE()
and OMSVGMatrix.getF()
represent the translation amounts (OMSVGMatrix.getA()
=1,
OMSVGMatrix.getB()
=0, OMSVGMatrix.getC()
=0
and OMSVGMatrix.getD()
=1).OMSVGMatrix.getA()
and OMSVGMatrix.getD()
represent the translation
amounts (OMSVGMatrix.getB()
=0, OMSVGMatrix.getC()
=0,
OMSVGMatrix.getE()
=0 and OMSVGMatrix.getF()
=0).OMSVGMatrix.getA()
, OMSVGMatrix.getB()
,
OMSVGMatrix.getC()
and OMSVGMatrix.getD()
represent the matrix which will result in the given transformation (OMSVGMatrix.getE()
=0 and OMSVGMatrix.getF()
=0).public final float getAngle()
A convenience attribute for SVG_TRANSFORM_ROTATE, SVG_TRANSFORM_SKEWX and SVG_TRANSFORM_SKEWY. It holds the angle that was specified.
For
SVG_TRANSFORM_MATRIX, SVG_TRANSFORM_TRANSLATE and SVG_TRANSFORM_SCALE,
getAngle()
will be zero.
public final void setMatrix(OMSVGMatrix matrix) throws com.google.gwt.core.client.JavaScriptException
Sets the transform type to SVG_TRANSFORM_MATRIX, with parameter matrix defining the new transformation. The values from the parameter matrix are copied, the matrix parameter does not replace SVGTransform::matrix.
matrix
- The new matrix for the transformation.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final void setTranslate(float tx, float ty) throws com.google.gwt.core.client.JavaScriptException
tx
- The translation amount in X.ty
- The translation amount in Y.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final void setScale(float sx, float sy) throws com.google.gwt.core.client.JavaScriptException
sx
- The scale amount in X.sy
- The scale amount in Y.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final void setRotate(float angle, float cx, float cy) throws com.google.gwt.core.client.JavaScriptException
angle
- The rotation angle.cx
- The x coordinate of center of rotation.cy
- The y coordinate of center of rotation.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final void setSkewX(float angle) throws com.google.gwt.core.client.JavaScriptException
angle
- The skew angle.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final void setSkewY(float angle) throws com.google.gwt.core.client.JavaScriptException
angle
- The skew angle.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
public final String getDescription()
public final void setScale(float sx, float sy, float tx, float ty) throws com.google.gwt.core.client.JavaScriptException
sx
- The scale amount in X.sy
- The scale amount in Y.tx
- The X coordinate of the scaling center.ty
- The Y coordinate of the scaling center.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- Raised on an attempt
to change the value of a read only
attribute.com.google.gwt.core.client.JavaScriptException
Copyright © 2018. All Rights Reserved.