Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / dom / DOMMatrixReadOnly.h
blob61915122da80fa25678b29934130839be30c0192
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 DOMMatrixReadOnly_h
6 #define DOMMatrixReadOnly_h
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/DOMTypedArray.h"
10 #include "platform/heap/Handle.h"
11 #include "platform/transforms/TransformationMatrix.h"
13 namespace blink {
15 class DOMMatrix;
17 class DOMMatrixReadOnly : public GarbageCollected<DOMMatrixReadOnly>, public ScriptWrappable {
18 DEFINE_WRAPPERTYPEINFO();
19 public:
20 double a() const { return m_matrix.m11(); }
21 double b() const { return m_matrix.m12(); }
22 double c() const { return m_matrix.m21(); }
23 double d() const { return m_matrix.m22(); }
24 double e() const { return m_matrix.m41(); }
25 double f() const { return m_matrix.m42(); }
27 double m11() const { return m_matrix.m11(); }
28 double m12() const { return m_matrix.m12(); }
29 double m13() const { return m_matrix.m13(); }
30 double m14() const { return m_matrix.m14(); }
31 double m21() const { return m_matrix.m21(); }
32 double m22() const { return m_matrix.m22(); }
33 double m23() const { return m_matrix.m23(); }
34 double m24() const { return m_matrix.m24(); }
35 double m31() const { return m_matrix.m31(); }
36 double m32() const { return m_matrix.m32(); }
37 double m33() const { return m_matrix.m33(); }
38 double m34() const { return m_matrix.m34(); }
39 double m41() const { return m_matrix.m41(); }
40 double m42() const { return m_matrix.m42(); }
41 double m43() const { return m_matrix.m43(); }
42 double m44() const { return m_matrix.m44(); }
44 bool is2D() const;
45 bool isIdentity() const;
47 DOMMatrix* multiply(DOMMatrix*);
48 DOMMatrix* translate(double tx, double ty, double tz = 0);
49 DOMMatrix* scale(double scale, double ox = 0, double oy = 0);
50 DOMMatrix* scale3d(double scale, double ox = 0, double oy = 0, double oz = 0);
51 DOMMatrix* scaleNonUniform(double sx, double sy = 1, double sz = 1,
52 double ox = 0, double oy = 0, double oz = 0);
54 PassRefPtr<DOMFloat32Array> toFloat32Array() const;
55 PassRefPtr<DOMFloat64Array> toFloat64Array() const;
57 const TransformationMatrix& matrix() const { return m_matrix; }
59 DEFINE_INLINE_TRACE() { }
61 protected:
62 TransformationMatrix m_matrix;
63 bool m_is2D;
66 } // namespace blink
68 #endif