Module org.htmlunit

Class DOMMatrix

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class DOMMatrix extends DOMMatrixReadOnly
A JavaScript object for DOMMatrix.
Author:
Ahmed Ashour, Ronald Brill
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, LEGACY_CONST, PERMANENT, READONLY, STRICTLY_READONLY, UNINITIALIZED_CONST

    Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    isSealed

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static DOMMatrix
    fromFloat32Array(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Creates a new DOMMatrix from the given Float32Array with 6 (2D) or 16 (3D) values.
    static DOMMatrix
    fromFloat64Array(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Creates a new DOMMatrix from the given Float64Array with 6 (2D) or 16 (3D) values.
    static DOMMatrix
    fromMatrix(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Creates a new DOMMatrix from the given matrix or matrix properties.
    double
    Returns the a property.
    double
    Returns the b property.
    double
    Returns the c property.
    double
    Returns the d property.
    double
    Returns the e property.
    double
    Returns the f property.
    double
    Returns the m11 property.
    double
    Returns the m12 property.
    double
    Returns the m13 property.
    double
    Returns the m14 property.
    double
    Returns the m21 property.
    double
    Returns the m22 property.
    double
    Returns the m23 property.
    double
    Returns the m24 property.
    double
    Returns the m31 property.
    double
    Returns the m32 property.
    double
    Returns the m33 property.
    double
    Returns the m34 property.
    double
    Returns the m41 property.
    double
    Returns the m42 property.
    double
    Returns the m43 property.
    double
    Returns the m44 property.
    Inverts this matrix.
    static DOMMatrix
    jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
    JavaScript constructor.
    Post-multiplies this matrix with the given one (this = this * other).
    Pre-multiplies this matrix with the given one (this = other * this).
    Rotates this matrix by the given angle around the specified axis.
    Rotates this matrix by the angle between the specified vector and (1, 0).
    rotateSelf(Object rotX, Object rotY, Object rotZ)
    Rotates this matrix by the specified angles.
    scale3dSelf(Object scale, Object originX, Object originY, Object originZ)
    Scales all three axes of this matrix by the given factor, centered on the given origin.
    scaleSelf(Object scaleX, Object scaleY, Object scaleZ, Object originX, Object originY, Object originZ)
    Scales this matrix by the given factors, centered on the given origin.
    void
    setA(double a)
    Sets the a property.
    void
    setB(double b)
    Sets the b property.
    void
    setC(double c)
    Sets the c property.
    void
    setD(double d)
    Sets the d property.
    void
    setE(double e)
    Sets the e property.
    void
    setF(double f)
    Sets the f property.
    void
    setM11(double m11)
    Sets the m11 property.
    void
    setM12(double m12)
    Sets the m12 property.
    void
    setM13(double m13)
    Sets the m13 property.
    void
    setM14(double m14)
    Sets the m14 property.
    void
    setM21(double m21)
    Sets the m21 property.
    void
    setM22(double m22)
    Sets the m22 property.
    void
    setM23(double m23)
    Sets the m23 property.
    void
    setM24(double m24)
    Sets the m24 property.
    void
    setM31(double m31)
    Sets the m31 property.
    void
    setM32(double m32)
    Sets the m32 property.
    void
    setM33(double m33)
    Sets the m33 property.
    void
    setM34(double m34)
    Sets the m34 property.
    void
    setM41(double m41)
    Sets the m41 property.
    void
    setM42(double m42)
    Sets the m42 property.
    void
    setM43(double m43)
    Sets the m43 property.
    void
    setM44(double m44)
    Sets the m44 property.
    setMatrixValue(String transformList)
    Replaces the values of this matrix with the matrix described by the given CSS transform list (e.g.
    Skews this matrix along the x-axis by the specified angle.
    Skews this matrix along the y-axis by the specified angle.
    Applies a translation to this matrix.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Constructor Details

    • DOMMatrix

      public DOMMatrix()
  • Method Details

    • jsConstructor

      public static DOMMatrix jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
      JavaScript constructor.
      Parameters:
      cx - the current context
      scope - the scope
      args - the arguments to the WebSocket constructor
      ctorObj - the function object
      inNewExpr - Is new or not
      Returns:
      the java object to allow JavaScript to access
    • getM11

      public double getM11()
      Returns the m11 property.
      Overrides:
      getM11 in class DOMMatrixReadOnly
      Returns:
      the m11 property
    • setM11

      public void setM11(double m11)
      Sets the m11 property.
      Overrides:
      setM11 in class DOMMatrixReadOnly
      Parameters:
      m11 - the new value
    • getM12

      public double getM12()
      Returns the m12 property.
      Overrides:
      getM12 in class DOMMatrixReadOnly
      Returns:
      the m12 property
    • setM12

      public void setM12(double m12)
      Sets the m12 property.
      Overrides:
      setM12 in class DOMMatrixReadOnly
      Parameters:
      m12 - the new value
    • getM13

      public double getM13()
      Returns the m13 property.
      Overrides:
      getM13 in class DOMMatrixReadOnly
      Returns:
      the m13 property
    • setM13

      public void setM13(double m13)
      Sets the m13 property.
      Overrides:
      setM13 in class DOMMatrixReadOnly
      Parameters:
      m13 - the new value
    • getM14

      public double getM14()
      Returns the m14 property.
      Overrides:
      getM14 in class DOMMatrixReadOnly
      Returns:
      the m14 property
    • setM14

      public void setM14(double m14)
      Sets the m14 property.
      Overrides:
      setM14 in class DOMMatrixReadOnly
      Parameters:
      m14 - the new value
    • getM21

      public double getM21()
      Returns the m21 property.
      Overrides:
      getM21 in class DOMMatrixReadOnly
      Returns:
      the m21 property
    • setM21

      public void setM21(double m21)
      Sets the m21 property.
      Overrides:
      setM21 in class DOMMatrixReadOnly
      Parameters:
      m21 - the new value
    • getM22

      public double getM22()
      Returns the m22 property.
      Overrides:
      getM22 in class DOMMatrixReadOnly
      Returns:
      the m22 property
    • setM22

      public void setM22(double m22)
      Sets the m22 property.
      Overrides:
      setM22 in class DOMMatrixReadOnly
      Parameters:
      m22 - the new value
    • getM23

      public double getM23()
      Returns the m23 property.
      Overrides:
      getM23 in class DOMMatrixReadOnly
      Returns:
      the m23 property
    • setM23

      public void setM23(double m23)
      Sets the m23 property.
      Overrides:
      setM23 in class DOMMatrixReadOnly
      Parameters:
      m23 - the new value
    • getM24

      public double getM24()
      Returns the m24 property.
      Overrides:
      getM24 in class DOMMatrixReadOnly
      Returns:
      the m24 property
    • setM24

      public void setM24(double m24)
      Sets the m24 property.
      Overrides:
      setM24 in class DOMMatrixReadOnly
      Parameters:
      m24 - the new value
    • getM31

      public double getM31()
      Returns the m31 property.
      Overrides:
      getM31 in class DOMMatrixReadOnly
      Returns:
      the m31 property
    • setM31

      public void setM31(double m31)
      Sets the m31 property.
      Overrides:
      setM31 in class DOMMatrixReadOnly
      Parameters:
      m31 - the new value
    • getM32

      public double getM32()
      Returns the m32 property.
      Overrides:
      getM32 in class DOMMatrixReadOnly
      Returns:
      the m32 property
    • setM32

      public void setM32(double m32)
      Sets the m32 property.
      Overrides:
      setM32 in class DOMMatrixReadOnly
      Parameters:
      m32 - the new value
    • getM33

      public double getM33()
      Returns the m33 property.
      Overrides:
      getM33 in class DOMMatrixReadOnly
      Returns:
      the m33 property
    • setM33

      public void setM33(double m33)
      Sets the m33 property.
      Overrides:
      setM33 in class DOMMatrixReadOnly
      Parameters:
      m33 - the new value
    • getM34

      public double getM34()
      Returns the m34 property.
      Overrides:
      getM34 in class DOMMatrixReadOnly
      Returns:
      the m34 property
    • setM34

      public void setM34(double m34)
      Sets the m34 property.
      Overrides:
      setM34 in class DOMMatrixReadOnly
      Parameters:
      m34 - the new value
    • getM41

      public double getM41()
      Returns the m41 property.
      Overrides:
      getM41 in class DOMMatrixReadOnly
      Returns:
      the m41 property
    • setM41

      public void setM41(double m41)
      Sets the m41 property.
      Overrides:
      setM41 in class DOMMatrixReadOnly
      Parameters:
      m41 - the new value
    • getM42

      public double getM42()
      Returns the m42 property.
      Overrides:
      getM42 in class DOMMatrixReadOnly
      Returns:
      the m42 property
    • setM42

      public void setM42(double m42)
      Sets the m42 property.
      Overrides:
      setM42 in class DOMMatrixReadOnly
      Parameters:
      m42 - the new value
    • getM43

      public double getM43()
      Returns the m43 property.
      Overrides:
      getM43 in class DOMMatrixReadOnly
      Returns:
      the m43 property
    • setM43

      public void setM43(double m43)
      Sets the m43 property.
      Overrides:
      setM43 in class DOMMatrixReadOnly
      Parameters:
      m43 - the new value
    • getM44

      public double getM44()
      Returns the m44 property.
      Overrides:
      getM44 in class DOMMatrixReadOnly
      Returns:
      the m44 property
    • setM44

      public void setM44(double m44)
      Sets the m44 property.
      Overrides:
      setM44 in class DOMMatrixReadOnly
      Parameters:
      m44 - the new value
    • getA

      public double getA()
      Returns the a property.
      Overrides:
      getA in class DOMMatrixReadOnly
      Returns:
      the a property
    • setA

      public void setA(double a)
      Sets the a property.
      Parameters:
      a - the new value
    • getB

      public double getB()
      Returns the b property.
      Overrides:
      getB in class DOMMatrixReadOnly
      Returns:
      the b property
    • setB

      public void setB(double b)
      Sets the b property.
      Parameters:
      b - the new value
    • getC

      public double getC()
      Returns the c property.
      Overrides:
      getC in class DOMMatrixReadOnly
      Returns:
      the c property
    • setC

      public void setC(double c)
      Sets the c property.
      Parameters:
      c - the new value
    • getD

      public double getD()
      Returns the d property.
      Overrides:
      getD in class DOMMatrixReadOnly
      Returns:
      the d property
    • setD

      public void setD(double d)
      Sets the d property.
      Parameters:
      d - the new value
    • getE

      public double getE()
      Returns the e property.
      Overrides:
      getE in class DOMMatrixReadOnly
      Returns:
      the e property
    • setE

      public void setE(double e)
      Sets the e property.
      Parameters:
      e - the new value
    • getF

      public double getF()
      Returns the f property.
      Overrides:
      getF in class DOMMatrixReadOnly
      Returns:
      the f property
    • setF

      public void setF(double f)
      Sets the f property.
      Parameters:
      f - the new value
    • invertSelf

      public DOMMatrix invertSelf()
      Inverts this matrix. If the matrix cannot be inverted, the components are all set to NaN and its is2D property is set to false.
      Returns:
      this matrix, inverted
    • multiplySelf

      public DOMMatrix multiplySelf(Object other)
      Post-multiplies this matrix with the given one (this = this * other).
      Parameters:
      other - the matrix to multiply with; this can be a matrix or an object with matrix properties (DOMMatrixInit); null and undefined are treated as identity matrix
      Returns:
      this matrix
    • preMultiplySelf

      public DOMMatrix preMultiplySelf(Object other)
      Pre-multiplies this matrix with the given one (this = other * this).
      Parameters:
      other - the matrix to multiply with; this can be a matrix or an object with matrix properties (DOMMatrixInit); null and undefined are treated as identity matrix
      Returns:
      this matrix
    • translateSelf

      public DOMMatrix translateSelf(Object tx, Object ty, Object tz)
      Applies a translation to this matrix.
      Parameters:
      tx - the x component of the translating vector (default 0)
      ty - the y component of the translating vector (default 0)
      tz - the z component of the translating vector (default 0); if this is anything other than 0, the matrix will be 3D
      Returns:
      this matrix
    • scaleSelf

      public DOMMatrix scaleSelf(Object scaleX, Object scaleY, Object scaleZ, Object originX, Object originY, Object originZ)
      Scales this matrix by the given factors, centered on the given origin.
      Parameters:
      scaleX - the scale factor for the x-axis (default 1)
      scaleY - the scale factor for the y-axis (default scaleX)
      scaleZ - the scale factor for the z-axis (default 1)
      originX - the x-coordinate of the origin (default 0)
      originY - the y-coordinate of the origin (default 0)
      originZ - the z-coordinate of the origin (default 0)
      Returns:
      this matrix
    • scale3dSelf

      public DOMMatrix scale3dSelf(Object scale, Object originX, Object originY, Object originZ)
      Scales all three axes of this matrix by the given factor, centered on the given origin.
      Parameters:
      scale - the scale factor (default 1)
      originX - the x-coordinate of the origin (default 0)
      originY - the y-coordinate of the origin (default 0)
      originZ - the z-coordinate of the origin (default 0)
      Returns:
      this matrix
    • rotateSelf

      public DOMMatrix rotateSelf(Object rotX, Object rotY, Object rotZ)
      Rotates this matrix by the specified angles. If only one argument is given, this is the rotation angle around the z-axis (a 2D rotation), otherwise the matrix is rotated around the z-axis, then around the y-axis and finally around the x-axis.
      Parameters:
      rotX - the rotation angle around the x-axis in degrees (or the rotation angle around the z-axis if this is the only argument)
      rotY - the rotation angle around the y-axis in degrees
      rotZ - the rotation angle around the z-axis in degrees
      Returns:
      this matrix
    • rotateFromVectorSelf

      public DOMMatrix rotateFromVectorSelf(Object x, Object y)
      Rotates this matrix by the angle between the specified vector and (1, 0).
      Parameters:
      x - the x component of the vector (default 0)
      y - the y component of the vector (default 0)
      Returns:
      this matrix
    • rotateAxisAngleSelf

      public DOMMatrix rotateAxisAngleSelf(Object x, Object y, Object z, Object angle)
      Rotates this matrix by the given angle around the specified axis.
      Parameters:
      x - the x component of the axis (default 0)
      y - the y component of the axis (default 0)
      z - the z component of the axis (default 0)
      angle - the rotation angle in degrees (default 0)
      Returns:
      this matrix
    • skewXSelf

      public DOMMatrix skewXSelf(Object sx)
      Skews this matrix along the x-axis by the specified angle.
      Parameters:
      sx - the angle in degrees (default 0)
      Returns:
      this matrix
    • skewYSelf

      public DOMMatrix skewYSelf(Object sy)
      Skews this matrix along the y-axis by the specified angle.
      Parameters:
      sy - the angle in degrees (default 0)
      Returns:
      this matrix
    • setMatrixValue

      public DOMMatrix setMatrixValue(String transformList)
      Replaces the values of this matrix with the matrix described by the given CSS transform list (e.g. "translate(10px, 20px) rotate(45deg)").
      Parameters:
      transformList - the CSS transform list
      Returns:
      this matrix
    • fromMatrix

      public static DOMMatrix fromMatrix(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Creates a new DOMMatrix from the given matrix or matrix properties.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - the scriptable this object
      args - the arguments; the first one is the matrix or an object with matrix properties (DOMMatrixInit)
      funObj - the function object
      Returns:
      the new matrix
    • fromFloat32Array

      public static DOMMatrix fromFloat32Array(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Creates a new DOMMatrix from the given Float32Array with 6 (2D) or 16 (3D) values.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - the scriptable this object
      args - the arguments; the first one is the Float32Array
      funObj - the function object
      Returns:
      the new matrix
    • fromFloat64Array

      public static DOMMatrix fromFloat64Array(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Creates a new DOMMatrix from the given Float64Array with 6 (2D) or 16 (3D) values.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - the scriptable this object
      args - the arguments; the first one is the Float64Array
      funObj - the function object
      Returns:
      the new matrix