Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / dom / DOMMatrix.h
blobe4c556fa6532175ca68f9c83b6a367849ebb3023
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.
5 #ifndef DOMMatrix_h
6 #define DOMMatrix_h
8 #include "core/dom/DOMMatrixReadOnly.h"
10 namespace blink {
12 class DOMMatrix : public DOMMatrixReadOnly {
13 DEFINE_WRAPPERTYPEINFO();
14 public:
15 static DOMMatrix* create();
16 static DOMMatrix* create(DOMMatrixReadOnly*);
18 void setA(double value) { m_matrix.setM11(value); }
19 void setB(double value) { m_matrix.setM12(value); }
20 void setC(double value) { m_matrix.setM21(value); }
21 void setD(double value) { m_matrix.setM22(value); }
22 void setE(double value) { m_matrix.setM41(value); }
23 void setF(double value) { m_matrix.setM42(value); }
25 void setM11(double value) { m_matrix.setM11(value); }
26 void setM12(double value) { m_matrix.setM12(value); }
27 void setM13(double value) { m_matrix.setM13(value); setIs2D(!value); }
28 void setM14(double value) { m_matrix.setM14(value); setIs2D(!value); }
29 void setM21(double value) { m_matrix.setM21(value); }
30 void setM22(double value) { m_matrix.setM22(value); }
31 void setM23(double value) { m_matrix.setM23(value); setIs2D(!value); }
32 void setM24(double value) { m_matrix.setM24(value); setIs2D(!value); }
33 void setM31(double value) { m_matrix.setM31(value); setIs2D(!value); }
34 void setM32(double value) { m_matrix.setM32(value); setIs2D(!value); }
35 void setM33(double value) { m_matrix.setM33(value); setIs2D(value != 1); }
36 void setM34(double value) { m_matrix.setM34(value); setIs2D(!value); }
37 void setM41(double value) { m_matrix.setM41(value); }
38 void setM42(double value) { m_matrix.setM42(value); }
39 void setM43(double value) { m_matrix.setM43(value); setIs2D(!value); }
40 void setM44(double value) { m_matrix.setM44(value); setIs2D(value != 1); }
42 DOMMatrix* multiplySelf(DOMMatrix*);
43 DOMMatrix* preMultiplySelf(DOMMatrix*);
44 DOMMatrix* translateSelf(double tx, double ty, double tz = 0);
45 DOMMatrix* scaleSelf(double scale, double ox = 0, double oy = 0);
46 DOMMatrix* scale3dSelf(double scale, double ox = 0, double oy = 0, double oz = 0);
47 DOMMatrix* scaleNonUniformSelf(double sx, double sy = 1, double sz = 1,
48 double ox = 0, double oy = 0, double oz = 0);
50 private:
51 DOMMatrix(const TransformationMatrix&, bool is2D = true);
53 void setIs2D(bool value);
56 } // namespace blink
58 #endif