File: DOMMatrix.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (121 lines) | stat: -rw-r--r-- 3,919 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef DOMMatrix_h
#define DOMMatrix_h

#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/DOMMatrixInit.h"
#include "core/dom/DOMMatrixReadOnly.h"

namespace blink {

class CORE_EXPORT DOMMatrix : public DOMMatrixReadOnly {
  DEFINE_WRAPPERTYPEINFO();

 public:
  static DOMMatrix* create(ExceptionState&);
  static DOMMatrix* create(DOMMatrixReadOnly*,
                           ExceptionState& = ASSERT_NO_EXCEPTION);
  static DOMMatrix* create(const SkMatrix44&, ExceptionState&);
  static DOMMatrix* create(const String&, ExceptionState&);
  static DOMMatrix* create(Vector<double>, ExceptionState&);
  static DOMMatrix* fromFloat32Array(DOMFloat32Array*, ExceptionState&);
  static DOMMatrix* fromFloat64Array(DOMFloat64Array*, ExceptionState&);
  static DOMMatrix* fromMatrix(DOMMatrixInit&, ExceptionState&);

  void setA(double value) { m_matrix->setM11(value); }
  void setB(double value) { m_matrix->setM12(value); }
  void setC(double value) { m_matrix->setM21(value); }
  void setD(double value) { m_matrix->setM22(value); }
  void setE(double value) { m_matrix->setM41(value); }
  void setF(double value) { m_matrix->setM42(value); }

  void setM11(double value) { m_matrix->setM11(value); }
  void setM12(double value) { m_matrix->setM12(value); }
  void setM13(double value) {
    m_matrix->setM13(value);
    setIs2D(!value);
  }
  void setM14(double value) {
    m_matrix->setM14(value);
    setIs2D(!value);
  }
  void setM21(double value) { m_matrix->setM21(value); }
  void setM22(double value) { m_matrix->setM22(value); }
  void setM23(double value) {
    m_matrix->setM23(value);
    setIs2D(!value);
  }
  void setM24(double value) {
    m_matrix->setM24(value);
    setIs2D(!value);
  }
  void setM31(double value) {
    m_matrix->setM31(value);
    setIs2D(!value);
  }
  void setM32(double value) {
    m_matrix->setM32(value);
    setIs2D(!value);
  }
  void setM33(double value) {
    m_matrix->setM33(value);
    setIs2D(value != 1);
  }
  void setM34(double value) {
    m_matrix->setM34(value);
    setIs2D(!value);
  }
  void setM41(double value) { m_matrix->setM41(value); }
  void setM42(double value) { m_matrix->setM42(value); }
  void setM43(double value) {
    m_matrix->setM43(value);
    setIs2D(!value);
  }
  void setM44(double value) {
    m_matrix->setM44(value);
    setIs2D(value != 1);
  }

  DOMMatrix* multiplySelf(DOMMatrixInit&, ExceptionState&);
  DOMMatrix* preMultiplySelf(DOMMatrixInit&, ExceptionState&);
  DOMMatrix* translateSelf(double tx = 0, double ty = 0, double tz = 0);
  DOMMatrix* scaleSelf(double sx = 1);
  DOMMatrix* scaleSelf(double sx,
                       double sy,
                       double sz = 1,
                       double ox = 0,
                       double oy = 0,
                       double oz = 0);
  DOMMatrix* scale3dSelf(double scale = 1,
                         double ox = 0,
                         double oy = 0,
                         double oz = 0);
  DOMMatrix* rotateSelf(double rotX);
  DOMMatrix* rotateSelf(double rotX, double rotY);
  DOMMatrix* rotateSelf(double rotX, double rotY, double rotZ);
  DOMMatrix* rotateFromVectorSelf(double x, double y);
  DOMMatrix* rotateAxisAngleSelf(double x = 0,
                                 double y = 0,
                                 double z = 0,
                                 double angle = 0);
  DOMMatrix* skewXSelf(double sx = 0);
  DOMMatrix* skewYSelf(double sy = 0);
  DOMMatrix* invertSelf();

  DOMMatrix* setMatrixValue(const String&, ExceptionState&);

 private:
  DOMMatrix(const TransformationMatrix&, bool is2D = true);
  template <typename T>
  DOMMatrix(T sequence, int size);

  void setIs2D(bool value);
  void setNAN();
};

}  // namespace blink

#endif