Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Google Inc.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy of
   * the License at
   * 
   * http://www.apache.org/licenses/LICENSE-2.0
   * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and limitations under
  * the License.
  */
 package elemental.svg;
 
 
 import java.util.Date;

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]

An SVGMatrix object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.

 
 public interface SVGMatrix {
 
   double getA();
 
   void setA(double arg);
 
   double getB();
 
   void setB(double arg);
 
   double getC();
 
   void setC(double arg);
 
   double getD();
 
   void setD(double arg);
 
   double getE();
 
   void setE(double arg);
 
   double getF();
 
   void setF(double arg);


  
Post-multiplies the transformation [-1 0 0 1 0 0] and returns the resulting matrix.
 
   SVGMatrix flipX();


  
Post-multiplies the transformation [1 0 0 -1 0 0] and returns the resulting matrix.
 
   SVGMatrix flipY();


  

Return the inverse matrix

Exceptions:

  • a DOMException with code SVG_MATRIX_NOT_INVERTABLE is raised if the matrix is not invertable.
 
   SVGMatrix inverse();


  
Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting new matrix.
 
   SVGMatrix multiply(SVGMatrix secondMatrix);


  
Post-multiplies a rotation transformation on the current matrix and returns the resulting matrix.
 
   SVGMatrix rotate(float angle);


  

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.

Exceptions:

  • a DOMException with code SVG_INVALID_VALUE_ERR is raised if one of the parameters has an invalid value.
 
  SVGMatrix rotateFromVector(float xfloat y);


  
Post-multiplies a uniform scale transformation on the current matrix and returns the resulting matrix.
  SVGMatrix scale(float scaleFactor);


  
Post-multiplies a non-uniform scale transformation on the current matrix and returns the resulting matrix.
  SVGMatrix scaleNonUniform(float scaleFactorXfloat scaleFactorY);


  
Post-multiplies a skewX transformation on the current matrix and returns the resulting matrix.
  SVGMatrix skewX(float angle);


  
Post-multiplies a skewY transformation on the current matrix and returns the resulting matrix.
  SVGMatrix skewY(float angle);


  
Post-multiplies a translation transformation on the current matrix and returns the resulting matrix.
  SVGMatrix translate(float xfloat y);
New to GrepCode? Check out our FAQ X