]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/affinematrix2d.h
Recognize VC12 (a.k.a. MSVS 2013) and define __VISUALC12__ for it.
[wxWidgets.git] / interface / wx / affinematrix2d.h
CommitLineData
0e5d4c38
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: affinematrix2d.h
3// Purpose: interface of wxAffineMatrix2D
4// Author: wxWidgets team
5// Licence: wxWindows licence
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxAffineMatrix2D
10
11 A 3x2 matrix representing an affine 2D transformation.
12
13 @library{wxcore}
14 @category{misc}
15
16 @since 2.9.2
17*/
cb9582cd 18class wxAffineMatrix2D : public wxAffineMatrix2DBase
0e5d4c38
VZ
19{
20public:
21 /**
22 Default constructor.
23
24 The matrix elements are initialize to the identity matrix.
25 */
26 wxAffineMatrix2D();
27
28 /**
29 Get the component values of the matrix.
30
31 @param mat2D
32 The rotational components of the matrix (upper 2 x 2), must be
33 non-@NULL.
34 @param tr
35 The translational components of the matrix, may be @NULL.
36 */
37 void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const;
38
39 /**
40 Set all elements of this matrix.
41
42 @param mat2D
43 The rotational components of the matrix (upper 2 x 2).
44 @param tr
45 The translational components of the matrix.
46 */
47 void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr);
48
49 /**
50 Concatenate this matrix with another one.
51
52 The parameter matrix is the multiplicand.
53
15fa4de3 54 @param t
0e5d4c38
VZ
55 The multiplicand.
56
57 @code
58 // | t.m_11 t.m_12 0 | | m_11 m_12 0 |
59 // matrix' = | t.m_21 t.m_22 0 | x | m_21 m_22 0 |
60 // | t.m_tx t.m_ty 1 | | m_tx m_ty 1 |
61 @endcode
62 */
63 void Concat(const wxAffineMatrix2DBase& t);
64
65 /**
66 Invert this matrix.
67
68 If the matrix is not invertible, i.e. if its determinant is 0, returns
69 false and doesn't modify it.
70
71 @code
72 // | m_11 m_12 0 |
73 // Invert | m_21 m_22 0 |
74 // | m_tx m_ty 1 |
75 @endcode
76 */
77 bool Invert();
78
79 /**
80 Check if this is the identity matrix.
81 */
82 bool IsIdentity() const;
83
84 //@{
85 /**
86 Check that this matrix is identical with @t.
87
15fa4de3 88 @param t
0e5d4c38
VZ
89 The matrix compared with this.
90 */
91 void IsEqual(const wxAffineMatrix2DBase& t);
92 bool operator==(const wxAffineMatrix2DBase& t) const;
93 //@}
94
95 /**
96 Check that this matrix differs from @t.
97
15fa4de3 98 @param t
0e5d4c38
VZ
99 The matrix compared with this.
100 */
101 bool operator!=(const wxAffineMatrix2DBase& t) const;
102
103 /**
104 Add the translation to this matrix.
105
106 @param dx
107 The translation in x direction.
108 @param dy
109 The translation in y direction.
fd5cfba7
VZ
110
111 @code
112 // | 1 0 0 | | m_11 m_12 0 |
113 // matrix' = | 0 1 0 | x | m_21 m_22 0 |
114 // | dx dy 1 | | m_tx m_ty 1 |
115 @endcode
0e5d4c38
VZ
116 */
117 void Translate(wxDouble dx, wxDouble dy);
118
119 /**
120 Add scaling to this matrix.
121
122 @param xScale
123 Scaling in x direction.
124 @param yScale
125 Scaling in y direction.
fd5cfba7
VZ
126
127 @code
128 // | xScale 0 0 | | m_11 m_12 0 |
129 // matrix' = | 0 yScale 0 | x | m_21 m_22 0 |
130 // | 0 0 1 | | m_tx m_ty 1 |
131 @endcode
0e5d4c38
VZ
132 */
133 void Scale(wxDouble xScale, wxDouble yScale);
134
135 /**
136 Add mirroring to this matrix.
137
138 @param direction
139 The direction(s) used for mirroring. One of wxHORIZONTAL,
140 wxVERTICAL or their combination wxBOTH.
141 */
142 void Mirror(int direction = wxHORIZONTAL);
143
144 /**
fd5cfba7 145 Add clockwise rotation to this matrix.
0e5d4c38 146
fd5cfba7
VZ
147 @param cRadians
148 Rotation angle in radians, clockwise.
149
150 @code
151 // | cos sin 0 | | m_11 m_12 0 |
152 // matrix' = | -sin cos 0 | x | m_21 m_22 0 |
153 // | 0 0 1 | | m_tx m_ty 1 |
154 @endcode
0e5d4c38 155 */
fd5cfba7 156 void Rotate(wxDouble cRadians);
0e5d4c38
VZ
157
158 /**
159 Applies this matrix to the point.
160
15fa4de3 161 @param p
0e5d4c38
VZ
162 The point receiving the transformations.
163
164 @return The point with the transformations applied.
fd5cfba7
VZ
165
166 @code
167 // | m_11 m_12 0 |
168 // point' = | src.m_x src._my 1 | x | m_21 m_22 0 |
169 // | m_tx m_ty 1 |
170 @endcode
0e5d4c38
VZ
171 */
172 wxPoint2DDouble TransformPoint(const wxPoint2DDouble& p) const;
173 void TransformPoint(wxDouble* x, wxDouble* y) const;
174
175 /**
0824e369 176 Applies the linear part of this matrix, i.e.\ without translation.
0e5d4c38 177
15fa4de3 178 @param p
0e5d4c38
VZ
179 The source receiving the transformations.
180
181 @return The source with the transformations applied.
fd5cfba7
VZ
182
183 @code
184 // | m_11 m_12 0 |
185 // dist' = | src.m_x src._my 0 | x | m_21 m_22 0 |
186 // | m_tx m_ty 1 |
187 @endcode
0e5d4c38
VZ
188 */
189 wxPoint2DDouble TransformDistance(const wxPoint2DDouble& p) const;
190 void TransformDistance(wxDouble* dx, wxDouble* dy) const;
191};