+ cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,1,1);
+ cairo_t* pathcontext = cairo_create(surface);
+ cairo_surface_destroy (surface);
+
+ cairo_path_t* path = cairo_copy_path(m_pathContext);
+ cairo_append_path(pathcontext, path);
+ cairo_path_destroy(path);
+ return new wxCairoPath( GetRenderer() ,pathcontext);
+}
+
+
+void* wxCairoPath::GetNativePath() const
+{
+ return cairo_copy_path(m_pathContext) ;
+}
+
+void wxCairoPath::UnGetNativePath(void *p)
+{
+ cairo_path_destroy((cairo_path_t*)p);
+}
+
+//
+// The Primitives
+//
+
+void wxCairoPath::MoveToPoint( wxDouble x , wxDouble y )
+{
+ cairo_move_to(m_pathContext,x,y);
+}
+
+void wxCairoPath::AddLineToPoint( wxDouble x , wxDouble y )
+{
+ cairo_line_to(m_pathContext,x,y);
+}
+
+void wxCairoPath::AddPath( const wxGraphicsPath* path )
+{
+ // TODO
+}
+
+void wxCairoPath::CloseSubpath()
+{
+ cairo_close_path(m_pathContext);
+}
+
+void wxCairoPath::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y )
+{
+ cairo_curve_to(m_pathContext,cx1,cy1,cx2,cy2,x,y);
+}
+
+// gets the last point of the current path, (0,0) if not yet set
+void wxCairoPath::GetCurrentPoint( wxDouble& x, wxDouble&y)
+{
+ double dx,dy;
+ cairo_get_current_point(m_pathContext,&dx,&dy);
+ x = dx;
+ y = dy;
+}
+
+void wxCairoPath::AddArc( wxDouble x, wxDouble y, wxDouble r, double startAngle, double endAngle, bool clockwise )
+{
+ // as clockwise means positive in our system (y pointing downwards)
+ // TODO make this interpretation dependent of the
+ // real device trans
+ if ( clockwise||(endAngle-startAngle)>=2*M_PI)
+ cairo_arc(m_pathContext,x,y,r,startAngle,endAngle);
+ else
+ cairo_arc_negative(m_pathContext,x,y,r,startAngle,endAngle);
+}
+
+// transforms each point of this path by the matrix
+void wxCairoPath::Transform( wxGraphicsMatrix* matrix )
+{
+ // as we don't have a true path object, we have to apply the inverse
+ // matrix to the context
+ cairo_matrix_t m = *((cairo_matrix_t*) matrix->GetNativeMatrix());
+ cairo_matrix_invert( &m );
+ cairo_transform(m_pathContext,&m);
+}
+
+// gets the bounding box enclosing all points (possibly including control points)
+void wxCairoPath::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h)
+{
+ double x1,y1,x2,y2;
+
+ cairo_stroke_extents( m_pathContext, &x1, &y1, &x2, &y2 );
+ if ( x2 < x1 )