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