]>
Commit | Line | Data |
---|---|---|
50581042 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/graphics.h | |
3 | // Purpose: graphics context header | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Stefan Csomor | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_GRAPHICS_H_ | |
13 | #define _WX_GRAPHICS_H_ | |
14 | ||
8acd14d1 SC |
15 | #if wxUSE_GRAPHICS_CONTEXT |
16 | ||
50581042 | 17 | #include "wx/geometry.h" |
50581042 SC |
18 | #include "wx/dynarray.h" |
19 | ||
9e605538 SC |
20 | class WXDLLIMPEXP_CORE wxWindowDC; |
21 | class WXDLLIMPEXP_CORE wxGraphicsContext; | |
22 | class WXDLLIMPEXP_CORE wxGraphicsPath; | |
23 | class WXDLLIMPEXP_CORE wxGraphicsMatrix; | |
24 | class WXDLLIMPEXP_CORE wxGraphicsFigure; | |
25 | class WXDLLIMPEXP_CORE wxGraphicsRenderer; | |
26 | class WXDLLIMPEXP_CORE wxGraphicsPen; | |
27 | class WXDLLIMPEXP_CORE wxGraphicsBrush; | |
28 | class WXDLLIMPEXP_CORE wxGraphicsFont; | |
774f4d12 | 29 | |
50581042 SC |
30 | /* |
31 | * notes about the graphics context apis | |
32 | * | |
33 | * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being | |
34 | * in direction of positive y axis. | |
35 | */ | |
36 | ||
9e605538 SC |
37 | // Base class of all objects used for drawing in the new graphics API, the always point back to their |
38 | // originating rendering engine, there is no dynamic unloading of a renderer currently allowed, | |
39 | // these references are not counted | |
2c820406 SC |
40 | |
41 | // | |
42 | // The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive | |
43 | // duplication. Any operation on a shared instance that results in a modified state, uncouples this | |
44 | // instance from the other instances that were shared - using copy on write semantics | |
45 | // | |
9e605538 | 46 | |
2c820406 SC |
47 | class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData |
48 | { | |
49 | public : | |
50 | wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ); | |
51 | wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data ); | |
52 | wxGraphicsRenderer* GetRenderer() const ; | |
53 | virtual wxGraphicsObjectRefData* Clone() const ; | |
54 | ||
55 | protected : | |
56 | wxGraphicsRenderer* m_renderer; | |
57 | } ; | |
58 | ||
9e605538 SC |
59 | class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject |
60 | { | |
61 | public : | |
2c820406 SC |
62 | wxGraphicsObject() ; |
63 | wxGraphicsObject( wxGraphicsRenderer* renderer ) ; | |
64 | virtual ~wxGraphicsObject() ; | |
0d3675a6 | 65 | |
2c820406 SC |
66 | bool IsNull() const ; |
67 | ||
68 | // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet | |
69 | wxGraphicsRenderer* GetRenderer() const ; | |
70 | wxGraphicsObjectRefData* GetGraphicsData() const ; | |
9e605538 | 71 | protected : |
2c820406 SC |
72 | virtual wxObjectRefData* CreateRefData() const; |
73 | virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; | |
74 | ||
0d3675a6 | 75 | DECLARE_DYNAMIC_CLASS(wxGraphicsObject); |
9e605538 SC |
76 | } ; |
77 | ||
78 | class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject | |
79 | { | |
80 | public : | |
2c820406 | 81 | wxGraphicsPen() {} |
9e605538 | 82 | virtual ~wxGraphicsPen() {} |
9e605538 | 83 | private : |
2c820406 | 84 | DECLARE_DYNAMIC_CLASS(wxGraphicsPen) |
9e605538 SC |
85 | } ; |
86 | ||
2c820406 SC |
87 | extern WXDLLEXPORT_DATA(wxGraphicsPen) wxNullGraphicsPen; |
88 | ||
9e605538 SC |
89 | class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject |
90 | { | |
91 | public : | |
2c820406 | 92 | wxGraphicsBrush() {} |
9e605538 | 93 | virtual ~wxGraphicsBrush() {} |
9e605538 | 94 | private : |
2c820406 | 95 | DECLARE_DYNAMIC_CLASS(wxGraphicsBrush) |
9e605538 SC |
96 | } ; |
97 | ||
2c820406 SC |
98 | extern WXDLLEXPORT_DATA(wxGraphicsBrush) wxNullGraphicsBrush; |
99 | ||
9e605538 | 100 | class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject |
50581042 SC |
101 | { |
102 | public : | |
2c820406 | 103 | wxGraphicsFont() {} |
9e605538 | 104 | virtual ~wxGraphicsFont() {} |
9e605538 | 105 | private : |
2c820406 | 106 | DECLARE_DYNAMIC_CLASS(wxGraphicsFont) |
9e605538 SC |
107 | } ; |
108 | ||
2c820406 SC |
109 | extern WXDLLEXPORT_DATA(wxGraphicsFont) wxNullGraphicsFont; |
110 | ||
111 | ||
9e605538 SC |
112 | class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject |
113 | { | |
114 | public : | |
115 | wxGraphicsPath(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer) {} | |
50581042 SC |
116 | virtual ~wxGraphicsPath() {} |
117 | ||
9e605538 SC |
118 | virtual wxGraphicsPath *Clone() const = 0; |
119 | ||
50581042 SC |
120 | // |
121 | // These are the path primitives from which everything else can be constructed | |
122 | // | |
123 | ||
124 | // begins a new subpath at (x,y) | |
125 | virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0; | |
9e605538 | 126 | void MoveToPoint( const wxPoint2DDouble& p); |
50581042 SC |
127 | |
128 | // adds a straight line from the current point to (x,y) | |
129 | virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0; | |
9e605538 | 130 | void AddLineToPoint( const wxPoint2DDouble& p); |
50581042 SC |
131 | |
132 | // adds a cubic Bezier curve from the current point, using two control points and an end point | |
133 | virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0; | |
9e605538 | 134 | void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e); |
0d3675a6 RD |
135 | |
136 | // adds another path | |
137 | virtual void AddPath( const wxGraphicsPath* path ) =0; | |
50581042 SC |
138 | |
139 | // closes the current sub-path | |
140 | virtual void CloseSubpath() = 0; | |
141 | ||
142 | // gets the last point of the current path, (0,0) if not yet set | |
143 | virtual void GetCurrentPoint( wxDouble& x, wxDouble&y) = 0; | |
9e605538 | 144 | wxPoint2DDouble GetCurrentPoint(); |
50581042 SC |
145 | |
146 | // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle | |
147 | virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0; | |
0d3675a6 | 148 | void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); |
50581042 SC |
149 | |
150 | // | |
151 | // These are convenience functions which - if not available natively will be assembled | |
152 | // using the primitives from above | |
153 | // | |
154 | ||
155 | // adds a quadratic Bezier curve from the current point, using a control point and an end point | |
156 | virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); | |
157 | ||
158 | // appends a rectangle as a new closed subpath | |
159 | virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); | |
160 | ||
161 | // appends an ellipsis as a new closed subpath fitting the passed rectangle | |
162 | virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); | |
163 | ||
59720690 | 164 | // 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) |
50581042 | 165 | virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ; |
0d3675a6 | 166 | |
59720690 SC |
167 | // appends an ellipse |
168 | virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); | |
169 | ||
170 | // appends a rounded rectangle | |
171 | virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); | |
172 | ||
0d3675a6 RD |
173 | // returns the native path |
174 | virtual void * GetNativePath() const = 0; | |
175 | ||
176 | // give the native path returned by GetNativePath() back (there might be some deallocations necessary) | |
177 | virtual void UnGetNativePath(void *p) = 0; | |
178 | ||
179 | // transforms each point of this path by the matrix | |
180 | virtual void Transform( wxGraphicsMatrix* matrix ) =0; | |
181 | ||
182 | // gets the bounding box enclosing all points (possibly including control points) | |
183 | virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) =0; | |
184 | wxRect2DDouble GetBox(); | |
185 | ||
186 | virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxWINDING_RULE) =0; | |
187 | bool Contains( const wxPoint2DDouble& c, int fillStyle = wxWINDING_RULE); | |
188 | ||
50581042 | 189 | DECLARE_NO_COPY_CLASS(wxGraphicsPath) |
8ddf8e82 | 190 | DECLARE_ABSTRACT_CLASS(wxGraphicsPath) |
50581042 SC |
191 | }; |
192 | ||
9e605538 | 193 | class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject |
774f4d12 SC |
194 | { |
195 | public : | |
0d3675a6 RD |
196 | wxGraphicsMatrix(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer) {} |
197 | ||
198 | virtual ~wxGraphicsMatrix() {} | |
199 | ||
9e605538 SC |
200 | virtual wxGraphicsMatrix *Clone() const = 0; |
201 | ||
0d3675a6 RD |
202 | // concatenates the matrix |
203 | virtual void Concat( const wxGraphicsMatrix *t ) = 0; | |
204 | void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); } | |
205 | ||
206 | // copies the passed in matrix | |
207 | virtual void Copy( const wxGraphicsMatrix *t ) = 0; | |
208 | void Copy( const wxGraphicsMatrix &t ) { Copy( &t ); } | |
209 | ||
210 | // sets the matrix to the respective values | |
211 | virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, | |
212 | wxDouble tx=0.0, wxDouble ty=0.0) = 0; | |
213 | ||
214 | // makes this the inverse matrix | |
215 | virtual void Invert() = 0; | |
216 | ||
217 | // returns true if the elements of the transformation matrix are equal ? | |
9e605538 | 218 | virtual bool IsEqual( const wxGraphicsMatrix* t) const = 0; |
0d3675a6 RD |
219 | bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); } |
220 | ||
221 | // return true if this is the identity matrix | |
222 | virtual bool IsIdentity() = 0; | |
223 | ||
774f4d12 SC |
224 | // |
225 | // transformation | |
226 | // | |
227 | ||
9e605538 | 228 | // add the translation to this matrix |
774f4d12 SC |
229 | virtual void Translate( wxDouble dx , wxDouble dy ) = 0; |
230 | ||
9e605538 | 231 | // add the scale to this matrix |
774f4d12 SC |
232 | virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; |
233 | ||
9e605538 | 234 | // add the rotation to this matrix (radians) |
0d3675a6 RD |
235 | virtual void Rotate( wxDouble angle ) = 0; |
236 | ||
9e605538 SC |
237 | // |
238 | // apply the transforms | |
239 | // | |
0d3675a6 RD |
240 | |
241 | // applies that matrix to the point | |
242 | virtual void TransformPoint( wxDouble *x, wxDouble *y ) = 0; | |
243 | ||
244 | // applies the matrix except for translations | |
245 | virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) =0; | |
246 | ||
247 | // returns the native representation | |
248 | virtual void * GetNativeMatrix() const = 0; | |
249 | ||
9e605538 SC |
250 | DECLARE_NO_COPY_CLASS(wxGraphicsMatrix) |
251 | DECLARE_ABSTRACT_CLASS(wxGraphicsMatrix) | |
774f4d12 | 252 | } ; |
774f4d12 | 253 | |
9e605538 | 254 | class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject |
50581042 SC |
255 | { |
256 | public: | |
9e605538 | 257 | wxGraphicsContext(wxGraphicsRenderer* renderer); |
774f4d12 | 258 | |
9e605538 | 259 | virtual ~wxGraphicsContext(); |
50581042 SC |
260 | |
261 | static wxGraphicsContext* Create( const wxWindowDC& dc) ; | |
0d3675a6 | 262 | |
bf2185eb | 263 | static wxGraphicsContext* CreateFromNative( void * context ) ; |
774f4d12 | 264 | |
bf2185eb | 265 | static wxGraphicsContext* CreateFromNativeWindow( void * window ) ; |
9a02779a | 266 | |
774f4d12 | 267 | static wxGraphicsContext* Create( wxWindow* window ) ; |
50581042 | 268 | |
9e605538 | 269 | wxGraphicsPath * CreatePath(); |
0d3675a6 | 270 | |
2c820406 | 271 | virtual wxGraphicsPen CreatePen(const wxPen& pen); |
9e605538 | 272 | |
2c820406 | 273 | virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ); |
9e605538 SC |
274 | |
275 | // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 | |
2c820406 | 276 | virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, |
9e605538 SC |
277 | const wxColour&c1, const wxColour&c2); |
278 | ||
279 | // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) | |
280 | // with radius r and color cColor | |
2c820406 | 281 | virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, |
9e605538 SC |
282 | const wxColour &oColor, const wxColour &cColor); |
283 | ||
284 | // sets the font | |
2c820406 | 285 | virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ); |
9e605538 | 286 | |
0d3675a6 RD |
287 | // create a 'native' matrix corresponding to these values |
288 | virtual wxGraphicsMatrix* CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, | |
289 | wxDouble tx=0.0, wxDouble ty=0.0); | |
290 | ||
50581042 SC |
291 | // push the current state of the context, ie the transformation matrix on a stack |
292 | virtual void PushState() = 0; | |
293 | ||
294 | // pops a stored state from the stack | |
295 | virtual void PopState() = 0; | |
296 | ||
774f4d12 | 297 | // clips drawings to the region, combined to current clipping region |
50581042 SC |
298 | virtual void Clip( const wxRegion ®ion ) = 0; |
299 | ||
774f4d12 SC |
300 | // clips drawings to the rect |
301 | virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; | |
0d3675a6 RD |
302 | |
303 | // resets the clipping to original extent | |
304 | virtual void ResetClip() = 0 ; | |
774f4d12 | 305 | |
0d3675a6 RD |
306 | // returns the native context |
307 | virtual void * GetNativeContext() = 0; | |
774f4d12 | 308 | |
50581042 | 309 | // |
774f4d12 | 310 | // transformation : changes the current transformation matrix CTM of the context |
50581042 SC |
311 | // |
312 | ||
313 | // translate | |
314 | virtual void Translate( wxDouble dx , wxDouble dy ) = 0; | |
315 | ||
316 | // scale | |
317 | virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0; | |
318 | ||
319 | // rotate (radians) | |
320 | virtual void Rotate( wxDouble angle ) = 0; | |
0d3675a6 RD |
321 | |
322 | // concatenates this transform with the current transform of this context | |
323 | virtual void ConcatTransform( const wxGraphicsMatrix* matrix ) = 0; | |
9e605538 | 324 | |
0d3675a6 RD |
325 | // sets the transform of this context |
326 | virtual void SetTransform( const wxGraphicsMatrix* matrix ) = 0; | |
50581042 | 327 | |
0d3675a6 RD |
328 | // gets the matrix of this context |
329 | virtual void GetTransform( wxGraphicsMatrix* matrix ) = 0; | |
50581042 SC |
330 | // |
331 | // setting the paint | |
332 | // | |
333 | ||
9e605538 | 334 | // sets the pen |
2c820406 | 335 | virtual void SetPen( const wxGraphicsPen& pen ); |
9e605538 SC |
336 | |
337 | void SetPen( const wxPen& pen ); | |
50581042 SC |
338 | |
339 | // sets the brush for filling | |
2c820406 | 340 | virtual void SetBrush( const wxGraphicsBrush& brush ); |
9e605538 SC |
341 | |
342 | void SetBrush( const wxBrush& brush ); | |
50581042 SC |
343 | |
344 | // sets the font | |
2c820406 | 345 | virtual void SetFont( const wxGraphicsFont& font ); |
9e605538 SC |
346 | |
347 | void SetFont( const wxFont& font, const wxColour& colour ); | |
0d3675a6 | 348 | |
50581042 | 349 | |
50581042 SC |
350 | // strokes along a path with the current pen |
351 | virtual void StrokePath( const wxGraphicsPath *path ) = 0; | |
352 | ||
353 | // fills a path with the current brush | |
354 | virtual void FillPath( const wxGraphicsPath *path, int fillStyle = wxWINDING_RULE ) = 0; | |
355 | ||
356 | // draws a path by first filling and then stroking | |
357 | virtual void DrawPath( const wxGraphicsPath *path, int fillStyle = wxWINDING_RULE ); | |
0d3675a6 | 358 | |
50581042 SC |
359 | // |
360 | // text | |
361 | // | |
362 | ||
363 | virtual void DrawText( const wxString &str, wxDouble x, wxDouble y ) = 0; | |
364 | ||
365 | virtual void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ); | |
366 | ||
367 | virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, | |
368 | wxDouble *descent, wxDouble *externalLeading ) const = 0; | |
369 | ||
370 | virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; | |
371 | ||
372 | // | |
373 | // image support | |
374 | // | |
375 | ||
376 | virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; | |
377 | ||
378 | virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; | |
379 | ||
380 | // | |
381 | // convenience methods | |
382 | // | |
383 | ||
384 | // strokes a single line | |
385 | virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2); | |
386 | ||
387 | // stroke lines connecting each of the points | |
388 | virtual void StrokeLines( size_t n, const wxPoint2DDouble *points); | |
389 | ||
390 | // stroke disconnected lines from begin to end points | |
391 | virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints); | |
392 | ||
393 | // draws a polygon | |
394 | virtual void DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle = wxWINDING_RULE ); | |
395 | ||
396 | // draws a polygon | |
397 | virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h); | |
398 | ||
399 | // draws an ellipse | |
400 | virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); | |
401 | ||
402 | // draws a rounded rectangle | |
403 | virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius); | |
404 | ||
9e605538 | 405 | // wrappers using wxPoint2DDouble TODO |
50581042 | 406 | |
de3cb39f RD |
407 | // helper to determine if a 0.5 offset should be applied for the drawing operation |
408 | virtual bool ShouldOffset() const { return false; } | |
9e605538 | 409 | |
9da34e21 JS |
410 | protected : |
411 | ||
2c820406 SC |
412 | wxGraphicsPen m_pen; |
413 | wxGraphicsBrush m_brush; | |
414 | wxGraphicsFont m_font; | |
9e605538 SC |
415 | |
416 | private : | |
50581042 | 417 | DECLARE_NO_COPY_CLASS(wxGraphicsContext) |
8ddf8e82 | 418 | DECLARE_ABSTRACT_CLASS(wxGraphicsContext) |
50581042 SC |
419 | }; |
420 | ||
9e605538 SC |
421 | #if 0 |
422 | ||
423 | // | |
424 | // A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements | |
425 | // | |
426 | ||
427 | class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject | |
428 | { | |
429 | public : | |
0d3675a6 RD |
430 | wxGraphicsFigure(wxGraphicsRenderer* renderer) ; |
431 | ||
432 | virtual ~wxGraphicsFigure() ; | |
433 | ||
434 | void SetPath( wxGraphicsMatrix* matrix ); | |
435 | ||
436 | void SetMatrix( wxGraphicsPath* path); | |
437 | ||
438 | // draws this object on the context | |
439 | virtual void Draw( wxGraphicsContext* cg ); | |
440 | ||
441 | // returns the path of this object | |
442 | wxGraphicsPath* GetPath() { return m_path; } | |
443 | ||
444 | // returns the transformation matrix of this object, may be null if there is no transformation necessary | |
445 | wxGraphicsMatrix* GetMatrix() { return m_matrix; } | |
446 | ||
9e605538 | 447 | private : |
0d3675a6 RD |
448 | wxGraphicsMatrix* m_matrix; |
449 | wxGraphicsPath* m_path; | |
9e605538 SC |
450 | |
451 | DECLARE_DYNAMIC_CLASS(wxGraphicsFigure) | |
452 | } ; | |
453 | ||
454 | #endif | |
455 | ||
456 | // | |
457 | // The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer | |
458 | // instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional | |
459 | // paths at any point from a given matrix etc. | |
460 | // | |
461 | ||
462 | class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject | |
463 | { | |
464 | public : | |
465 | wxGraphicsRenderer() {} | |
466 | ||
467 | virtual ~wxGraphicsRenderer() {} | |
468 | ||
0d3675a6 | 469 | static wxGraphicsRenderer* GetDefaultRenderer(); |
9e605538 | 470 | |
0d3675a6 | 471 | // Context |
9e605538 | 472 | |
0d3675a6 RD |
473 | virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ; |
474 | ||
475 | virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0; | |
9e605538 | 476 | |
0d3675a6 | 477 | virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0; |
9e605538 | 478 | |
0d3675a6 | 479 | virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0; |
9e605538 | 480 | |
0d3675a6 RD |
481 | // Path |
482 | ||
9e605538 SC |
483 | virtual wxGraphicsPath * CreatePath() = 0; |
484 | ||
0d3675a6 RD |
485 | // Matrix |
486 | ||
487 | virtual wxGraphicsMatrix * CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, | |
488 | wxDouble tx=0.0, wxDouble ty=0.0) = 0; | |
9e605538 SC |
489 | |
490 | // Paints | |
491 | ||
2c820406 | 492 | virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0 ; |
9e605538 | 493 | |
2c820406 | 494 | virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0 ; |
9e605538 SC |
495 | |
496 | // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 | |
2c820406 | 497 | virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, |
9e605538 SC |
498 | const wxColour&c1, const wxColour&c2) = 0; |
499 | ||
500 | // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) | |
501 | // with radius r and color cColor | |
2c820406 | 502 | virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, |
9e605538 SC |
503 | const wxColour &oColor, const wxColour &cColor) = 0; |
504 | ||
505 | // sets the font | |
2c820406 | 506 | virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0; |
9e605538 SC |
507 | |
508 | private : | |
0d3675a6 | 509 | DECLARE_NO_COPY_CLASS(wxGraphicsRenderer) |
9e605538 SC |
510 | DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) |
511 | } ; | |
512 | ||
774f4d12 | 513 | #endif |
50581042 | 514 | |
8acd14d1 | 515 | #endif // _WX_GRAPHICS_H_ |