Ultralight  1.0.0
A fast, lightweight, HTML UI engine for native apps.
Matrix.h
Go to the documentation of this file.
1 #pragma once
15 #include <Ultralight/Defines.h>
16 #include <Ultralight/RefPtr.h>
17 #include <Ultralight/Geometry.h>
18 
19 namespace ultralight {
20 
24 struct UExport Matrix {
28  float data[6];
29 
33  void SetIdentity();
34 
38  void Set(const Matrix& other);
39 
43  void Set(float a, float b, float c, float d, float e, float f);
44 
48  bool IsIdentity() const;
49 
53  bool IsIdentityOrTranslation() const;
54 
59  bool IsSimple() const;
60 
64  void Translate(float x, float y);
65 
69  void Scale(float x, float y);
70 
74  void Rotate(float theta);
75 
79  void Rotate(float x, float y);
80 
84  void Transform(const Matrix& other);
85 
89  bool GetInverse(Matrix& result) const;
90 
94  Point Apply(const Point& p) const;
95 
99  Rect Apply(const Rect& r) const;
100 
104  uint32_t Hash() const;
105 };
106 
110 struct UExport Matrix4x4 {
114  float data[16];
115 
119  void SetIdentity();
120 };
121 
125 Matrix4x4 UExport ConvertAffineTo4x4(const Matrix& mat);
126 
127 bool UExport operator==(const Matrix& a, const Matrix& b);
128 bool UExport operator!=(const Matrix& a, const Matrix& b);
129 
130 bool UExport operator==(const Matrix4x4& a, const Matrix4x4& b);
131 bool UExport operator!=(const Matrix4x4& a, const Matrix4x4& b);
132 
133 } // namespace ultralight
Affine Matrix helper.
Definition: Matrix.h:24
The header for various geometry definitions and helpers.
This is a set of common JavaScriptCore Helper functions to simplify sample code.
Definition: App.h:19
The header for all ref-counting utilities.
4x4 Matrix Helper
Definition: Matrix.h:110
Float Rectangle Helper.
Definition: Geometry.h:419
Matrix4x4 UExport ConvertAffineTo4x4(const Matrix &mat)
Convert affine matrix to a 4x4 matrix.
2D Vector Helper
Definition: Geometry.h:25