org.vectomatic.dom.svg
Class OMSVGTransform

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by org.vectomatic.dom.svg.OMSVGTransform

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.


Field Summary
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.
 
Constructor Summary
protected OMSVGTransform()
           
 
Method Summary
 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.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SVG_TRANSFORM_UNKNOWN

public static final short SVG_TRANSFORM_UNKNOWN
The unit type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.

See Also:
Constant Field Values

SVG_TRANSFORM_MATRIX

public static final short SVG_TRANSFORM_MATRIX
A 'matrix(…)' transformation.

See Also:
Constant Field Values

SVG_TRANSFORM_TRANSLATE

public static final short SVG_TRANSFORM_TRANSLATE
A 'translate(…)' transformation.

See Also:
Constant Field Values

SVG_TRANSFORM_SCALE

public static final short SVG_TRANSFORM_SCALE
A 'scale(…)' transformation.

See Also:
Constant Field Values

SVG_TRANSFORM_ROTATE

public static final short SVG_TRANSFORM_ROTATE
A 'rotate(…)' transformation.

See Also:
Constant Field Values

SVG_TRANSFORM_SKEWX

public static final short SVG_TRANSFORM_SKEWX
A 'skewX(…)' transformation.

See Also:
Constant Field Values

SVG_TRANSFORM_SKEWY

public static final short SVG_TRANSFORM_SKEWY
A 'skewY(…)' transformation.

See Also:
Constant Field Values
Constructor Detail

OMSVGTransform

protected OMSVGTransform()
Method Detail

getType

public final short getType()
The type of the value as specified by one of the SVG_TRANSFORM_ constants defined on this interface.


getMatrix

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.


getAngle

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.


setMatrix

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.

Parameters:
matrix - The new matrix for the transformation.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

setTranslate

public final void setTranslate(float tx,
                               float ty)
                        throws com.google.gwt.core.client.JavaScriptException
Sets the transform type to SVG_TRANSFORM_TRANSLATE, with parameters tx and ty defining the translation amounts.

Parameters:
tx - The translation amount in X.
ty - The translation amount in Y.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

setScale

public final void setScale(float sx,
                           float sy)
                    throws com.google.gwt.core.client.JavaScriptException
Sets the transform type to SVG_TRANSFORM_SCALE, with parameters sx and sy defining the scale amounts.

Parameters:
sx - The scale amount in X.
sy - The scale amount in Y.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

setRotate

public final void setRotate(float angle,
                            float cx,
                            float cy)
                     throws com.google.gwt.core.client.JavaScriptException
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.

Parameters:
angle - The rotation angle.
cx - The x coordinate of center of rotation.
cy - The y coordinate of center of rotation.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

setSkewX

public final void setSkewX(float angle)
                    throws com.google.gwt.core.client.JavaScriptException
Sets the transform type to SVG_TRANSFORM_SKEWX, with parameter angle defining the amount of skew.

Parameters:
angle - The skew angle.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

setSkewY

public final void setSkewY(float angle)
                    throws com.google.gwt.core.client.JavaScriptException
Sets the transform type to SVG_TRANSFORM_SKEWY, with parameter angle defining the amount of skew.

Parameters:
angle - The skew angle.
Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

getDescription

public final String getDescription()
Returns a textual description of the transform for debugging purposes.

Returns:
a textual description of the transform.

setScale

public final void setScale(float sx,
                           float sy,
                           float tx,
                           float ty)
                    throws com.google.gwt.core.client.JavaScriptException
Specifies a scaling transform around a center point. The resulting transform type is set to SVG_TRANSFORM_MATRIX.

Parameters:
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.
Throws:
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 © 2012. All Rights Reserved.