virtual void BeginLayer(wxDouble opacity);
virtual void EndLayer();
-
+
virtual void StrokePath( const wxGraphicsPath& p );
virtual void FillPath( const wxGraphicsPath& p , wxPolygonFillMode fillStyle = wxWINDING_RULE );
// gets the matrix of this context
virtual wxGraphicsMatrix GetTransform() const;
+ virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void PushState();
void Init(cairo_t *context);
cairo_t* m_context;
-
+
wxVector<float> m_layerOpacities;
wxDECLARE_NO_COPY_CLASS(wxCairoContext);
{
wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap"));
- cairo_surface_t* surface;
int bw = bmp.GetWidth();
int bh = bmp.GetHeight();
wxBitmap bmpSource = bmp; // we need a non-const instance
m_buffer = new unsigned char[bw*bh*4];
- wxUint32* data = (wxUint32*)buffer;
+ wxUint32* data = (wxUint32*)m_buffer;
// Create a surface object and copy the bitmap pixel data to it. if the
// image has alpha (or a mask represented as alpha) then we'll use a
p.OffsetY(pixData, 1);
}
}
+ m_pattern = cairo_pattern_create_for_surface(m_surface);
}
wxCairoBitmapData::~wxCairoBitmapData()
{
- cairo_pattern_destroy(m_pattern);
- cairo_surface_destroy(m_surface);
+ if (m_pattern)
+ cairo_pattern_destroy(m_pattern);
+
+ if (m_surface)
+ cairo_surface_destroy(m_surface);
+
delete [] m_buffer;
}
void wxCairoContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
{
wxGraphicsBitmap bitmap = GetRenderer()->CreateBitmap(bmp);
- DrawGraphicsBitmapInternal(bitmap, x, y, w, h);
+ DrawBitmap(bitmap, x, y, w, h);
}
wxCairoFontData* font_data = (wxCairoFontData*) m_font.GetRefData();
pango_layout_set_font_description( layout, font_data->GetFont());
pango_layout_set_text(layout, data, datalen);
-
- if (font_data->GetUnderlined())
+
+ if (font_data->GetUnderlined())
{
PangoAttrList *attrs = pango_attr_list_new();
PangoAttribute *attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
return true;
m_antialias = antialias;
-
+
cairo_antialias_t antialiasMode;
switch (antialias)
{
{
if ( m_composition == op )
return true;
-
+
m_composition = op;
cairo_operator_t cop;
switch (op)
cairo_pop_group_to_source(m_context);
cairo_paint_with_alpha(m_context,opacity);
}
-
+
//-----------------------------------------------------------------------------
// wxCairoRenderer declaration
//-----------------------------------------------------------------------------
return wxNullGraphicsFont;
}
-wxGraphicsBitmap wxGraphicsRenderer::CreateBitmap( const wxBitmap& bmp )
+wxGraphicsBitmap wxCairoRenderer::CreateBitmap( const wxBitmap& bmp )
{
if ( bmp.Ok() )
{
return wxNullGraphicsBitmap;
}
-wxGraphicsBitmap wxGraphicsRenderer::CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h )
+wxGraphicsBitmap
+wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap),
+ wxDouble WXUNUSED(x),
+ wxDouble WXUNUSED(y),
+ wxDouble WXUNUSED(w),
+ wxDouble WXUNUSED(h))
{
wxFAIL_MSG("wxCairoRenderer::CreateSubBitmap is not implemented.");
return wxNullGraphicsBitmap;