OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DOMMatrix_h | |
6 #define DOMMatrix_h | |
7 | |
8 #include "bindings/core/v8/ExceptionState.h" | |
9 #include "core/geometry/DOMMatrixInit.h" | |
10 #include "core/geometry/DOMMatrixReadOnly.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class CORE_EXPORT DOMMatrix : public DOMMatrixReadOnly { | |
15 DEFINE_WRAPPERTYPEINFO(); | |
16 | |
17 public: | |
18 static DOMMatrix* create(ExceptionState&); | |
19 static DOMMatrix* create(DOMMatrixReadOnly*, | |
20 ExceptionState& = ASSERT_NO_EXCEPTION); | |
21 static DOMMatrix* create(const SkMatrix44&, ExceptionState&); | |
22 static DOMMatrix* create(const String&, ExceptionState&); | |
23 static DOMMatrix* create(Vector<double>, ExceptionState&); | |
24 static DOMMatrix* fromFloat32Array(DOMFloat32Array*, ExceptionState&); | |
25 static DOMMatrix* fromFloat64Array(DOMFloat64Array*, ExceptionState&); | |
26 static DOMMatrix* fromMatrix(DOMMatrixInit&, ExceptionState&); | |
27 | |
28 void setA(double value) { m_matrix->setM11(value); } | |
29 void setB(double value) { m_matrix->setM12(value); } | |
30 void setC(double value) { m_matrix->setM21(value); } | |
31 void setD(double value) { m_matrix->setM22(value); } | |
32 void setE(double value) { m_matrix->setM41(value); } | |
33 void setF(double value) { m_matrix->setM42(value); } | |
34 | |
35 void setM11(double value) { m_matrix->setM11(value); } | |
36 void setM12(double value) { m_matrix->setM12(value); } | |
37 void setM13(double value) { | |
38 m_matrix->setM13(value); | |
39 setIs2D(!value); | |
40 } | |
41 void setM14(double value) { | |
42 m_matrix->setM14(value); | |
43 setIs2D(!value); | |
44 } | |
45 void setM21(double value) { m_matrix->setM21(value); } | |
46 void setM22(double value) { m_matrix->setM22(value); } | |
47 void setM23(double value) { | |
48 m_matrix->setM23(value); | |
49 setIs2D(!value); | |
50 } | |
51 void setM24(double value) { | |
52 m_matrix->setM24(value); | |
53 setIs2D(!value); | |
54 } | |
55 void setM31(double value) { | |
56 m_matrix->setM31(value); | |
57 setIs2D(!value); | |
58 } | |
59 void setM32(double value) { | |
60 m_matrix->setM32(value); | |
61 setIs2D(!value); | |
62 } | |
63 void setM33(double value) { | |
64 m_matrix->setM33(value); | |
65 setIs2D(value != 1); | |
66 } | |
67 void setM34(double value) { | |
68 m_matrix->setM34(value); | |
69 setIs2D(!value); | |
70 } | |
71 void setM41(double value) { m_matrix->setM41(value); } | |
72 void setM42(double value) { m_matrix->setM42(value); } | |
73 void setM43(double value) { | |
74 m_matrix->setM43(value); | |
75 setIs2D(!value); | |
76 } | |
77 void setM44(double value) { | |
78 m_matrix->setM44(value); | |
79 setIs2D(value != 1); | |
80 } | |
81 | |
82 DOMMatrix* multiplySelf(DOMMatrixInit&, ExceptionState&); | |
83 DOMMatrix* preMultiplySelf(DOMMatrixInit&, ExceptionState&); | |
84 DOMMatrix* translateSelf(double tx = 0, double ty = 0, double tz = 0); | |
85 DOMMatrix* scaleSelf(double sx = 1); | |
86 DOMMatrix* scaleSelf(double sx, | |
87 double sy, | |
88 double sz = 1, | |
89 double ox = 0, | |
90 double oy = 0, | |
91 double oz = 0); | |
92 DOMMatrix* scale3dSelf(double scale = 1, | |
93 double ox = 0, | |
94 double oy = 0, | |
95 double oz = 0); | |
96 DOMMatrix* rotateSelf(double rotX); | |
97 DOMMatrix* rotateSelf(double rotX, double rotY); | |
98 DOMMatrix* rotateSelf(double rotX, double rotY, double rotZ); | |
99 DOMMatrix* rotateFromVectorSelf(double x, double y); | |
100 DOMMatrix* rotateAxisAngleSelf(double x = 0, | |
101 double y = 0, | |
102 double z = 0, | |
103 double angle = 0); | |
104 DOMMatrix* skewXSelf(double sx = 0); | |
105 DOMMatrix* skewYSelf(double sy = 0); | |
106 DOMMatrix* invertSelf(); | |
107 | |
108 DOMMatrix* setMatrixValue(const String&, ExceptionState&); | |
109 | |
110 private: | |
111 DOMMatrix(const TransformationMatrix&, bool is2D = true); | |
112 template <typename T> | |
113 DOMMatrix(T sequence, int size); | |
114 | |
115 void setIs2D(bool value); | |
116 void setNAN(); | |
117 }; | |
118 | |
119 } // namespace blink | |
120 | |
121 #endif | |
OLD | NEW |