#if wxUSE_PRINTING_ARCHITECTURE
class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
#endif
+#ifdef __WXMSW__
#if wxUSE_ENH_METAFILE
class WXDLLIMPEXP_FWD_CORE wxEnhMetaFileDC;
#endif
+#endif
class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
class WXDLLIMPEXP_FWD_CORE wxGraphicsPath;
class WXDLLIMPEXP_FWD_CORE wxGraphicsMatrix;
#if wxUSE_PRINTING_ARCHITECTURE
static wxGraphicsContext * Create( const wxPrinterDC& dc);
#endif
+#ifdef __WXMSW__
#if wxUSE_ENH_METAFILE
static wxGraphicsContext * Create( const wxEnhMetaFileDC& dc);
+#endif
#endif
static wxGraphicsContext* CreateFromNative( void * context );
virtual bool SetCompositionMode(wxCompositionMode op) = 0;
// returns the size of the graphics context in device coordinates
- virtual void GetSize( wxDouble* width, wxDouble* height);
+ void GetSize(wxDouble* width, wxDouble* height)
+ {
+ if ( width )
+ *width = m_width;
+ if ( height )
+ *height = m_height;
+ }
// returns the resolution of the graphics context in device points per inch
virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY);
// helper to determine if a 0.5 offset should be applied for the drawing operation
virtual bool ShouldOffset() const { return false; }
-
+
+ // indicates whether the context should try to offset for pixel boundaries, this only makes sense on
+ // bitmap devices like screen, by default this is turned off
+ virtual void EnableOffset(bool enable = true);
+
+ void DisableOffset() { EnableOffset(false); }
+ bool OffsetEnabled() { return m_enableOffset; }
+
protected:
+ // These fields must be initialized in the derived class ctors.
+ wxDouble m_width,
+ m_height;
wxGraphicsPen m_pen;
wxGraphicsBrush m_brush;
wxGraphicsFont m_font;
wxAntialiasMode m_antialias;
wxCompositionMode m_composition;
+ bool m_enableOffset;
protected:
// implementations of overloaded public functions: we use different names
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) = 0;
#endif
+#ifdef __WXMSW__
#if wxUSE_ENH_METAFILE
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) = 0;
+#endif
#endif
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;