1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * http://dev.w3.org/fxtf/geometry/ 8 * 9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C 10 * liability, trademark and document use rules apply. 11 */ 12 13[Pref="layout.css.DOMMatrix.enabled", 14 Constructor(optional (DOMString or sequence<unrestricted double>) init)] 15interface DOMMatrixReadOnly { 16 // These attributes are simple aliases for certain elements of the 4x4 matrix 17 readonly attribute unrestricted double a; 18 readonly attribute unrestricted double b; 19 readonly attribute unrestricted double c; 20 readonly attribute unrestricted double d; 21 readonly attribute unrestricted double e; 22 readonly attribute unrestricted double f; 23 24 readonly attribute unrestricted double m11; 25 readonly attribute unrestricted double m12; 26 readonly attribute unrestricted double m13; 27 readonly attribute unrestricted double m14; 28 readonly attribute unrestricted double m21; 29 readonly attribute unrestricted double m22; 30 readonly attribute unrestricted double m23; 31 readonly attribute unrestricted double m24; 32 readonly attribute unrestricted double m31; 33 readonly attribute unrestricted double m32; 34 readonly attribute unrestricted double m33; 35 readonly attribute unrestricted double m34; 36 readonly attribute unrestricted double m41; 37 readonly attribute unrestricted double m42; 38 readonly attribute unrestricted double m43; 39 readonly attribute unrestricted double m44; 40 41 // Immutable transform methods 42 DOMMatrix translate(unrestricted double tx, 43 unrestricted double ty, 44 optional unrestricted double tz = 0); 45 DOMMatrix scale(unrestricted double scale, 46 optional unrestricted double originX = 0, 47 optional unrestricted double originY = 0); 48 DOMMatrix scale3d(unrestricted double scale, 49 optional unrestricted double originX = 0, 50 optional unrestricted double originY = 0, 51 optional unrestricted double originZ = 0); 52 DOMMatrix scaleNonUniform(unrestricted double scaleX, 53 optional unrestricted double scaleY = 1, 54 optional unrestricted double scaleZ = 1, 55 optional unrestricted double originX = 0, 56 optional unrestricted double originY = 0, 57 optional unrestricted double originZ = 0); 58 DOMMatrix rotate(unrestricted double angle, 59 optional unrestricted double originX = 0, 60 optional unrestricted double originY = 0); 61 DOMMatrix rotateFromVector(unrestricted double x, 62 unrestricted double y); 63 DOMMatrix rotateAxisAngle(unrestricted double x, 64 unrestricted double y, 65 unrestricted double z, 66 unrestricted double angle); 67 DOMMatrix skewX(unrestricted double sx); 68 DOMMatrix skewY(unrestricted double sy); 69 DOMMatrix multiply(DOMMatrix other); 70 DOMMatrix flipX(); 71 DOMMatrix flipY(); 72 DOMMatrix inverse(); 73 74 // Helper methods 75 readonly attribute boolean is2D; 76 readonly attribute boolean isIdentity; 77 DOMPoint transformPoint(optional DOMPointInit point); 78 [Throws] Float32Array toFloat32Array(); 79 [Throws] Float64Array toFloat64Array(); 80 stringifier; 81 [Default] object toJSON(); 82}; 83 84[Pref="layout.css.DOMMatrix.enabled", 85 Constructor, 86 Constructor(DOMString transformList), 87 Constructor(DOMMatrixReadOnly other), 88 Constructor(Float32Array array32), 89 Constructor(Float64Array array64), 90 Constructor(sequence<unrestricted double> numberSequence)] 91interface DOMMatrix : DOMMatrixReadOnly { 92 // These attributes are simple aliases for certain elements of the 4x4 matrix 93 inherit attribute unrestricted double a; 94 inherit attribute unrestricted double b; 95 inherit attribute unrestricted double c; 96 inherit attribute unrestricted double d; 97 inherit attribute unrestricted double e; 98 inherit attribute unrestricted double f; 99 100 inherit attribute unrestricted double m11; 101 inherit attribute unrestricted double m12; 102 inherit attribute unrestricted double m13; 103 inherit attribute unrestricted double m14; 104 inherit attribute unrestricted double m21; 105 inherit attribute unrestricted double m22; 106 inherit attribute unrestricted double m23; 107 inherit attribute unrestricted double m24; 108 inherit attribute unrestricted double m31; 109 inherit attribute unrestricted double m32; 110 inherit attribute unrestricted double m33; 111 inherit attribute unrestricted double m34; 112 inherit attribute unrestricted double m41; 113 inherit attribute unrestricted double m42; 114 inherit attribute unrestricted double m43; 115 inherit attribute unrestricted double m44; 116 117 // Mutable transform methods 118 DOMMatrix multiplySelf(DOMMatrix other); 119 DOMMatrix preMultiplySelf(DOMMatrix other); 120 DOMMatrix translateSelf(unrestricted double tx, 121 unrestricted double ty, 122 optional unrestricted double tz = 0); 123 DOMMatrix scaleSelf(unrestricted double scale, 124 optional unrestricted double originX = 0, 125 optional unrestricted double originY = 0); 126 DOMMatrix scale3dSelf(unrestricted double scale, 127 optional unrestricted double originX = 0, 128 optional unrestricted double originY = 0, 129 optional unrestricted double originZ = 0); 130 DOMMatrix scaleNonUniformSelf(unrestricted double scaleX, 131 optional unrestricted double scaleY = 1, 132 optional unrestricted double scaleZ = 1, 133 optional unrestricted double originX = 0, 134 optional unrestricted double originY = 0, 135 optional unrestricted double originZ = 0); 136 DOMMatrix rotateSelf(unrestricted double angle, 137 optional unrestricted double originX = 0, 138 optional unrestricted double originY = 0); 139 DOMMatrix rotateFromVectorSelf(unrestricted double x, 140 unrestricted double y); 141 DOMMatrix rotateAxisAngleSelf(unrestricted double x, 142 unrestricted double y, 143 unrestricted double z, 144 unrestricted double angle); 145 DOMMatrix skewXSelf(unrestricted double sx); 146 DOMMatrix skewYSelf(unrestricted double sy); 147 DOMMatrix invertSelf(); 148 [Throws] DOMMatrix setMatrixValue(DOMString transformList); 149}; 150 151