#include "wx/module.h"
#endif
-#include "wx/graphics.h"
+#include "wx/private/graphics.h"
#include "wx/rawbmp.h"
#include <vector>
#endif
#ifdef __WXMAC__
-#include "wx/mac/private.h"
+#include "wx/osx/private.h"
#include <cairo-quartz.h>
#include <cairo-atsui.h>
#endif
public:
wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc );
wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc );
+ wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc );
#ifdef __WXGTK__
wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable );
#endif
bool m_offset;
} ;
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc )
+: wxGraphicsContext(renderer)
+{
+#ifdef __WXGTK20__
+ const wxDCImpl *impl = dc.GetImpl();
+ Init( (cairo_t*) impl->GetCairoContext() );
+
+ wxPoint org = dc.GetDeviceOrigin();
+ cairo_translate( m_context, org.x, org.y );
+
+ double sx,sy;
+ dc.GetUserScale( &sx, &sy );
+ cairo_scale( m_context, sx, sy );
+
+ org = dc.GetLogicalOrigin();
+ cairo_translate( m_context, -org.x, -org.y );
+#endif
+}
+
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc )
: wxGraphicsContext(renderer)
{
-#ifdef __WXGTK__
+#ifdef __WXGTK20__
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
+
+#if 0
+ wxGraphicsMatrix matrix = CreateMatrix();
+
+ wxPoint org = dc.GetDeviceOrigin();
+ matrix.Translate( org.x, org.y );
+
+ org = dc.GetLogicalOrigin();
+ matrix.Translate( -org.x, -org.y );
+
+ double sx,sy;
+ dc.GetUserScale( &sx, &sy );
+ matrix.Scale( sx, sy );
+
+ ConcatTransform( matrix );
#endif
+#endif
+
#ifdef __WXMAC__
int width, height;
dc.GetSize( &width, &height );
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc )
: wxGraphicsContext(renderer)
{
-#ifdef __WXGTK__
+#ifdef __WXGTK20__
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
+
+#if 0
+ wxGraphicsMatrix matrix = CreateMatrix();
+
+ wxPoint org = dc.GetDeviceOrigin();
+ matrix.Translate( org.x, org.y );
+
+ org = dc.GetLogicalOrigin();
+ matrix.Translate( -org.x, -org.y );
+
+ double sx,sy;
+ dc.GetUserScale( &sx, &sy );
+ matrix.Scale( sx, sy );
+
+ ConcatTransform( matrix );
+#endif
#endif
+
#ifdef __WXMAC__
int width, height;
dc.GetSize( &width, &height );
#endif
}
-#ifdef __WXGTK__
+#ifdef __WXGTK20__
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable )
: wxGraphicsContext(renderer)
{
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
+ virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc);
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
// sets the font
virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ;
+ // create a native bitmap representation
+#if 0
+ virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap )
+ {
+ return wxGraphicsBitmap;
+ }
+
+ // create a subimage from a native image representation
+ virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
+ {
+ return wxGraphicsBitmap;
+ }
+#endif
+
private :
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer)
} ;
return new wxCairoContext(this,dc);
}
+wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc)
+{
+#ifdef __WXGTK20__
+ const wxDCImpl *impl = dc.GetImpl();
+ cairo_t* context = (cairo_t*) impl->GetCairoContext();
+ if (context)
+ return new wxCairoContext(this,dc);
+ else
+#endif
+ return NULL;
+}
+
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context )
{
return new wxCairoContext(this,(cairo_t*)context);