From ea0775711c5234cea2d9fb52d2a4c7ee3e446c03 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 29 Apr 2008 10:12:41 +0000 Subject: [PATCH] Minor doc improvements git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/graphics.h | 51 +++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/interface/graphics.h b/interface/graphics.h index d1cdf137b2..921981596d 100644 --- a/interface/graphics.h +++ b/interface/graphics.h @@ -203,7 +203,7 @@ public: wxPaintDC dc(this); // Create graphics context from it - wxGraphicsContext *gc = wxGraphicsContext::CreateContext( dc ); + wxGraphicsContext *gc = wxGraphicsContext::Create( dc ); if (gc) { @@ -218,9 +218,9 @@ public: path.CloseSubpath(); path.AddRectangle(25.0, 25.0, 50.0, 50.0); - gc->StrokePath(path); + gc->StrokePath(path); - delete gc; + delete gc; } } @endcode @@ -515,7 +515,18 @@ public: @wxheader{graphics.h} A wxGraphicsRenderer is the instance corresponding to the rendering engine - used. There may be multiple instances on a system, if there are different rendering engines present, but there is always one instance per engine, eg there is ONE core graphics renderer instance on OSX. This instance is pointed back to by all objects created by it (wxGraphicsContext, wxGraphicsPath etc). Therefore you can create ag additional instances of paths etc. by calling GetRenderer() and then using the appropriate CreateXXX function. + used. There may be multiple instances on a system, if there are different + rendering engines present, but there is always only one instance per engine. + This instance is pointed back to by all objects created by it (wxGraphicsContext, + wxGraphicsPath etc) and can be retrieved through their wxGraphicsObject::GetRenderer() + method. Therefore you can create an additional instance of a path etc. by calling + wxGraphicsObject::GetRenderer() and then using the appropriate CreateXXX function + of that renderer. + + @code + wxGraphicsPath *path = // from somewhere + wxGraphicsBrush *brush = path->GetRenderer()->CreateBrush( *wxBLACK_BRUSH ); + @endcode @library{wxcore} @category{FIXME} @@ -524,21 +535,35 @@ class wxGraphicsRenderer : public wxObject { public: /** - Creates a native brush from a wxBrush. + Creates a wxGraphicsContext from a wxWindow. */ - wxGraphicsBrush CreateBrush(const wxBrush& brush); + virtual wxGraphicsContext* CreateContext(wxWindow* window) = 0; + + /** + Creates a wxGraphicsContext from a wxWindowDC + */ + virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ; + + /** + Creates a wxGraphicsContext from a wxMemoryDC + */ + virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0 ; + + /** + Creates a wxGraphicsContext from a wxPrinterDC + */ + virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0 ; - //@{ /** - Creates a wxGraphicsContext from a wxWindow. + Creates a native brush from a wxBrush. */ - wxGraphicsContext* CreateContext(const wxWindowDC& dc); - wxGraphicsContext* CreateContext(wxWindow* window); - //@} + wxGraphicsBrush CreateBrush(const wxBrush& brush); + /** Creates a wxGraphicsContext from a native context. This native context must be - eg a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus or a cairo_t pointer for cairo. + eg a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus or a cairo_t + pointer for cairo. */ wxGraphicsContext* CreateContextFromNativeContext(void* context); @@ -600,7 +625,7 @@ public: Returns the default renderer on this platform. On OS X this is the Core Graphics (a.k.a. Quartz 2D) renderer, on MSW the GDIPlus renderer, and on GTK we currently default to the cairo renderer. */ - wxGraphicsRenderer* GetDefaultRenderer(); + static wxGraphicsRenderer* GetDefaultRenderer(); }; -- 2.45.2