The following interfaces are defined below: SVGPoint, SVGMatrix, SVGTransformList, SVGAnimatedTransformList, SVGTransform, SVGPreserveAspectRatio, SVGAnimatedPreserveAspectRatio.


Interface SVGPoint

Many of the SVG DOM interfaces refer to objects of class SVGPoint. An SVGPoint is an (x,y) coordinate pair. When used in matrix operations, an SVGPoint is treated as a vector of the form:

[x]
[y]
[1]

IDL Definition
interface SVGPoint { 

           attribute float x;
                       // raises DOMException on setting
           attribute float y;
                       // raises DOMException on setting

  SVGPoint matrixTransform ( in SVGMatrix matrix );
};

Attributes
float x
The x coordinate.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
float y
The y coordinate.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
Methods
matrixTransform

Applies a 2x3 matrix transformation on this SVGPoint object and returns a new, transformed SVGPoint object:

newpoint = matrix * thispoint
Parameters
in SVGMatrix matrix The matrix which is to be applied to this SVGPoint object.
Return value
SVGPoint A new SVGPoint object.
No Exceptions

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]

IDL Definition
interface SVGMatrix { 

           attribute float a;
                       // raises DOMException on setting
           attribute float b;
                       // raises DOMException on setting
           attribute float c;
                       // raises DOMException on setting
           attribute float d;
                       // raises DOMException on setting
           attribute float e;
                       // raises DOMException on setting
           attribute float f;
                       // raises DOMException on setting

  SVGMatrix multiply ( in SVGMatrix secondMatrix );
  SVGMatrix inverse (  )
                  raises( SVGException );
  SVGMatrix translate ( in float x, in float y );
  SVGMatrix scale ( in float scaleFactor );
  SVGMatrix scaleNonUniform ( in float scaleFactorX, in float scaleFactorY );
  SVGMatrix rotate ( in float angle );
  SVGMatrix rotateFromVector ( in float x, in float y )
                  raises( SVGException );
  SVGMatrix flipX (  );
  SVGMatrix flipY (  );
  SVGMatrix skewX ( in float angle );
  SVGMatrix skewY ( in float angle );
};

Attributes
float a
The a component of the matrix.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
float b
The b component of the matrix.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
float c
The c component of the matrix.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
float d
The d component of the matrix.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
float e
The e component of the matrix.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
float f
The f component of the matrix.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
Methods
multiply
Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting new matrix.
Parameters
in SVGMatrix secondMatrix The matrix which is post-multiplied to this matrix.
Return value
SVGMatrix The resulting matrix.
No Exceptions
inverse
Returns the inverse matrix.
No Parameters
Return value
SVGMatrix The inverse matrix.
Exceptions
SVGException
SVG_MATRIX_NOT_INVERTABLE: Raised if this matrix is not invertable.
translate
Post-multiplies a translation transformation on the current matrix and returns the resulting matrix.
Parameters
in float x The distance to translate along the X axis.
in float y The distance to translate along the Y axis.
Return value
SVGMatrix The resulting matrix.
No Exceptions
scale
Post-multiplies a uniform scale transformation on the current matrix and returns the resulting matrix.
Parameters
in float scaleFactor Scale factor in both X and Y.
Return value
SVGMatrix The resulting matrix.
No Exceptions
scaleNonUniform
Post-multiplies a non-uniform scale transformation on the current matrix and returns the resulting matrix.
Parameters
in float scaleFactorX Scale factor in X.
in float scaleFactorY Scale factor in Y.
Return value
SVGMatrix The resulting matrix.
No Exceptions
rotate
Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.
Parameters
in float angle Rotation angle.
Return value
SVGMatrix The resulting matrix.
No Exceptions
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
in float x The X coordinate of the vector (x,y). Must not be zero.
in float y The Y coordinate of the vector (x,y). Must not be zero.
Return value
SVGMatrix The resulting matrix.
Exceptions
SVGException
SVG_INVALID_VALUE_ERR: Raised if one of the parameters has an invalid value.
flipX
Post-multiplies the transformation [-1 0 0 1 0 0] and returns the resulting matrix.
No Parameters
Return value
SVGMatrix The resulting matrix.
No Exceptions
flipY
Post-multiplies the transformation [1 0 0 -1 0 0] and returns the resulting matrix.
No Parameters
Return value
SVGMatrix The resulting matrix.
No Exceptions
skewX
Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.
Parameters
in float angle Skew angle.
Return value
SVGMatrix The resulting matrix.
No Exceptions
skewY
Post-multiplies a skewY transformation on the current matrix and returns the resulting matrix.
Parameters
in float angle Skew angle.
Return value
SVGMatrix The resulting matrix.
No Exceptions

Interface SVGTransformList

SVGTransformList maintains an ordered list of SVGTransform objects. The SVGTransformList and SVGTransform interfaces correspond to the various attributes which specify a set of transformations, such as the transform attribute which is available for many of SVG's elements.

The various methods inherited from SVGList, which are defined in SVGList to accept parameters and return values of type Object, must receive parameters of type SVGTransform and return values of type SVGTransform.


IDL Definition
interface SVGTransformList : SVGList { 
  SVGTransform createSVGTransformFromMatrix ( in SVGMatrix matrix );
  SVGTransform consolidate (  );
};

Methods
createSVGTransformFromMatrix
Creates an SVGTransform object which is initialized to transform of type SVG_TRANSFORM_MATRIX and whose values are the given matrix.
Parameters
in SVGMatrix matrix The matrix which defines the transformation.
Return value
SVGTransform The returned SVGTransform object.
No Exceptions
consolidate
Consolidates the list of separate SVGTransform objects by multiplying the equivalent transformation matrices together to result in a list consisting of a single SVGTransform object of type SVG_TRANSFORM_MATRIX.
No Parameters
Return value
SVGTransform The resulting SVGTransform object which becomes single item in the list. If the list was empty, then a value of null is returned.
No Exceptions

Interface SVGAnimatedTransformList

Used for the various attributes which specify a set of transformations, such as the transform attribute which is available for many of SVG's elements, and which can be animated.

IDL Definition
interface SVGAnimatedTransformList { 

           attribute SVGTransformList baseVal;
                       // raises DOMException on setting
  readonly attribute SVGTransformList animVal;
};

Attributes
SVGTransformList baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
readonly SVGTransformList animVal
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as 'baseVal'.

Interface SVGTransform

SVGTransform is the interface for one of the component transformations within a SVGTransformList; thus, a SVGTransform object corresponds to single component (e.g., "scale(..)" or "matrix(...)") within a transform attribute specification.


IDL Definition
interface SVGTransform { 

  // Transform Types
  const unsigned short SVG_TRANSFORM_UNKNOWN   = 0;
  const unsigned short SVG_TRANSFORM_MATRIX    = 1;
  const unsigned short SVG_TRANSFORM_TRANSLATE = 2;
  const unsigned short SVG_TRANSFORM_SCALE     = 3;
  const unsigned short SVG_TRANSFORM_ROTATE    = 4;
  const unsigned short SVG_TRANSFORM_SKEWX     = 5;
  const unsigned short SVG_TRANSFORM_SKEWY     = 6;

  readonly attribute unsigned short type;
  readonly attribute SVGMatrix matrix;
  readonly attribute float angle;

  void setMatrix ( in SVGMatrix matrix );
  void setTranslate ( in float tx, in float ty );
  void setScale ( in float sx, in float sy );
  void setRotate ( in float angle, in float cx, in float cy );
  void setSkewX ( in float angle );
  void setSkewY ( in float angle );
};

Definition group Transform Types
Defined constants
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.
SVG_TRANSFORM_MATRIX A "matrix(...)" transformation.
SVG_TRANSFORM_TRANSLATE A "translate(...)" transformation.
SVG_TRANSFORM_SCALE A "scale(...)" transformation.
SVG_TRANSFORM_ROTATE A "rotate(...)" transformation.
SVG_TRANSFORM_SKEWX A "skewX(...)" transformation.
SVG_TRANSFORM_SKEWY A "skewY(...)" transformation.
Attributes
readonly unsigned short type
The type of the value as specified by one of the constants specified above.
readonly SVGMatrix matrix
The matrix that represents this transformation.
For SVG_TRANSFORM_MATRIX, the matrix contains the a, b, c, d, e, f values supplied by the user.
For SVG_TRANSFORM_TRANSLATE, e and f represents the translation amounts (a=1,b=0,c=0,d=1).
For SVG_TRANSFORM_SCALE, a and d represents the scale amounts (b=0,c=0,e=0,f=0).
For SVG_TRANSFORM_ROTATE, SVG_TRANSFORM_SKEWX and SVG_TRANSFORM_SKEWY, a, b, c and d represent the matrix which will result in the given transformation (e=0,f=0).
readonly float angle
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, angle will be zero.
Methods
setMatrix
Sets the transform type to SVG_TRANSFORM_MATRIX, with parameter matrix defining the new transformation.
Parameters
in SVGMatrix matrix The new matrix for the transformation.
No Return Value
No Exceptions
setTranslate
Sets the transform type to SVG_TRANSFORM_TRANSLATE, with parameters tx and ty defining the translation amounts.
Parameters
in float tx The translation amount in X.
in float ty The translation amount in Y.
No Return Value
No Exceptions
setScale
Sets the transform type to SVG_TRANSFORM_SCALE, with parameters sx and sy defining the scale amounts.
Parameters
in float sx The scale factor in X.
in float sy The scale factor in Y.
No Return Value
No Exceptions
setRotate
Sets the transform type to SVG_TRANSFORM_ROTATE, with parameter angle defining the rotation angle and parameters cx and cy defining the optional centre of rotation.
Parameters
in float angle The rotation angle.
in float cx The x coordinate of centre of rotation.
in float cy The y coordinate of centre of rotation.
No Return Value
No Exceptions
setSkewX
Sets the transform type to SVG_TRANSFORM_SKEWX, with parameter angle defining the amount of skew.
Parameters
in float angle The skew angle.
No Return Value
No Exceptions
setSkewY
Sets the transform type to SVG_TRANSFORM_SKEWY, with parameter angle defining the amount of skew.
Parameters
in float angle The skew angle.
No Return Value
No Exceptions

Interface SVGPreserveAspectRatio

The SVGPreserveAspectRatio interface corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements.


IDL Definition
interface SVGPreserveAspectRatio { 

  // Alignment Types
  const unsigned short SVG_PRESERVEASPECTRATIO_UNKNOWN   = 0;
  const unsigned short SVG_PRESERVEASPECTRATIO_NONE     = 1;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMIN = 2;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMID = 5;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMID = 6;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMID = 7;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMAX = 8;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9;
  const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10;
  // Meet-or-slice Types
  const unsigned short SVG_MEETORSLICE_UNKNOWN   = 0;
  const unsigned short SVG_MEETORSLICE_MEET  = 1;
  const unsigned short SVG_MEETORSLICE_SLICE = 2;

           attribute unsigned short align;
                       // raises DOMException on setting
           attribute unsigned short meetOrSlice;
                       // raises DOMException on setting
};

Definition group Alignment Types
Defined constants
SVG_PRESERVEASPECTRATIO_UNKNOWN The enumeration was set to a value that 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.
SVG_PRESERVEASPECTRATIO_NONE Corresponds to value 'none' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMIN Corresponds to value 'xMinYMin' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMIN Corresponds to value 'xMidYMin' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMIN Corresponds to value 'xMaxYMin' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMID Corresponds to value 'xMinYMid' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMID Corresponds to value 'xMidYMid' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMID Corresponds to value 'xMaxYMid' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMAX Corresponds to value 'xMinYMax' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMAX Corresponds to value 'xMidYMax' for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMAX Corresponds to value 'xMaxYMax' for attribute preserveAspectRatio.
Definition group Meet-or-slice Types
Defined constants
SVG_MEETORSLICE_UNKNOWN The enumeration was set to a value that 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.
SVG_MEETORSLICE_MEET Corresponds to value 'meet' for attribute preserveAspectRatio.
SVG_MEETORSLICE_SLICE Corresponds to value 'slice' for attribute preserveAspectRatio.
Attributes
unsigned short align
The type of the alignment value as specified by one of the constants specified above.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
unsigned short meetOrSlice
The type of the meet-or-slice value as specified by one of the constants specified above.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

Interface SVGAnimatedPreserveAspectRatio

Used for attributes of type SVGPreserveAspectRatio which can be animated.

IDL Definition
interface SVGAnimatedPreserveAspectRatio { 

           attribute SVGPreserveAspectRatio baseVal;
                       // raises DOMException on setting
  readonly attribute SVGPreserveAspectRatio animVal;
};

Attributes
SVGPreserveAspectRatio baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
readonly SVGPreserveAspectRatio animVal
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as 'baseVal'.