1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     graphics context header 
   4 // Author:      Stefan Csomor 
   7 // Copyright:   (c) Stefan Csomor 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #ifndef _WX_GRAPHICS_H_ 
  13 #define _WX_GRAPHICS_H_ 
  17 #if wxUSE_GRAPHICS_CONTEXT 
  19 #include "wx/geometry.h" 
  20 #include "wx/dynarray.h" 
  25     wxANTIALIAS_NONE
, // should be 0 
  29 enum wxCompositionMode
 
  31     // R = Result, S = Source, D = Destination, premultiplied with alpha 
  32     // Ra, Sa, Da their alpha components 
  34     // classic Porter-Duff compositions 
  35     // http://keithp.com/~keithp/porterduff/p253-porter.pdf 
  37     wxCOMPOSITION_CLEAR
, /* R = 0 */ 
  38     wxCOMPOSITION_SOURCE
, /* R = S */ 
  39     wxCOMPOSITION_OVER
, /* R = S + D*(1 - Sa) */ 
  40     wxCOMPOSITION_IN
, /* R = S*Da */ 
  41     wxCOMPOSITION_OUT
, /* R = S*(1 - Da) */ 
  42     wxCOMPOSITION_ATOP
, /* R = S*Da + D*(1 - Sa) */ 
  44     wxCOMPOSITION_DEST
, /* R = D, essentially a noop */ 
  45     wxCOMPOSITION_DEST_OVER
, /* R = S*(1 - Da) + D */ 
  46     wxCOMPOSITION_DEST_IN
, /* R = D*Sa */ 
  47     wxCOMPOSITION_DEST_OUT
, /* R = D*(1 - Sa) */ 
  48     wxCOMPOSITION_DEST_ATOP
, /* R = S*(1 - Da) + D*Sa */ 
  49     wxCOMPOSITION_XOR
, /* R = S*(1 - Da) + D*(1 - Sa) */ 
  51     // mathematical compositions 
  52     wxCOMPOSITION_ADD
, /* R = S + D */ 
  55 class WXDLLIMPEXP_FWD_CORE wxWindowDC
; 
  56 class WXDLLIMPEXP_FWD_CORE wxMemoryDC
; 
  57 #if wxUSE_PRINTING_ARCHITECTURE 
  58 class WXDLLIMPEXP_FWD_CORE wxPrinterDC
; 
  60 class WXDLLIMPEXP_FWD_CORE wxGraphicsContext
; 
  61 class WXDLLIMPEXP_FWD_CORE wxGraphicsPath
; 
  62 class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrix
; 
  63 class WXDLLIMPEXP_FWD_CORE wxGraphicsFigure
; 
  64 class WXDLLIMPEXP_FWD_CORE wxGraphicsRenderer
; 
  65 class WXDLLIMPEXP_FWD_CORE wxGraphicsPen
; 
  66 class WXDLLIMPEXP_FWD_CORE wxGraphicsBrush
; 
  67 class WXDLLIMPEXP_FWD_CORE wxGraphicsFont
; 
  68 class WXDLLIMPEXP_FWD_CORE wxGraphicsBitmap
; 
  71  * notes about the graphics context apis 
  73  * angles : are measured in radians, 0.0 being in direction of positiv x axis, PI/2 being 
  74  * in direction of positive y axis. 
  77 // Base class of all objects used for drawing in the new graphics API, the always point back to their 
  78 // originating rendering engine, there is no dynamic unloading of a renderer currently allowed, 
  79 // these references are not counted 
  82 // The data used by objects like graphics pens etc is ref counted, in order to avoid unnecessary expensive 
  83 // duplication. Any operation on a shared instance that results in a modified state, uncouples this 
  84 // instance from the other instances that were shared - using copy on write semantics 
  87 class WXDLLIMPEXP_FWD_CORE wxGraphicsObjectRefData
; 
  88 class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrixData
; 
  89 class WXDLLIMPEXP_FWD_CORE wxGraphicsPathData
; 
  91 class WXDLLIMPEXP_CORE wxGraphicsObject 
: public wxObject
 
  95     wxGraphicsObject( wxGraphicsRenderer
* renderer 
); 
  96     virtual ~wxGraphicsObject(); 
 100     // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet 
 101     wxGraphicsRenderer
* GetRenderer() const; 
 102     wxGraphicsObjectRefData
* GetGraphicsData() const; 
 104     virtual wxObjectRefData
* CreateRefData() const; 
 105     virtual wxObjectRefData
* CloneRefData(const wxObjectRefData
* data
) const; 
 107     DECLARE_DYNAMIC_CLASS(wxGraphicsObject
) 
 110 class WXDLLIMPEXP_CORE wxGraphicsPen 
: public wxGraphicsObject
 
 114     virtual ~wxGraphicsPen() {} 
 116     DECLARE_DYNAMIC_CLASS(wxGraphicsPen
) 
 119 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen
) wxNullGraphicsPen
; 
 121 class WXDLLIMPEXP_CORE wxGraphicsBrush 
: public wxGraphicsObject
 
 125     virtual ~wxGraphicsBrush() {} 
 127     DECLARE_DYNAMIC_CLASS(wxGraphicsBrush
) 
 130 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush
) wxNullGraphicsBrush
; 
 132 class WXDLLIMPEXP_CORE wxGraphicsFont 
: public wxGraphicsObject
 
 136     virtual ~wxGraphicsFont() {} 
 138     DECLARE_DYNAMIC_CLASS(wxGraphicsFont
) 
 141 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsFont
) wxNullGraphicsFont
; 
 143 class WXDLLIMPEXP_CORE wxGraphicsBitmap 
: public wxGraphicsObject
 
 146     wxGraphicsBitmap() {} 
 147     virtual ~wxGraphicsBitmap() {} 
 149     DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap
) 
 152 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap
) wxNullGraphicsBitmap
; 
 154 class WXDLLIMPEXP_CORE wxGraphicsMatrix 
: public wxGraphicsObject
 
 157     wxGraphicsMatrix() {} 
 159     virtual ~wxGraphicsMatrix() {} 
 161     // concatenates the matrix 
 162     virtual void Concat( const wxGraphicsMatrix 
*t 
); 
 163     void Concat( const wxGraphicsMatrix 
&t 
) { Concat( &t 
); } 
 165     // sets the matrix to the respective values 
 166     virtual void Set(wxDouble a
=1.0, wxDouble b
=0.0, wxDouble c
=0.0, wxDouble d
=1.0, 
 167         wxDouble tx
=0.0, wxDouble ty
=0.0); 
 169     // gets the component valuess of the matrix 
 170     virtual void Get(wxDouble
* a
=NULL
, wxDouble
* b
=NULL
,  wxDouble
* c
=NULL
, 
 171                      wxDouble
* d
=NULL
, wxDouble
* tx
=NULL
, wxDouble
* ty
=NULL
) const; 
 173     // makes this the inverse matrix 
 174     virtual void Invert(); 
 176     // returns true if the elements of the transformation matrix are equal ? 
 177     virtual bool IsEqual( const wxGraphicsMatrix
* t
) const; 
 178     bool IsEqual( const wxGraphicsMatrix
& t
) const { return IsEqual( &t 
); } 
 180     // return true if this is the identity matrix 
 181     virtual bool IsIdentity() const; 
 187     // add the translation to this matrix 
 188     virtual void Translate( wxDouble dx 
, wxDouble dy 
); 
 190     // add the scale to this matrix 
 191     virtual void Scale( wxDouble xScale 
, wxDouble yScale 
); 
 193     // add the rotation to this matrix (radians) 
 194     virtual void Rotate( wxDouble angle 
); 
 197     // apply the transforms 
 200     // applies that matrix to the point 
 201     virtual void TransformPoint( wxDouble 
*x
, wxDouble 
*y 
) const; 
 203     // applies the matrix except for translations 
 204     virtual void TransformDistance( wxDouble 
*dx
, wxDouble 
*dy 
) const; 
 206     // returns the native representation 
 207     virtual void * GetNativeMatrix() const; 
 209     const wxGraphicsMatrixData
* GetMatrixData() const 
 210     { return (const wxGraphicsMatrixData
*) GetRefData(); } 
 211     wxGraphicsMatrixData
* GetMatrixData() 
 212     { return (wxGraphicsMatrixData
*) GetRefData(); } 
 215     DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix
) 
 218 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix
) wxNullGraphicsMatrix
; 
 220 class WXDLLIMPEXP_CORE wxGraphicsPath 
: public wxGraphicsObject
 
 224     virtual ~wxGraphicsPath() {} 
 227     // These are the path primitives from which everything else can be constructed 
 230     // begins a new subpath at (x,y) 
 231     virtual void MoveToPoint( wxDouble x
, wxDouble y 
); 
 232     void MoveToPoint( const wxPoint2DDouble
& p
); 
 234     // adds a straight line from the current point to (x,y) 
 235     virtual void AddLineToPoint( wxDouble x
, wxDouble y 
); 
 236     void AddLineToPoint( const wxPoint2DDouble
& p
); 
 238     // adds a cubic Bezier curve from the current point, using two control points and an end point 
 239     virtual void AddCurveToPoint( wxDouble cx1
, wxDouble cy1
, wxDouble cx2
, wxDouble cy2
, wxDouble x
, wxDouble y 
); 
 240     void AddCurveToPoint( const wxPoint2DDouble
& c1
, const wxPoint2DDouble
& c2
, const wxPoint2DDouble
& e
); 
 243     virtual void AddPath( const wxGraphicsPath
& path 
); 
 245     // closes the current sub-path 
 246     virtual void CloseSubpath(); 
 248     // gets the last point of the current path, (0,0) if not yet set 
 249     virtual void GetCurrentPoint( wxDouble
* x
, wxDouble
* y
) const; 
 250     wxPoint2DDouble 
GetCurrentPoint() const; 
 252     // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle 
 253     virtual void AddArc( wxDouble x
, wxDouble y
, wxDouble r
, wxDouble startAngle
, wxDouble endAngle
, bool clockwise 
); 
 254     void AddArc( const wxPoint2DDouble
& c
, wxDouble r
, wxDouble startAngle
, wxDouble endAngle
, bool clockwise
); 
 257     // These are convenience functions which - if not available natively will be assembled 
 258     // using the primitives from above 
 261     // adds a quadratic Bezier curve from the current point, using a control point and an end point 
 262     virtual void AddQuadCurveToPoint( wxDouble cx
, wxDouble cy
, wxDouble x
, wxDouble y 
); 
 264     // appends a rectangle as a new closed subpath 
 265     virtual void AddRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h 
); 
 267     // appends an ellipsis as a new closed subpath fitting the passed rectangle 
 268     virtual void AddCircle( wxDouble x
, wxDouble y
, wxDouble r 
); 
 270     // 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) 
 271     virtual void AddArcToPoint( wxDouble x1
, wxDouble y1 
, wxDouble x2
, wxDouble y2
, wxDouble r 
); 
 273     // appends an ellipse 
 274     virtual void AddEllipse( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
); 
 276     // appends a rounded rectangle 
 277     virtual void AddRoundedRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
, wxDouble radius
); 
 279     // returns the native path 
 280     virtual void * GetNativePath() const; 
 282     // give the native path returned by GetNativePath() back (there might be some deallocations necessary) 
 283     virtual void UnGetNativePath(void *p
)const; 
 285     // transforms each point of this path by the matrix 
 286     virtual void Transform( const wxGraphicsMatrix
& matrix 
); 
 288     // gets the bounding box enclosing all points (possibly including control points) 
 289     virtual void GetBox(wxDouble 
*x
, wxDouble 
*y
, wxDouble 
*w
, wxDouble 
*h
)const; 
 290     wxRect2DDouble 
GetBox()const; 
 292     virtual bool Contains( wxDouble x
, wxDouble y
, wxPolygonFillMode fillStyle 
= wxODDEVEN_RULE
)const; 
 293     bool Contains( const wxPoint2DDouble
& c
, wxPolygonFillMode fillStyle 
= wxODDEVEN_RULE
)const; 
 295     const wxGraphicsPathData
* GetPathData() const 
 296     { return (const wxGraphicsPathData
*) GetRefData(); } 
 297     wxGraphicsPathData
* GetPathData() 
 298     { return (wxGraphicsPathData
*) GetRefData(); } 
 301     DECLARE_DYNAMIC_CLASS(wxGraphicsPath
) 
 304 extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath
) wxNullGraphicsPath
; 
 307 class WXDLLIMPEXP_CORE wxGraphicsContext 
: public wxGraphicsObject
 
 310     wxGraphicsContext(wxGraphicsRenderer
* renderer
); 
 312     virtual ~wxGraphicsContext(); 
 314     static wxGraphicsContext
* Create( const wxWindowDC
& dc
); 
 315     static wxGraphicsContext 
* Create( const wxMemoryDC
& dc
); 
 316 #if wxUSE_PRINTING_ARCHITECTURE 
 317     static wxGraphicsContext 
* Create( const wxPrinterDC
& dc
); 
 320     static wxGraphicsContext
* CreateFromNative( void * context 
); 
 322     static wxGraphicsContext
* CreateFromNativeWindow( void * window 
); 
 324     static wxGraphicsContext
* Create( wxWindow
* window 
); 
 326     // create a context that can be used for measuring texts only, no drawing allowed 
 327     static wxGraphicsContext 
* Create(); 
 329     // begin a new document (relevant only for printing / pdf etc) if there is a progress dialog, message will be shown 
 330     virtual bool StartDoc( const wxString
& message 
); 
 332     // done with that document (relevant only for printing / pdf etc) 
 333     virtual void EndDoc(); 
 335     // opens a new page  (relevant only for printing / pdf etc) with the given size in points 
 336     // (if both are null the default page size will be used) 
 337     virtual void StartPage( wxDouble width 
= 0, wxDouble height 
= 0 ); 
 339     // ends the current page  (relevant only for printing / pdf etc) 
 340     virtual void EndPage(); 
 342     // make sure that the current content of this context is immediately visible 
 343     virtual void Flush(); 
 345     wxGraphicsPath 
CreatePath() const; 
 347     virtual wxGraphicsPen 
CreatePen(const wxPen
& pen
) const; 
 349     virtual wxGraphicsBrush 
CreateBrush(const wxBrush
& brush 
) const; 
 351     // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 
 352     virtual wxGraphicsBrush 
CreateLinearGradientBrush( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
, 
 353         const wxColour
&c1
, const wxColour
&c2
) const; 
 355     // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) 
 356     // with radius r and color cColor 
 357     virtual wxGraphicsBrush 
CreateRadialGradientBrush( wxDouble xo
, wxDouble yo
, wxDouble xc
, wxDouble yc
, wxDouble radius
, 
 358         const wxColour 
&oColor
, const wxColour 
&cColor
) const; 
 361     virtual wxGraphicsFont 
CreateFont( const wxFont 
&font 
, const wxColour 
&col 
= *wxBLACK 
) const; 
 363     // create a native bitmap representation 
 364     virtual wxGraphicsBitmap 
CreateBitmap( const wxBitmap 
&bitmap 
) const; 
 366     // create a native bitmap representation 
 367     virtual wxGraphicsBitmap 
CreateSubBitmap( const wxGraphicsBitmap 
&bitmap
, wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h  
) const; 
 369     // create a 'native' matrix corresponding to these values 
 370     virtual wxGraphicsMatrix 
CreateMatrix( wxDouble a
=1.0, wxDouble b
=0.0, wxDouble c
=0.0, wxDouble d
=1.0, 
 371         wxDouble tx
=0.0, wxDouble ty
=0.0) const; 
 373     // push the current state of the context, ie the transformation matrix on a stack 
 374     virtual void PushState() = 0; 
 376     // pops a stored state from the stack 
 377     virtual void PopState() = 0; 
 379     // clips drawings to the region intersected with the current clipping region 
 380     virtual void Clip( const wxRegion 
®ion 
) = 0; 
 382     // clips drawings to the rect intersected with the current clipping region 
 383     virtual void Clip( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h 
) = 0; 
 385     // resets the clipping to original extent 
 386     virtual void ResetClip() = 0; 
 388     // returns the native context 
 389     virtual void * GetNativeContext() = 0; 
 391     // returns the current shape antialiasing mode 
 392     virtual wxAntialiasMode 
GetAntialiasMode() const { return m_antialias
; } 
 394     // sets the antialiasing mode, returns true if it supported 
 395     virtual bool SetAntialiasMode(wxAntialiasMode antialias
) = 0; 
 397     // returns the current compositing operator 
 398     virtual wxCompositionMode 
GetCompositionMode() const { return m_composition
; } 
 400     // sets the compositing operator, returns true if it supported 
 401     virtual bool SetCompositionMode(wxCompositionMode op
) = 0; 
 403     // returns the size of the graphics context in device coordinates 
 404     virtual void GetSize( wxDouble
* width
, wxDouble
* height
); 
 406     // returns the resolution of the graphics context in device points per inch 
 407     virtual void GetDPI( wxDouble
* dpiX
, wxDouble
* dpiY
); 
 410     // sets the current alpha on this context 
 411     virtual void SetAlpha( wxDouble alpha 
); 
 413     // returns the alpha on this context 
 414     virtual wxDouble 
GetAlpha() const; 
 417     // all rendering is done into a fully transparent temporary context 
 418     virtual void BeginLayer(wxDouble opacity
) = 0; 
 420     // composites back the drawings into the context with the opacity given at  
 421     // the BeginLayer call 
 422     virtual void EndLayer() = 0; 
 425     // transformation : changes the current transformation matrix CTM of the context 
 429     virtual void Translate( wxDouble dx 
, wxDouble dy 
) = 0; 
 432     virtual void Scale( wxDouble xScale 
, wxDouble yScale 
) = 0; 
 435     virtual void Rotate( wxDouble angle 
) = 0; 
 437     // concatenates this transform with the current transform of this context 
 438     virtual void ConcatTransform( const wxGraphicsMatrix
& matrix 
) = 0; 
 440     // sets the transform of this context 
 441     virtual void SetTransform( const wxGraphicsMatrix
& matrix 
) = 0; 
 443     // gets the matrix of this context 
 444     virtual wxGraphicsMatrix 
GetTransform() const = 0; 
 450     virtual void SetPen( const wxGraphicsPen
& pen 
); 
 452     void SetPen( const wxPen
& pen 
); 
 454     // sets the brush for filling 
 455     virtual void SetBrush( const wxGraphicsBrush
& brush 
); 
 457     void SetBrush( const wxBrush
& brush 
); 
 460     virtual void SetFont( const wxGraphicsFont
& font 
); 
 462     void SetFont( const wxFont
& font
, const wxColour
& colour 
); 
 465     // strokes along a path with the current pen 
 466     virtual void StrokePath( const wxGraphicsPath
& path 
) = 0; 
 468     // fills a path with the current brush 
 469     virtual void FillPath( const wxGraphicsPath
& path
, wxPolygonFillMode fillStyle 
= wxODDEVEN_RULE 
) = 0; 
 471     // draws a path by first filling and then stroking 
 472     virtual void DrawPath( const wxGraphicsPath
& path
, wxPolygonFillMode fillStyle 
= wxODDEVEN_RULE 
); 
 478     void DrawText( const wxString 
&str
, wxDouble x
, wxDouble y 
) 
 479         { DoDrawText(str
, x
, y
); } 
 481     void DrawText( const wxString 
&str
, wxDouble x
, wxDouble y
, wxDouble angle 
) 
 482         { DoDrawRotatedText(str
, x
, y
, angle
); } 
 484     void DrawText( const wxString 
&str
, wxDouble x
, wxDouble y
, 
 485                    const wxGraphicsBrush
& backgroundBrush 
) 
 486         { DoDrawFilledText(str
, x
, y
, backgroundBrush
); } 
 488     void DrawText( const wxString 
&str
, wxDouble x
, wxDouble y
, 
 489                    wxDouble angle
, const wxGraphicsBrush
& backgroundBrush 
) 
 490         { DoDrawRotatedFilledText(str
, x
, y
, angle
, backgroundBrush
); } 
 493     virtual void GetTextExtent( const wxString 
&text
, wxDouble 
*width
, wxDouble 
*height
, 
 494         wxDouble 
*descent
, wxDouble 
*externalLeading 
) const  = 0; 
 496     virtual void GetPartialTextExtents(const wxString
& text
, wxArrayDouble
& widths
) const = 0; 
 503     virtual void DrawBitmap( const wxGraphicsBitmap 
&bmp
, wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h 
) = 0; 
 506     virtual void DrawBitmap( const wxBitmap 
&bmp
, wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h 
) = 0; 
 508     virtual void DrawIcon( const wxIcon 
&icon
, wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h 
) = 0; 
 511     // convenience methods 
 514     // strokes a single line 
 515     virtual void StrokeLine( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
); 
 517     // stroke lines connecting each of the points 
 518     virtual void StrokeLines( size_t n
, const wxPoint2DDouble 
*points
); 
 520     // stroke disconnected lines from begin to end points 
 521     virtual void StrokeLines( size_t n
, const wxPoint2DDouble 
*beginPoints
, const wxPoint2DDouble 
*endPoints
); 
 524     virtual void DrawLines( size_t n
, const wxPoint2DDouble 
*points
, wxPolygonFillMode fillStyle 
= wxODDEVEN_RULE 
); 
 527     virtual void DrawRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
); 
 530     virtual void DrawEllipse( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
); 
 532     // draws a rounded rectangle 
 533     virtual void DrawRoundedRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
, wxDouble radius
); 
 535      // wrappers using wxPoint2DDouble TODO 
 537     // helper to determine if a 0.5 offset should be applied for the drawing operation 
 538     virtual bool ShouldOffset() const { return false; } 
 543     wxGraphicsBrush m_brush
; 
 544     wxGraphicsFont m_font
; 
 545     wxAntialiasMode m_antialias
; 
 546     wxCompositionMode m_composition
; 
 549     // implementations of overloaded public functions: we use different names 
 550     // for them to avoid the virtual function hiding problems in the derived 
 552     virtual void DoDrawText(const wxString
& str
, wxDouble x
, wxDouble y
) = 0; 
 553     virtual void DoDrawRotatedText(const wxString
& str
, wxDouble x
, wxDouble y
, 
 555     virtual void DoDrawFilledText(const wxString
& str
, wxDouble x
, wxDouble y
, 
 556                                   const wxGraphicsBrush
& backgroundBrush
); 
 557     virtual void DoDrawRotatedFilledText(const wxString
& str
, 
 558                                          wxDouble x
, wxDouble y
, 
 560                                          const wxGraphicsBrush
& backgroundBrush
); 
 562     wxDECLARE_NO_COPY_CLASS(wxGraphicsContext
); 
 563     DECLARE_ABSTRACT_CLASS(wxGraphicsContext
) 
 569 // A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements 
 572 class WXDLLIMPEXP_CORE wxGraphicsFigure 
: public wxGraphicsObject
 
 575     wxGraphicsFigure(wxGraphicsRenderer
* renderer
); 
 577     virtual ~wxGraphicsFigure(); 
 579     void SetPath( wxGraphicsMatrix
* matrix 
); 
 581     void SetMatrix( wxGraphicsPath
* path
); 
 583     // draws this object on the context 
 584     virtual void Draw( wxGraphicsContext
* cg 
); 
 586     // returns the path of this object 
 587     wxGraphicsPath
* GetPath() { return m_path
; } 
 589     // returns the transformation matrix of this object, may be null if there is no transformation necessary 
 590     wxGraphicsMatrix
* GetMatrix() { return m_matrix
; } 
 593     wxGraphicsMatrix
* m_matrix
; 
 594     wxGraphicsPath
* m_path
; 
 596     DECLARE_DYNAMIC_CLASS(wxGraphicsFigure
) 
 602 // The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer 
 603 // instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional 
 604 // paths at any point from a given matrix etc. 
 607 class WXDLLIMPEXP_CORE wxGraphicsRenderer 
: public wxObject
 
 610     wxGraphicsRenderer() {} 
 612     virtual ~wxGraphicsRenderer() {} 
 614     static wxGraphicsRenderer
* GetDefaultRenderer(); 
 618     virtual wxGraphicsContext 
* CreateContext( const wxWindowDC
& dc
) = 0; 
 619     virtual wxGraphicsContext 
* CreateContext( const wxMemoryDC
& dc
) = 0; 
 620 #if wxUSE_PRINTING_ARCHITECTURE 
 621     virtual wxGraphicsContext 
* CreateContext( const wxPrinterDC
& dc
) = 0; 
 624     virtual wxGraphicsContext 
* CreateContextFromNativeContext( void * context 
) = 0; 
 626     virtual wxGraphicsContext 
* CreateContextFromNativeWindow( void * window 
) = 0; 
 628     virtual wxGraphicsContext 
* CreateContext( wxWindow
* window 
) = 0; 
 630     // create a context that can be used for measuring texts only, no drawing allowed 
 631     virtual wxGraphicsContext 
* CreateMeasuringContext() = 0; 
 635     virtual wxGraphicsPath 
CreatePath() = 0; 
 639     virtual wxGraphicsMatrix 
CreateMatrix( wxDouble a
=1.0, wxDouble b
=0.0, wxDouble c
=0.0, wxDouble d
=1.0, 
 640         wxDouble tx
=0.0, wxDouble ty
=0.0) = 0; 
 644     virtual wxGraphicsPen 
CreatePen(const wxPen
& pen
) = 0; 
 646     virtual wxGraphicsBrush 
CreateBrush(const wxBrush
& brush 
) = 0; 
 648     // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2 
 649     virtual wxGraphicsBrush 
CreateLinearGradientBrush( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
, 
 650         const wxColour
&c1
, const wxColour
&c2
) = 0; 
 652     // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc) 
 653     // with radius r and color cColor 
 654     virtual wxGraphicsBrush 
CreateRadialGradientBrush( wxDouble xo
, wxDouble yo
, wxDouble xc
, wxDouble yc
, wxDouble radius
, 
 655         const wxColour 
&oColor
, const wxColour 
&cColor
) = 0; 
 658     virtual wxGraphicsFont 
CreateFont( const wxFont 
&font 
, const wxColour 
&col 
= *wxBLACK 
) = 0; 
 661     // create a native bitmap representation 
 662     virtual wxGraphicsBitmap 
CreateBitmap( const wxBitmap 
&bitmap 
) = 0; 
 664     // create a subimage from a native image representation 
 665     virtual wxGraphicsBitmap 
CreateSubBitmap( const wxGraphicsBitmap 
&bitmap
, wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h  
) = 0; 
 670     wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer
); 
 671     DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer
) 
 676 #endif // _WX_GRAPHICS_H_