]> git.saurik.com Git - wxWidgets.git/blob - include/wx/affinematrix2d.h
support SDK < 10.6, fixes #14902
[wxWidgets.git] / include / wx / affinematrix2d.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/affinematrix2d.h
3 // Purpose: wxAffineMatrix2D class.
4 // Author: Based on wxTransformMatrix by Chris Breeze, Julian Smart
5 // Created: 2011-04-05
6 // Copyright: (c) wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_AFFINEMATRIX2D_H_
11 #define _WX_AFFINEMATRIX2D_H_
12
13 #include "wx/defs.h"
14
15 #if wxUSE_GEOMETRY
16
17 #include "wx/affinematrix2dbase.h"
18
19 // A simple implementation of wxAffineMatrix2DBase interface done entirely in
20 // wxWidgets.
21 class WXDLLIMPEXP_CORE wxAffineMatrix2D : public wxAffineMatrix2DBase
22 {
23 public:
24 wxAffineMatrix2D() : m_11(1), m_12(0),
25 m_21(0), m_22(1),
26 m_tx(0), m_ty(0)
27 {
28 }
29
30 // Implement base class pure virtual methods.
31 virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr);
32 virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const;
33 virtual void Concat(const wxAffineMatrix2DBase& t);
34 virtual bool Invert();
35 virtual bool IsIdentity() const;
36 virtual bool IsEqual(const wxAffineMatrix2DBase& t) const;
37 virtual void Translate(wxDouble dx, wxDouble dy);
38 virtual void Scale(wxDouble xScale, wxDouble yScale);
39 virtual void Rotate(wxDouble cRadians);
40
41 protected:
42 virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const;
43 virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const;
44
45 private:
46 wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty;
47 };
48
49 #endif // wxUSE_GEOMETRY
50
51 #endif // _WX_AFFINEMATRIX2D_H_