]>
Commit | Line | Data |
---|---|---|
3adadab4 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/private/graphics.h | |
3 | // Purpose: private graphics context header | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Stefan Csomor | |
a9a4f229 | 8 | // RCS-ID: $Id$ |
3adadab4 SC |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_GRAPHICS_PRIVATE_H_ | |
13 | #define _WX_GRAPHICS_PRIVATE_H_ | |
14 | ||
15 | #if wxUSE_GRAPHICS_CONTEXT | |
16 | ||
17 | #include "wx/graphics.h" | |
94a007ec | 18 | |
3adadab4 SC |
19 | class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData |
20 | { | |
21 | public : | |
22 | wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); | |
23 | wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); | |
24 | wxGraphicsRenderer* GetRenderer() const ; | |
25 | virtual wxGraphicsObjectRefData* Clone() const ; | |
94a007ec | 26 | |
3adadab4 SC |
27 | protected : |
28 | wxGraphicsRenderer* m_renderer; | |
29 | } ; | |
30 | ||
8b180bde RD |
31 | class WXDLLIMPEXP_CORE wxGraphicsBitmapData : public wxGraphicsObjectRefData |
32 | { | |
33 | public : | |
34 | wxGraphicsBitmapData( wxGraphicsRenderer* renderer) : | |
35 | wxGraphicsObjectRefData(renderer) {} | |
36 | ||
37 | virtual ~wxGraphicsBitmapData() {} | |
38 | ||
39 | // returns the native representation | |
40 | virtual void * GetNativeBitmap() const = 0; | |
41 | } ; | |
42 | ||
3adadab4 SC |
43 | class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData |
44 | { | |
45 | public : | |
94a007ec | 46 | wxGraphicsMatrixData( wxGraphicsRenderer* renderer) : |
3adadab4 SC |
47 | wxGraphicsObjectRefData(renderer) {} |
48 | ||
49 | virtual ~wxGraphicsMatrixData() {} | |
50 | ||
51 | // concatenates the matrix | |
52 | virtual void Concat( const wxGraphicsMatrixData *t ) = 0; | |
53 | ||
54 | // sets the matrix to the respective values | |
94a007ec | 55 | virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, |
3adadab4 SC |
56 | wxDouble tx=0.0, wxDouble ty=0.0) = 0; |
57 | ||
58 | // gets the component valuess of the matrix | |
59 | virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, | |
60 | wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0; | |
94a007ec | 61 | |
3adadab4 SC |
62 | // makes this the inverse matrix |
63 | virtual void Invert() = 0; | |
64 | ||
65 | // returns true if the elements of the transformation matrix are equal ? | |
66 | virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0; | |
67 | ||
68 | // return true if this is the identity matrix | |
69 | virtual bool IsIdentity() const = 0; | |
70 | ||
71 | // | |
72 | // transformation | |
73 | // | |
74 | ||
75 | // add the translation to this matrix | |
76 | virtual void Translate( wxDouble dx , wxDouble dy ) = 0; | |
77 | ||
78 | // add the scale to this matrix | |
79 | virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; | |
80 | ||
81 | // add the rotation to this matrix (radians) | |
94a007ec | 82 | virtual void Rotate( wxDouble angle ) = 0; |
3adadab4 SC |
83 | |
84 | // | |
85 | // apply the transforms | |
86 | // | |
87 | ||
88 | // applies that matrix to the point | |
89 | virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0; | |
90 | ||
91 | // applies the matrix except for translations | |
92 | virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0; | |
93 | ||
94 | // returns the native representation | |
95 | virtual void * GetNativeMatrix() const = 0; | |
96 | } ; | |
97 | ||
98 | class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData | |
99 | { | |
100 | public : | |
101 | wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {} | |
102 | virtual ~wxGraphicsPathData() {} | |
103 | ||
104 | // | |
105 | // These are the path primitives from which everything else can be constructed | |
106 | // | |
107 | ||
108 | // begins a new subpath at (x,y) | |
109 | virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; | |
110 | ||
94a007ec | 111 | // adds a straight line from the current point to (x,y) |
3adadab4 SC |
112 | virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; |
113 | ||
114 | // adds a cubic Bezier curve from the current point, using two control points and an end point | |
115 | virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; | |
116 | ||
117 | // adds another path | |
118 | virtual void AddPath( const wxGraphicsPathData* path ) =0; | |
119 | ||
120 | // closes the current sub-path | |
121 | virtual void CloseSubpath() = 0; | |
122 | ||
123 | // gets the last point of the current path, (0,0) if not yet set | |
124 | virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0; | |
125 | ||
126 | // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle | |
127 | virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; | |
128 | ||
129 | // | |
94a007ec | 130 | // These are convenience functions which - if not available natively will be assembled |
3adadab4 SC |
131 | // using the primitives from above |
132 | // | |
133 | ||
134 | // adds a quadratic Bezier curve from the current point, using a control point and an end point | |
135 | virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); | |
136 | ||
94a007ec | 137 | // appends a rectangle as a new closed subpath |
3adadab4 SC |
138 | virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); |
139 | ||
140 | // appends an ellipsis as a new closed subpath fitting the passed rectangle | |
141 | virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); | |
142 | ||
143 | // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) | |
144 | virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; | |
145 | ||
146 | // appends an ellipse | |
147 | virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); | |
148 | ||
149 | // appends a rounded rectangle | |
150 | virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); | |
151 | ||
152 | // returns the native path | |
153 | virtual void * GetNativePath() const = 0; | |
154 | ||
155 | // give the native path returned by GetNativePath() back (there might be some deallocations necessary) | |
156 | virtual void UnGetNativePath(void *p) const= 0; | |
157 | ||
158 | // transforms each point of this path by the matrix | |
159 | virtual void Transform( const wxGraphicsMatrixData* matrix ) =0; | |
160 | ||
161 | // gets the bounding box enclosing all points (possibly including control points) | |
162 | virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0; | |
163 | ||
94a007ec | 164 | virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const=0; |
3adadab4 SC |
165 | }; |
166 | ||
167 | #endif | |
168 | ||
169 | #endif // _WX_GRAPHICS_PRIVATE_H_ |