+ // helper to determine if a 0.5 offset should be applied for the drawing operation
+ virtual bool ShouldOffset() const { return false; }
+
+protected:
+
+ wxGraphicsPen m_pen;
+ wxGraphicsBrush m_brush;
+ wxGraphicsFont m_font;
+ wxAntialiasMode m_antialias;
+ wxCompositionMode m_composition;
+
+protected:
+ // implementations of overloaded public functions: we use different names
+ // for them to avoid the virtual function hiding problems in the derived
+ // classes
+ virtual void DoDrawText(const wxString& str, wxDouble x, wxDouble y) = 0;
+ virtual void DoDrawRotatedText(const wxString& str, wxDouble x, wxDouble y,
+ wxDouble angle);
+ virtual void DoDrawFilledText(const wxString& str, wxDouble x, wxDouble y,
+ const wxGraphicsBrush& backgroundBrush);
+ virtual void DoDrawRotatedFilledText(const wxString& str,
+ wxDouble x, wxDouble y,
+ wxDouble angle,
+ const wxGraphicsBrush& backgroundBrush);
+
+ wxDECLARE_NO_COPY_CLASS(wxGraphicsContext);
+ DECLARE_ABSTRACT_CLASS(wxGraphicsContext)
+};
+
+#if 0
+
+//
+// A graphics figure allows to cache path, pen etc creations, also will be a basis for layering/grouping elements
+//
+
+class WXDLLIMPEXP_CORE wxGraphicsFigure : public wxGraphicsObject
+{
+public:
+ wxGraphicsFigure(wxGraphicsRenderer* renderer);
+
+ virtual ~wxGraphicsFigure();
+
+ void SetPath( wxGraphicsMatrix* matrix );
+
+ void SetMatrix( wxGraphicsPath* path);
+
+ // draws this object on the context
+ virtual void Draw( wxGraphicsContext* cg );
+
+ // returns the path of this object
+ wxGraphicsPath* GetPath() { return m_path; }
+
+ // returns the transformation matrix of this object, may be null if there is no transformation necessary
+ wxGraphicsMatrix* GetMatrix() { return m_matrix; }
+
+private:
+ wxGraphicsMatrix* m_matrix;
+ wxGraphicsPath* m_path;
+
+ DECLARE_DYNAMIC_CLASS(wxGraphicsFigure)
+};
+
+#endif
+
+//
+// The graphics renderer is the instance corresponding to the rendering engine used, eg there is ONE core graphics renderer
+// instance on OSX. This instance is pointed back to by all objects created by it. Therefore you can create eg additional
+// paths at any point from a given matrix etc.
+//
+
+class WXDLLIMPEXP_CORE wxGraphicsRenderer : public wxObject
+{
+public:
+ wxGraphicsRenderer() {}
+
+ virtual ~wxGraphicsRenderer() {}
+
+ static wxGraphicsRenderer* GetDefaultRenderer();
+
+ // Context
+
+ virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0;
+ virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0;
+#if wxUSE_PRINTING_ARCHITECTURE
+ virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
+#endif
+
+ virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;
+
+ virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0;
+
+ virtual wxGraphicsContext * CreateContext( wxWindow* window ) = 0;
+
+ // create a context that can be used for measuring texts only, no drawing allowed
+ virtual wxGraphicsContext * CreateMeasuringContext() = 0;
+
+ // Path
+
+ virtual wxGraphicsPath CreatePath() = 0;
+
+ // Matrix
+
+ virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
+ wxDouble tx=0.0, wxDouble ty=0.0) = 0;
+
+ // Paints
+
+ virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
+
+ virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) = 0;
+
+ // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
+ virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
+ const wxColour&c1, const wxColour&c2) = 0;
+
+ // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc)
+ // with radius r and color cColor
+ virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius,
+ const wxColour &oColor, const wxColour &cColor) = 0;
+
+ // sets the font
+ virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) = 0;
+
+ // create a native bitmap representation
+ virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
+
+ // create a subimage from a native image representation
+ virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0;
+
+private:
+ wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer);
+ DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer)