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