]> git.saurik.com Git - wxWidgets.git/blob - include/wx/graphics.h
Updated translations manual page with latest status given by the website translations...
[wxWidgets.git] / include / wx / graphics.h
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
15 #include "wx/defs.h"
16
17 #if wxUSE_GRAPHICS_CONTEXT
18
19 #include "wx/geometry.h"
20 #include "wx/dynarray.h"
21
22 class WXDLLIMPEXP_FWD_CORE wxWindowDC;
23 class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
24 #if wxUSE_PRINTING_ARCHITECTURE
25 class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
26 #endif
27 class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
28 class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
29 class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrix;
30 class WXDLLIMPEXP_FWD_CORE wxGraphicsFigure;
31 class WXDLLIMPEXP_FWD_CORE wxGraphicsRenderer;
32 class WXDLLIMPEXP_FWD_CORE wxGraphicsPen;
33 class WXDLLIMPEXP_FWD_CORE wxGraphicsBrush;
34 class WXDLLIMPEXP_FWD_CORE wxGraphicsFont;
35 class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmap;
36
37 /*
38 * notes about the graphics context apis
39 *
40 * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being
41 * in direction of positive y axis.
42 */
43
44 // Base class of all objects used for drawing in the new graphics API, the always point back to their
45 // originating rendering engine, there is no dynamic unloading of a renderer currently allowed,
46 // these references are not counted
47
48 //
49 // The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive
50 // duplication. Any operation on a shared instance that results in a modified state, uncouples this
51 // instance from the other instances that were shared - using copy on write semantics
52 //
53
54 class WXDLLIMPEXP_FWD_CORE wxGraphicsObjectRefData;
55 class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrixData;
56 class WXDLLIMPEXP_FWD_CORE wxGraphicsPathData;
57
58 class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject
59 {
60 public:
61 wxGraphicsObject();
62 wxGraphicsObject( wxGraphicsRenderer* renderer );
63 virtual ~wxGraphicsObject();
64
65 bool IsNull() const;
66
67 // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet
68 wxGraphicsRenderer* GetRenderer() const;
69 wxGraphicsObjectRefData* GetGraphicsData() const;
70 protected:
71 virtual wxObjectRefData* CreateRefData() const;
72 virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
73
74 DECLARE_DYNAMIC_CLASS(wxGraphicsObject)
75 };
76
77 class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject
78 {
79 public:
80 wxGraphicsPen() {}
81 virtual ~wxGraphicsPen() {}
82 private:
83 DECLARE_DYNAMIC_CLASS(wxGraphicsPen)
84 };
85
86 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen;
87
88 class WXDLLIMPEXP_CORE wxGraphicsBrush : public wxGraphicsObject
89 {
90 public:
91 wxGraphicsBrush() {}
92 virtual ~wxGraphicsBrush() {}
93 private:
94 DECLARE_DYNAMIC_CLASS(wxGraphicsBrush)
95 };
96
97 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush;
98
99 class WXDLLIMPEXP_CORE wxGraphicsFont : public wxGraphicsObject
100 {
101 public:
102 wxGraphicsFont() {}
103 virtual ~wxGraphicsFont() {}
104 private:
105 DECLARE_DYNAMIC_CLASS(wxGraphicsFont)
106 };
107
108 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont;
109
110 class WXDLLIMPEXP_CORE wxGraphicsBitmap : public wxGraphicsObject
111 {
112 public:
113 wxGraphicsBitmap() {}
114 virtual ~wxGraphicsBitmap() {}
115 private:
116 DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap)
117 };
118
119 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap;
120
121 class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject
122 {
123 public:
124 wxGraphicsMatrix() {}
125
126 virtual ~wxGraphicsMatrix() {}
127
128 // concatenates the matrix
129 virtual void Concat( const wxGraphicsMatrix *t );
130 void Concat( const wxGraphicsMatrix &t ) { Concat( &t ); }
131
132 // sets the matrix to the respective values
133 virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
134 wxDouble tx=0.0, wxDouble ty=0.0);
135
136 // gets the component valuess of the matrix
137 virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL,
138 wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const;
139
140 // makes this the inverse matrix
141 virtual void Invert();
142
143 // returns true if the elements of the transformation matrix are equal ?
144 virtual bool IsEqual( const wxGraphicsMatrix* t) const;
145 bool IsEqual( const wxGraphicsMatrix& t) const { return IsEqual( &t ); }
146
147 // return true if this is the identity matrix
148 virtual bool IsIdentity() const;
149
150 //
151 // transformation
152 //
153
154 // add the translation to this matrix
155 virtual void Translate( wxDouble dx , wxDouble dy );
156
157 // add the scale to this matrix
158 virtual void Scale( wxDouble xScale , wxDouble yScale );
159
160 // add the rotation to this matrix (radians)
161 virtual void Rotate( wxDouble angle );
162
163 //
164 // apply the transforms
165 //
166
167 // applies that matrix to the point
168 virtual void TransformPoint( wxDouble *x, wxDouble *y ) const;
169
170 // applies the matrix except for translations
171 virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const;
172
173 // returns the native representation
174 virtual void * GetNativeMatrix() const;
175
176 const wxGraphicsMatrixData* GetMatrixData() const
177 { return (const wxGraphicsMatrixData*) GetRefData(); }
178 wxGraphicsMatrixData* GetMatrixData()
179 { return (wxGraphicsMatrixData*) GetRefData(); }
180
181 private:
182 DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix)
183 };
184
185 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix;
186
187 class WXDLLIMPEXP_CORE wxGraphicsPath : public wxGraphicsObject
188 {
189 public:
190 wxGraphicsPath() {}
191 virtual ~wxGraphicsPath() {}
192
193 //
194 // These are the path primitives from which everything else can be constructed
195 //
196
197 // begins a new subpath at (x,y)
198 virtual void MoveToPoint( wxDouble x, wxDouble y );
199 void MoveToPoint( const wxPoint2DDouble& p);
200
201 // adds a straight line from the current point to (x,y)
202 virtual void AddLineToPoint( wxDouble x, wxDouble y );
203 void AddLineToPoint( const wxPoint2DDouble& p);
204
205 // adds a cubic Bezier curve from the current point, using two control points and an end point
206 virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y );
207 void AddCurveToPoint( const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e);
208
209 // adds another path
210 virtual void AddPath( const wxGraphicsPath& path );
211
212 // closes the current sub-path
213 virtual void CloseSubpath();
214
215 // gets the last point of the current path, (0,0) if not yet set
216 virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const;
217 wxPoint2DDouble GetCurrentPoint() const;
218
219 // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle
220 virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise );
221 void AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise);
222
223 //
224 // These are convenience functions which - if not available natively will be assembled
225 // using the primitives from above
226 //
227
228 // adds a quadratic Bezier curve from the current point, using a control point and an end point
229 virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y );
230
231 // appends a rectangle as a new closed subpath
232 virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h );
233
234 // appends an ellipsis as a new closed subpath fitting the passed rectangle
235 virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r );
236
237 // 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)
238 virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r );
239
240 // appends an ellipse
241 virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
242
243 // appends a rounded rectangle
244 virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
245
246 // returns the native path
247 virtual void * GetNativePath() const;
248
249 // give the native path returned by GetNativePath() back (there might be some deallocations necessary)
250 virtual void UnGetNativePath(void *p)const;
251
252 // transforms each point of this path by the matrix
253 virtual void Transform( const wxGraphicsMatrix& matrix );
254
255 // gets the bounding box enclosing all points (possibly including control points)
256 virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)const;
257 wxRect2DDouble GetBox()const;
258
259 virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE)const;
260 bool Contains( const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE)const;
261
262 const wxGraphicsPathData* GetPathData() const
263 { return (const wxGraphicsPathData*) GetRefData(); }
264 wxGraphicsPathData* GetPathData()
265 { return (wxGraphicsPathData*) GetRefData(); }
266
267 private:
268 DECLARE_DYNAMIC_CLASS(wxGraphicsPath)
269 };
270
271 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath;
272
273
274 class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject
275 {
276 public:
277 wxGraphicsContext(wxGraphicsRenderer* renderer);
278
279 virtual ~wxGraphicsContext();
280
281 static wxGraphicsContext* Create( const wxWindowDC& dc);
282 static wxGraphicsContext * Create( const wxMemoryDC& dc);
283 #if wxUSE_PRINTING_ARCHITECTURE
284 static wxGraphicsContext * Create( const wxPrinterDC& dc);
285 #endif
286
287 static wxGraphicsContext* CreateFromNative( void * context );
288
289 static wxGraphicsContext* CreateFromNativeWindow( void * window );
290
291 static wxGraphicsContext* Create( wxWindow* window );
292
293 // create a context that can be used for measuring texts only, no drawing allowed
294 static wxGraphicsContext * Create();
295
296 // begin a new document (relevant only for printing / pdf etc) if there is a progress dialog, message will be shown
297 virtual bool StartDoc( const wxString& message );
298
299 // done with that document (relevant only for printing / pdf etc)
300 virtual void EndDoc();
301
302 // opens a new page (relevant only for printing / pdf etc) with the given size in points
303 // (if both are null the default page size will be used)
304 virtual void StartPage( wxDouble width = 0, wxDouble height = 0 );
305
306 // ends the current page (relevant only for printing / pdf etc)
307 virtual void EndPage();
308
309 // make sure that the current content of this context is immediately visible
310 virtual void Flush();
311
312 wxGraphicsPath CreatePath() const;
313
314 virtual wxGraphicsPen CreatePen(const wxPen& pen) const;
315
316 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) const;
317
318 // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
319 virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
320 const wxColour&c1, const wxColour&c2) const;
321
322 // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc)
323 // with radius r and color cColor
324 virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius,
325 const wxColour &oColor, const wxColour &cColor) const;
326
327 // sets the font
328 virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) const;
329
330 // create a native bitmap representation
331 virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const;
332
333 // create a native bitmap representation
334 virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const;
335
336 // create a 'native' matrix corresponding to these values
337 virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
338 wxDouble tx=0.0, wxDouble ty=0.0) const;
339
340 // push the current state of the context, ie the transformation matrix on a stack
341 virtual void PushState() = 0;
342
343 // pops a stored state from the stack
344 virtual void PopState() = 0;
345
346 // clips drawings to the region intersected with the current clipping region
347 virtual void Clip( const wxRegion &region ) = 0;
348
349 // clips drawings to the rect intersected with the current clipping region
350 virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
351
352 // resets the clipping to original extent
353 virtual void ResetClip() = 0;
354
355 // returns the native context
356 virtual void * GetNativeContext() = 0;
357
358 // returns the current logical function
359 virtual int GetLogicalFunction() const { return m_logicalFunction; }
360
361 // sets the current logical function, returns true if it supported
362 virtual bool SetLogicalFunction(int function);
363
364 // returns the size of the graphics context in device coordinates
365 virtual void GetSize( wxDouble* width, wxDouble* height);
366
367 // returns the resolution of the graphics context in device points per inch
368 virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY);
369
370 #if 0
371 // sets the current alpha on this context
372 virtual void SetAlpha( wxDouble alpha );
373
374 // returns the alpha on this context
375 virtual wxDouble GetAlpha() const;
376 #endif
377 //
378 // transformation : changes the current transformation matrix CTM of the context
379 //
380
381 // translate
382 virtual void Translate( wxDouble dx , wxDouble dy ) = 0;
383
384 // scale
385 virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0;
386
387 // rotate (radians)
388 virtual void Rotate( wxDouble angle ) = 0;
389
390 // concatenates this transform with the current transform of this context
391 virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) = 0;
392
393 // sets the transform of this context
394 virtual void SetTransform( const wxGraphicsMatrix& matrix ) = 0;
395
396 // gets the matrix of this context
397 virtual wxGraphicsMatrix GetTransform() const = 0;
398 //
399 // setting the paint
400 //
401
402 // sets the pen
403 virtual void SetPen( const wxGraphicsPen& pen );
404
405 void SetPen( const wxPen& pen );
406
407 // sets the brush for filling
408 virtual void SetBrush( const wxGraphicsBrush& brush );
409
410 void SetBrush( const wxBrush& brush );
411
412 // sets the font
413 virtual void SetFont( const wxGraphicsFont& font );
414
415 void SetFont( const wxFont& font, const wxColour& colour );
416
417
418 // strokes along a path with the current pen
419 virtual void StrokePath( const wxGraphicsPath& path ) = 0;
420
421 // fills a path with the current brush
422 virtual void FillPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE ) = 0;
423
424 // draws a path by first filling and then stroking
425 virtual void DrawPath( const wxGraphicsPath& path, int fillStyle = wxODDEVEN_RULE );
426
427 //
428 // text
429 //
430
431 void DrawText( const wxString &str, wxDouble x, wxDouble y )
432 { DoDrawText(str, x, y); }
433
434 void DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
435 { DoDrawRotatedText(str, x, y, angle); }
436
437 void DrawText( const wxString &str, wxDouble x, wxDouble y,
438 const wxGraphicsBrush& backgroundBrush )
439 { DoDrawFilledText(str, x, y, backgroundBrush); }
440
441 void DrawText( const wxString &str, wxDouble x, wxDouble y,
442 wxDouble angle, const wxGraphicsBrush& backgroundBrush )
443 { DoDrawRotatedFilledText(str, x, y, angle, backgroundBrush); }
444
445
446 virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height,
447 wxDouble *descent, wxDouble *externalLeading ) const = 0;
448
449 virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0;
450
451 //
452 // image support
453 //
454
455 #ifndef __WXGTK20__
456 virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
457 #endif
458
459 virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
460
461 virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
462
463 //
464 // convenience methods
465 //
466
467 // strokes a single line
468 virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
469
470 // stroke lines connecting each of the points
471 virtual void StrokeLines( size_t n, const wxPoint2DDouble *points);
472
473 // stroke disconnected lines from begin to end points
474 virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints);
475
476 // draws a polygon
477 virtual void DrawLines( size_t n, const wxPoint2DDouble *points, int fillStyle = wxODDEVEN_RULE );
478
479 // draws a polygon
480 virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
481
482 // draws an ellipse
483 virtual void DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
484
485 // draws a rounded rectangle
486 virtual void DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
487
488 // wrappers using wxPoint2DDouble TODO
489
490 // helper to determine if a 0.5 offset should be applied for the drawing operation
491 virtual bool ShouldOffset() const { return false; }
492
493 protected:
494
495 wxGraphicsPen m_pen;
496 wxGraphicsBrush m_brush;
497 wxGraphicsFont m_font;
498 int m_logicalFunction;
499
500 private:
501 // implementations of overloaded public functions: we use different names
502 // for them to avoid the virtual function hiding problems in the derived
503 // classes
504 virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y) = 0;
505 virtual void DoDrawRotatedText(const wxString& str, wxDouble x, wxDouble y,
506 wxDouble angle);
507 virtual void DoDrawFilledText(const wxString& str, wxDouble x, wxDouble y,
508 const wxGraphicsBrush& backgroundBrush);
509 virtual void DoDrawRotatedFilledText(const wxString& str,
510 wxDouble x, wxDouble y,
511 wxDouble angle,
512 const wxGraphicsBrush& backgroundBrush);
513
514 DECLARE_NO_COPY_CLASS(wxGraphicsContext)
515 DECLARE_ABSTRACT_CLASS(wxGraphicsContext)
516 };
517
518 #if 0
519
520 //
521 // A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements
522 //
523
524 class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject
525 {
526 public:
527 wxGraphicsFigure(wxGraphicsRenderer* renderer);
528
529 virtual ~wxGraphicsFigure();
530
531 void SetPath( wxGraphicsMatrix* matrix );
532
533 void SetMatrix( wxGraphicsPath* path);
534
535 // draws this object on the context
536 virtual void Draw( wxGraphicsContext* cg );
537
538 // returns the path of this object
539 wxGraphicsPath* GetPath() { return m_path; }
540
541 // returns the transformation matrix of this object, may be null if there is no transformation necessary
542 wxGraphicsMatrix* GetMatrix() { return m_matrix; }
543
544 private:
545 wxGraphicsMatrix* m_matrix;
546 wxGraphicsPath* m_path;
547
548 DECLARE_DYNAMIC_CLASS(wxGraphicsFigure)
549 };
550
551 #endif
552
553 //
554 // The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer
555 // instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional
556 // paths at any point from a given matrix etc.
557 //
558
559 class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject
560 {
561 public:
562 wxGraphicsRenderer() {}
563
564 virtual ~wxGraphicsRenderer() {}
565
566 static wxGraphicsRenderer* GetDefaultRenderer();
567
568 // Context
569
570 virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0;
571 virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0;
572 #if wxUSE_PRINTING_ARCHITECTURE
573 virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
574 #endif
575
576 virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;
577
578 virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0;
579
580 virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0;
581
582 // create a context that can be used for measuring texts only, no drawing allowed
583 virtual wxGraphicsContext * CreateMeasuringContext() = 0;
584
585 // Path
586
587 virtual wxGraphicsPath CreatePath() = 0;
588
589 // Matrix
590
591 virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
592 wxDouble tx=0.0, wxDouble ty=0.0) = 0;
593
594 // Paints
595
596 virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
597
598 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0;
599
600 // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
601 virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
602 const wxColour&c1, const wxColour&c2) = 0;
603
604 // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc)
605 // with radius r and color cColor
606 virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius,
607 const wxColour &oColor, const wxColour &cColor) = 0;
608
609 // sets the font
610 virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0;
611
612 #ifndef __WXGTK20__
613 // create a native bitmap representation
614 virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
615
616 // create a subimage from a native image representation
617 virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
618 #endif
619
620
621 private:
622 DECLARE_NO_COPY_CLASS(wxGraphicsRenderer)
623 DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer)
624 };
625
626 #endif
627
628 #endif // _WX_GRAPHICS_H_