java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.dom.DOMMatrixReadOnly
- 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
- Direct Known Subclasses:
DOMMatrix
A JavaScript object for
DOMMatrixReadOnly.- 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_CONSTFields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
isSealedFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DOMMatrixCreates a newDOMMatrixwith the values of this matrix.flipX()Returns a new matrix being the result of the original matrix flipped about the x-axis.flipY()Returns a new matrix being the result of the original matrix flipped about the y-axis.static DOMMatrixReadOnlyfromFloat32ArrayReadOnly(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 newDOMMatrixReadOnlyfrom the given Float32Array with 6 (2D) or 16 (3D) values.static DOMMatrixReadOnlyfromFloat64ArrayReadOnly(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 newDOMMatrixReadOnlyfrom the given Float64Array with 6 (2D) or 16 (3D) values.static DOMMatrixReadOnlyfromMatrixReadOnly(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 newDOMMatrixReadOnlyfrom the given matrix or matrix properties.protected static DOMMatrixReadOnlyfromTypedArray(Object[] args, Class<? extends org.htmlunit.corejs.javascript.typedarrays.NativeTypedArrayView<?>> type, String methodName, String className) Converts the first argument (a typed array of the given type with 6 or 16 values) into a matrix.doublegetA()Returns theaproperty.doublegetB()Returns thebproperty.doublegetC()Returns thecproperty.doublegetD()Returns thedproperty.getDefaultValue(Class<?> hint) Returns the JavaScript default value of this object.doublegetE()Returns theeproperty.doublegetF()Returns thefproperty.booleanReturns whether this matrix is the identity matrix.doublegetM11()Returns them11property.doublegetM12()Returns them12property.doublegetM13()Returns them13property.doublegetM14()Returns them14property.doublegetM21()Returns them21property.doublegetM22()Returns them22property.doublegetM23()Returns them23property.doublegetM24()Returns them24property.doublegetM31()Returns them31property.doublegetM32()Returns them32property.doublegetM33()Returns them33property.doublegetM34()Returns them34property.doublegetM41()Returns them41property.doublegetM42()Returns them42property.doublegetM43()Returns them43property.doublegetM44()Returns them44property.protected double[]Returns the values of this matrix in column-major order (m11, m12, m13, m14, m21, ..., m44).protected voidinit(Object[] args, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Function ctorObj) Initializes this matrix from the constructor arguments.inverse()Returns a new matrix which is the inverse of the original matrix.protected voidInverts this matrix.booleanisIs2D()Returns theis2Dproperty.Returns the values of the matrix as a CSS transform function string.static DOMMatrixReadOnlyjsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr) JavaScript constructor.Returns a new matrix which is the dot product of the matrix and the given matrix.protected voidPost-multiplies this matrix with the given one (this = this * other).protected static <T extends DOMMatrixReadOnly>
TnewInstance(T matrix, org.htmlunit.corejs.javascript.VarScope scope, String className, DOMMatrixReadOnly values) Initializes the given new matrix object with the scope, the prototype and the values.protected voidPre-multiplies this matrix with the given one (this = other * this).Returns a new matrix rotated by the specified angles.rotateAxisAngle(Object x, Object y, Object z, Object angle) Returns a new matrix rotated by a given angle around the specified axis.protected voidrotateAxisAngleSelfInternal(double x, double y, double z, double angle) Rotates this matrix by the given angle around the specified axis.rotateFromVector(Object x, Object y) Returns a new matrix rotated by the angle between the specified vector and (1, 0).protected voidrotateFromVectorSelfInternal(double x, double y) Rotates this matrix by the angle between the specified vector and (1, 0).protected voidrotateSelfInternal(double rotX, double rotY, double rotZ) Rotates this matrix around the z-axis, then around the y-axis and finally around the x-axis.protected voidrotateSelfInternal(Object rotXObj, Object rotYObj, Object rotZObj) Applies the rotation ofrotate(Object, Object, Object)to this matrix.Returns a new matrix scaled by the given factors, centered on the given origin.Returns a new matrix scaled by the given factor for all three axes, centered on the given origin.protected voidscale3dSelfInternal(double scale, double originX, double originY, double originZ) Applies a uniform scaling of all three axes centered on the given origin to this matrix.scaleNonUniform(Object scaleX, Object scaleY) Returns a new matrix scaled by the given factors for the x- and the y-axis.protected voidscaleSelfInternal(double scaleX, double scaleY, double scaleZ, double originX, double originY, double originZ) Applies a scaling centered on the given origin to this matrix.voidsetIs2D(boolean is2D) Sets theis2Dproperty.voidsetM11(double m11) Sets them11property.voidsetM12(double m12) Sets them12property.voidsetM13(double m13) Sets them13property.voidsetM14(double m14) Sets them14property.voidsetM21(double m21) Sets them21property.voidsetM22(double m22) Sets them22property.voidsetM23(double m23) Sets them23property.voidsetM24(double m24) Sets them24property.voidsetM31(double m31) Sets them31property.voidsetM32(double m32) Sets them32property.voidsetM33(double m33) Sets them33property.voidsetM34(double m34) Sets them34property.voidsetM41(double m41) Sets them41property.voidsetM42(double m42) Sets them42property.voidsetM43(double m43) Sets them43property.voidsetM44(double m44) Sets them44property.protected voidsetTransformList(String transformList) Parses the given CSS transform list and replaces the values of this matrix with the result.protected voidsetValues(double[] values, boolean is2D) Sets all values of this matrix.protected voidsetValues2D(double a, double b, double c, double d, double e, double f) Sets this to the 2D matrix [a, b, c, d, e, f]; all other values are set to the values of the identity matrix.Returns a new matrix skewed along the x-axis by the specified angle.protected voidskewXSelfInternal(double sx) Skews this matrix along the x-axis.Returns a new matrix skewed along the y-axis by the specified angle.protected voidskewYSelfInternal(double sy) Skews this matrix along the y-axis.protected static doubleConverts the given JavaScript value into a double;undefined(or a missing argument) is converted to the given default value.org.htmlunit.corejs.javascript.typedarrays.NativeFloat32ArrayReturns a new Float32Array containing all 16 elements of the matrix.org.htmlunit.corejs.javascript.typedarrays.NativeFloat64ArrayReturns a new Float64Array containing all 16 elements of the matrix.org.htmlunit.corejs.javascript.ScriptabletoJSON()Returns a JSON representation of the DOMMatrixReadOnly object.transformPoint(Object point) Transforms the given point with this matrix.Creates a new matrix being the result of the original matrix with a translation applied.protected voidtranslateSelfInternal(double tx, double ty, double tz) Applies a translation to this matrix.Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, createDOMException, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getIds, getIndexedPropertyCount, getOwnPropertyDescriptor, getPrototype, getScriptableFor, getWindow, getWindow, getWindowOrWorkerGlobalScope, getWithPreemption, has, hasInstance, isIndexedPropertyWritable, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setupPromise, setupRejectedPromiseMethods 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, sizeMethods 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, writeMapsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.Scriptable
get, getIds, has, hasMethods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable
get, has
-
Constructor Details
-
DOMMatrixReadOnly
public DOMMatrixReadOnly()Ctor.
-
-
Method Details
-
jsConstructor
public static DOMMatrixReadOnly 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 contextscope- the scopeargs- the arguments to the DOMMatrixReadOnly constructorctorObj- the function objectinNewExpr-trueif invoked with thenewoperator- Returns:
- the Java object that JavaScript can access
-
init
protected void init(Object[] args, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Function ctorObj) Initializes this matrix from the constructor arguments.- no argument or
undefined: the identity matrix - an iterable object (e.g. an array or a typed array): a sequence of 6 (2D) or 16 (3D) numbers
- everything else is converted to a string and parsed as CSS transform list; this is only supported in a window, workers throw a TypeError
- Parameters:
args- the constructor argumentsscope- the scopectorObj- the constructor function
- no argument or
-
setTransformList
Parses the given CSS transform list and replaces the values of this matrix with the result.- Parameters:
transformList- the CSS transform list
-
getM11
public double getM11()Returns them11property.- Returns:
- the
m11property
-
setM11
public void setM11(double m11) Sets them11property.- Parameters:
m11- the new value
-
getA
public double getA()Returns theaproperty.- Returns:
- the
aproperty
-
getM12
public double getM12()Returns them12property.- Returns:
- the
m12property
-
setM12
public void setM12(double m12) Sets them12property.- Parameters:
m12- the new value
-
getB
public double getB()Returns thebproperty.- Returns:
- the
bproperty
-
getM13
public double getM13()Returns them13property.- Returns:
- the
m13property
-
setM13
public void setM13(double m13) Sets them13property.- Parameters:
m13- the new value
-
getM14
public double getM14()Returns them14property.- Returns:
- the
m14property
-
setM14
public void setM14(double m14) Sets them14property.- Parameters:
m14- the new value
-
getM21
public double getM21()Returns them21property.- Returns:
- the
m21property
-
setM21
public void setM21(double m21) Sets them21property.- Parameters:
m21- the new value
-
getC
public double getC()Returns thecproperty.- Returns:
- the
cproperty
-
getM22
public double getM22()Returns them22property.- Returns:
- the
m22property
-
setM22
public void setM22(double m22) Sets them22property.- Parameters:
m22- the new value
-
getD
public double getD()Returns thedproperty.- Returns:
- the
dproperty
-
getM23
public double getM23()Returns them23property.- Returns:
- the
m23property
-
setM23
public void setM23(double m23) Sets them23property.- Parameters:
m23- the new value
-
getM24
public double getM24()Returns them24property.- Returns:
- the
m24property
-
setM24
public void setM24(double m24) Sets them24property.- Parameters:
m24- the new value
-
getM31
public double getM31()Returns them31property.- Returns:
- the
m31property
-
setM31
public void setM31(double m31) Sets them31property.- Parameters:
m31- the new value
-
getM32
public double getM32()Returns them32property.- Returns:
- the
m32property
-
setM32
public void setM32(double m32) Sets them32property.- Parameters:
m32- the new value
-
getM33
public double getM33()Returns them33property.- Returns:
- the
m33property
-
setM33
public void setM33(double m33) Sets them33property.- Parameters:
m33- the new value
-
getM34
public double getM34()Returns them34property.- Returns:
- the
m34property
-
setM34
public void setM34(double m34) Sets them34property.- Parameters:
m34- the new value
-
getM41
public double getM41()Returns them41property.- Returns:
- the
m41property
-
setM41
public void setM41(double m41) Sets them41property.- Parameters:
m41- the new value
-
getE
public double getE()Returns theeproperty.- Returns:
- the
eproperty
-
getM42
public double getM42()Returns them42property.- Returns:
- the
m42property
-
setM42
public void setM42(double m42) Sets them42property.- Parameters:
m42- the new value
-
getF
public double getF()Returns thefproperty.- Returns:
- the
fproperty
-
getM43
public double getM43()Returns them43property.- Returns:
- the
m43property
-
setM43
public void setM43(double m43) Sets them43property.- Parameters:
m43- the new value
-
getM44
public double getM44()Returns them44property.- Returns:
- the
m44property
-
setM44
public void setM44(double m44) Sets them44property.- Parameters:
m44- the new value
-
isIs2D
public boolean isIs2D()Returns theis2Dproperty.- Returns:
- the
is2Dproperty
-
setIs2D
public void setIs2D(boolean is2D) Sets theis2Dproperty.- Parameters:
is2D- the new value
-
getIsIdentity
public boolean getIsIdentity()Returns whether this matrix is the identity matrix.- Returns:
- true if m12 element, m13 element, m14 element, m21 element, m23 element, m24 element, m31 element, m32 element, m34 element, m41 element, m42 element, m43 element are 0 or -0 and m11 element, m22 element, m33 element, m44 element are 1. Otherwise it returns false.
-
flipX
Returns a new matrix being the result of the original matrix flipped about the x-axis.- Returns:
- a new matrix being the result of the original matrix flipped about the x-axis. This is equivalent to multiplying the matrix by DOMMatrix(-1, 0, 0, 1, 0, 0). The original matrix is not modified.
-
flipY
Returns a new matrix being the result of the original matrix flipped about the y-axis.- Returns:
- a new matrix being the result of the original matrix flipped about the y-axis. This is equivalent to multiplying the matrix by DOMMatrix(1, 0, 0, -1, 0, 0). The original matrix is not modified.
-
inverse
Returns a new matrix which is the inverse of the original matrix.- Returns:
- new matrix which is the inverse of the original matrix. If the matrix cannot be inverted, the new matrix's components are all set to NaN and its is2D property is set to false. The original matrix is not changed.
-
multiply
Returns a new matrix which is the dot product of the matrix and the given matrix.- Parameters:
other- the matrix to multiply with this matrix; this can be a matrix or an object with matrix properties (DOMMatrixInit);nullandundefinedare treated as identity matrix- Returns:
- a new matrix which is the dot product of the matrix and the other matrix. The original matrix is not modified.
-
rotate
Returns a new matrix rotated 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 degreesrotZ- the rotation angle around the z-axis in degrees- Returns:
- a new matrix which is the result of the original matrix rotated by the specified angles. The original matrix is not modified.
-
rotateFromVector
Returns a new matrix rotated by the angle between the specified vector and (1, 0).- Parameters:
x- the x component of the vectory- the y component of the vector- Returns:
- a new matrix which is the result of the original matrix rotated by the angle of the vector. The original matrix is not modified.
-
rotateAxisAngle
Returns a new matrix rotated by a given angle around the specified axis.- Parameters:
x- the x component of the axisy- the y component of the axisz- the z component of the axisangle- the rotation angle in degrees- Returns:
- a new matrix which is the result of the original matrix rotated around the axis. The original matrix is not modified.
-
scale
public DOMMatrix scale(Object scaleX, Object scaleY, Object scaleZ, Object originX, Object originY, Object originZ) Returns a new matrix scaled 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:
- a new matrix which is the result of the original matrix scaled. The original matrix is not modified.
-
scale3d
Returns a new matrix scaled by the given factor for all three axes, 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:
- a new matrix which is the result of the original matrix scaled. The original matrix is not modified.
-
scaleNonUniform
Returns a new matrix scaled by the given factors for the x- and the y-axis. This method is deprecated; usescale(Object, Object, Object, Object, Object, Object).- Parameters:
scaleX- the scale factor for the x-axis (default 1)scaleY- the scale factor for the y-axis (default 1)- Returns:
- a new matrix which is the result of the original matrix scaled. The original matrix is not modified.
-
skewX
Returns a new matrix skewed along the x-axis by the specified angle.- Parameters:
sx- the angle, in degrees, by which to skew the matrix along the x-axis- Returns:
- returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its x-axis. The original matrix is not modified.
-
skewY
Returns a new matrix skewed along the y-axis by the specified angle.- Parameters:
sy- the angle, in degrees, by which to skew the matrix along the y-axis- Returns:
- returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its y-axis. The original matrix is not modified.
-
translate
Creates a new matrix being the result of the original matrix with a translation applied.- 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 resulting matrix will be 3D- Returns:
- a new matrix being the result of the matrix being translated by the given vector. The original matrix is not modified.
-
transformPoint
Transforms the given point with this matrix.- Parameters:
point- the point to transform; this can be a point or an object with point properties (DOMPointInit: x, y, z (default 0) and w (default 1));nullandundefinedare treated as the point (0, 0, 0, 1)- Returns:
- a new
DOMPointwith the transformed coordinates
-
multiplySelfInternal
Post-multiplies this matrix with the given one (this = this * other). The result is 2D if both matrices are 2D.- Parameters:
other- the matrix to multiply with
-
preMultiplySelfInternal
Pre-multiplies this matrix with the given one (this = other * this). The result is 2D if both matrices are 2D.- Parameters:
other- the matrix to multiply with
-
translateSelfInternal
protected void translateSelfInternal(double tx, double ty, double tz) Applies a translation to this matrix.- Parameters:
tx- the x component of the translating vectorty- the y component of the translating vectortz- the z component of the translating vector
-
scaleSelfInternal
protected void scaleSelfInternal(double scaleX, double scaleY, double scaleZ, double originX, double originY, double originZ) Applies a scaling centered on the given origin to this matrix.- Parameters:
scaleX- the scale factor for the x-axisscaleY- the scale factor for the y-axisscaleZ- the scale factor for the z-axisoriginX- the x-coordinate of the originoriginY- the y-coordinate of the originoriginZ- the z-coordinate of the origin
-
scale3dSelfInternal
protected void scale3dSelfInternal(double scale, double originX, double originY, double originZ) Applies a uniform scaling of all three axes centered on the given origin to this matrix.- Parameters:
scale- the scale factororiginX- the x-coordinate of the originoriginY- the y-coordinate of the originoriginZ- the z-coordinate of the origin
-
rotateSelfInternal
Applies the rotation ofrotate(Object, Object, Object)to this matrix.- Parameters:
rotXObj- the rotation angle around the x-axis in degrees (or the rotation angle around the z-axis if this is the only argument)rotYObj- the rotation angle around the y-axis in degreesrotZObj- the rotation angle around the z-axis in degrees
-
rotateSelfInternal
protected void rotateSelfInternal(double rotX, double rotY, double rotZ) Rotates this matrix 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 degreesrotY- the rotation angle around the y-axis in degreesrotZ- the rotation angle around the z-axis in degrees
-
rotateFromVectorSelfInternal
protected void rotateFromVectorSelfInternal(double x, double y) Rotates this matrix by the angle between the specified vector and (1, 0).- Parameters:
x- the x component of the vectory- the y component of the vector
-
rotateAxisAngleSelfInternal
protected void rotateAxisAngleSelfInternal(double x, double y, double z, double angle) Rotates this matrix by the given angle around the specified axis. An axis of (0, 0, 0) does not change the matrix.- Parameters:
x- the x component of the axisy- the y component of the axisz- the z component of the axisangle- the rotation angle in degrees
-
skewXSelfInternal
protected void skewXSelfInternal(double sx) Skews this matrix along the x-axis.- Parameters:
sx- the angle in degrees
-
skewYSelfInternal
protected void skewYSelfInternal(double sy) Skews this matrix along the y-axis.- Parameters:
sy- the angle in degrees
-
invertSelfInternal
protected void invertSelfInternal()Inverts this matrix. If the matrix cannot be inverted, all values are set to NaN and the matrix is no longer 2D. -
copyToDOMMatrix
Creates a newDOMMatrixwith the values of this matrix.- Returns:
- the new matrix
-
getValues
protected double[] getValues()Returns the values of this matrix in column-major order (m11, m12, m13, m14, m21, ..., m44).- Returns:
- a new array with the 16 values
-
setValues
protected void setValues(double[] values, boolean is2D) Sets all values of this matrix.- Parameters:
values- the 16 values in column-major order (m11, m12, m13, m14, m21, ..., m44)is2D- the new value of the is2D flag
-
setValues2D
protected void setValues2D(double a, double b, double c, double d, double e, double f) Sets this to the 2D matrix [a, b, c, d, e, f]; all other values are set to the values of the identity matrix.- Parameters:
a- the a (m11) valueb- the b (m12) valuec- the c (m21) valued- the d (m22) valuee- the e (m41) valuef- the f (m42) value
-
toDouble
Converts the given JavaScript value into a double;undefined(or a missing argument) is converted to the given default value.- Parameters:
value- the valuedefaultValue- the default value- Returns:
- the double value
-
toFloat32Array
public org.htmlunit.corejs.javascript.typedarrays.NativeFloat32Array toFloat32Array()Returns a new Float32Array containing all 16 elements of the matrix.- Returns:
- a new Float32Array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix. The elements are stored into the array as single-precision floating-point numbers in column-major (colexographical access, or "colex") order. (In other words, down the first column from top to bottom, then the second column, and so forth.)
-
toFloat64Array
public org.htmlunit.corejs.javascript.typedarrays.NativeFloat64Array toFloat64Array()Returns a new Float64Array containing all 16 elements of the matrix.- Returns:
- a new Float64Array containing all 16 elements (m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) which comprise the matrix. The elements are stored into the array as single-precision floating-point numbers in column-major (colexographical access, or "colex") order. (In other words, down the first column from top to bottom, then the second column, and so forth.)
-
js_toString
Returns the values of the matrix as a CSS transform function string.- Returns:
- the values of the list separated by commas, within matrix() or matrix3d() function syntax.
-
getDefaultValue
Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. The string representation (also used for the conversion of a matrix into a string, e.g. when passing a matrix to the constructor) is the CSS transform function.- Specified by:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein classHtmlUnitScriptable- Parameters:
hint- a hint as to the format of the default value (ignored in this case)- Returns:
- the default value
-
toJSON
public org.htmlunit.corejs.javascript.Scriptable toJSON()Returns a JSON representation of the DOMMatrixReadOnly object.- Returns:
- a JSON representation of the DOMMatrixReadOnly object
-
fromMatrixReadOnly
public static DOMMatrixReadOnly fromMatrixReadOnly(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 newDOMMatrixReadOnlyfrom the given matrix or matrix properties.- Parameters:
cx- the current contextscope- the scopethisObj- the scriptable this objectargs- the arguments; the first one is the matrix or an object with matrix properties (DOMMatrixInit)funObj- the function object- Returns:
- the new matrix
-
fromFloat32ArrayReadOnly
public static DOMMatrixReadOnly fromFloat32ArrayReadOnly(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 newDOMMatrixReadOnlyfrom the given Float32Array with 6 (2D) or 16 (3D) values.- Parameters:
cx- the current contextscope- the scopethisObj- the scriptable this objectargs- the arguments; the first one is the Float32ArrayfunObj- the function object- Returns:
- the new matrix
-
fromFloat64ArrayReadOnly
public static DOMMatrixReadOnly fromFloat64ArrayReadOnly(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 newDOMMatrixReadOnlyfrom the given Float64Array with 6 (2D) or 16 (3D) values.- Parameters:
cx- the current contextscope- the scopethisObj- the scriptable this objectargs- the arguments; the first one is the Float64ArrayfunObj- the function object- Returns:
- the new matrix
-
newInstance
protected static <T extends DOMMatrixReadOnly> T newInstance(T matrix, org.htmlunit.corejs.javascript.VarScope scope, String className, DOMMatrixReadOnly values) Initializes the given new matrix object with the scope, the prototype and the values.- Type Parameters:
T- the matrix type- Parameters:
matrix- the new matrix objectscope- the scopeclassName- the JavaScript class name used to find the prototypevalues- the matrix to copy the values from- Returns:
- the given matrix
-
fromTypedArray
protected static DOMMatrixReadOnly fromTypedArray(Object[] args, Class<? extends org.htmlunit.corejs.javascript.typedarrays.NativeTypedArrayView<?>> type, String methodName, String className) Converts the first argument (a typed array of the given type with 6 or 16 values) into a matrix.- Parameters:
args- the argumentstype- the expected typed array typemethodName- the name of the calling method for the error messageclassName- the name of the calling class for the error message- Returns:
- a new matrix (without scope)
-