+ // nothing to do
+}
+
+wxGraphicsObjectRefData *wxCairoMatrixData::Clone() const
+{
+ return new wxCairoMatrixData(GetRenderer(),&m_matrix);
+}
+
+// concatenates the matrix
+void wxCairoMatrixData::Concat( const wxGraphicsMatrixData *t )
+{
+ cairo_matrix_multiply( &m_matrix, &m_matrix, (cairo_matrix_t*) t->GetNativeMatrix());
+}
+
+// sets the matrix to the respective values
+void wxCairoMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d,
+ wxDouble tx, wxDouble ty)
+{
+ cairo_matrix_init( &m_matrix, a, b, c, d, tx, ty);
+}
+
+// gets the component valuess of the matrix
+void wxCairoMatrixData::Get(wxDouble* a, wxDouble* b, wxDouble* c,
+ wxDouble* d, wxDouble* tx, wxDouble* ty) const
+{
+ if (a) *a = m_matrix.xx;
+ if (b) *b = m_matrix.yx;
+ if (c) *c = m_matrix.xy;
+ if (d) *d = m_matrix.yy;
+ if (tx) *tx= m_matrix.x0;
+ if (ty) *ty= m_matrix.y0;
+}
+
+// makes this the inverse matrix
+void wxCairoMatrixData::Invert()
+{
+ cairo_matrix_invert( &m_matrix );
+}
+
+// returns true if the elements of the transformation matrix are equal ?
+bool wxCairoMatrixData::IsEqual( const wxGraphicsMatrixData* t) const
+{
+ const cairo_matrix_t* tm = (cairo_matrix_t*) t->GetNativeMatrix();
+ return (
+ m_matrix.xx == tm->xx &&
+ m_matrix.yx == tm->yx &&
+ m_matrix.xy == tm->xy &&
+ m_matrix.yy == tm->yy &&
+ m_matrix.x0 == tm->x0 &&
+ m_matrix.y0 == tm->y0 ) ;
+}
+
+// return true if this is the identity matrix
+bool wxCairoMatrixData::IsIdentity() const
+{
+ return ( m_matrix.xx == 1 && m_matrix.yy == 1 &&
+ m_matrix.yx == 0 && m_matrix.xy == 0 && m_matrix.x0 == 0 && m_matrix.y0 == 0);
+}
+
+//
+// transformation
+//
+
+// add the translation to this matrix
+void wxCairoMatrixData::Translate( wxDouble dx , wxDouble dy )
+{
+ cairo_matrix_translate( &m_matrix, dx, dy) ;
+}
+
+// add the scale to this matrix
+void wxCairoMatrixData::Scale( wxDouble xScale , wxDouble yScale )
+{
+ cairo_matrix_scale( &m_matrix, xScale, yScale) ;
+}
+
+// add the rotation to this matrix (radians)
+void wxCairoMatrixData::Rotate( wxDouble angle )
+{
+ cairo_matrix_rotate( &m_matrix, angle) ;
+}
+
+//
+// apply the transforms
+//
+
+// applies that matrix to the point
+void wxCairoMatrixData::TransformPoint( wxDouble *x, wxDouble *y ) const
+{
+ double lx = *x, ly = *y ;
+ cairo_matrix_transform_point( &m_matrix, &lx, &ly);
+ *x = lx;
+ *y = ly;
+}
+
+// applies the matrix except for translations
+void wxCairoMatrixData::TransformDistance( wxDouble *dx, wxDouble *dy ) const
+{
+ double lx = *dx, ly = *dy ;
+ cairo_matrix_transform_distance( &m_matrix, &lx, &ly);
+ *dx = lx;
+ *dy = ly;
+}
+
+// returns the native representation
+void * wxCairoMatrixData::GetNativeMatrix() const
+{
+ return (void*) &m_matrix;
+}
+
+//-----------------------------------------------------------------------------
+// wxCairoContext implementation
+//-----------------------------------------------------------------------------
+
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc )
+: wxGraphicsContext(renderer)
+{
+#ifdef __WXGTK__
+ m_context = gdk_cairo_create( dc.m_window ) ;
+#endif
+ PushState();
+ PushState();
+}
+
+#ifdef __WXGTK__
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable )
+: wxGraphicsContext(renderer)
+{
+ m_context = gdk_cairo_create( drawable ) ;
+ PushState();
+ PushState();
+}
+#endif
+
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context )
+: wxGraphicsContext(renderer)
+{
+ m_context = context ;
+ PushState();
+ PushState();
+}
+
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window)
+: wxGraphicsContext(renderer)
+{
+#ifdef __WXGTK__
+ // something along these lines (copied from dcclient)
+
+ GtkWidget *widget = window->m_wxwindow;
+
+ // Some controls don't have m_wxwindow - like wxStaticBox, but the user
+ // code should still be able to create wxClientDCs for them, so we will
+ // use the parent window here then.
+ if ( !widget )