#include "wx/module.h"
#endif
-#include "wx/graphics.h"
+#include "wx/private/graphics.h"
#include "wx/rawbmp.h"
#include <vector>
#ifdef __WXGTK__
#include <gtk/gtk.h>
#include "wx/fontutil.h"
+#include "wx/gtk/dc.h"
#endif
#ifdef __WXMSW__
public:
wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc );
+ wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc );
#ifdef __WXGTK__
wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable );
#endif
: wxGraphicsContext(renderer)
{
#ifdef __WXGTK__
- Init( gdk_cairo_create( dc.m_window ) );
+ wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
+ Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
+#endif
+#ifdef __WXMAC__
+ int width, height;
+ dc.GetSize( &width, &height );
+ CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef();
+ cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height);
+ Init( cairo_create( surface ) );
+ cairo_surface_destroy( surface );
+#endif
+}
+
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc )
+: wxGraphicsContext(renderer)
+{
+#ifdef __WXGTK__
+ wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
+ Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
#endif
#ifdef __WXMAC__
int width, height;
return;
#ifdef __WXGTK__
- const wxCharBuffer data = wxConvUTF8.cWC2MB( str );
+ const wxCharBuffer data = str.utf8_str();
if ( !data )
return;
size_t datalen = strlen(data);
PangoLayout *layout = pango_cairo_create_layout (m_context);
pango_layout_set_font_description( layout, ((wxCairoFontData*)m_font.GetRefData())->GetFont());
- const wxCharBuffer data = wxConvUTF8.cWC2MB( str );
+ const wxCharBuffer data = str.utf8_str();
if ( !data )
{
return;
// Context
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
-
-#ifdef __WXMSW__
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
-#endif
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
return new wxCairoContext(this,dc);
}
-#ifdef __WXMSW__
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc)
{
- return NULL;
+ return new wxCairoContext(this,dc);
}
-#endif
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context )
{