// 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
// different format and iterator than if it doesn't...
- const cairo_format_t bufferFormat = bmp.GetDepth() == 32
+ cairo_format_t bufferFormat = bmp.GetDepth() == 32
#ifdef __WXGTK__
|| bmp.GetMask()
#endif
delete [] m_buffer;
}
-// ----------------------------------------------------------------------------
-// wxGraphicsBitmap implementation
-// ----------------------------------------------------------------------------
-
-#if wxUSE_IMAGE
-
-wxImage wxGraphicsBitmap::ConvertToImage() const
-{
- const wxCairoBitmapData* const
- data = static_cast<wxCairoBitmapData*>(GetGraphicsData());
-
- return data ? data->ConvertToImage() : wxNullImage;
-}
-
-#endif // wxUSE_IMAGE
-
//-----------------------------------------------------------------------------
// wxCairoContext implementation
//-----------------------------------------------------------------------------
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
#if wxUSE_IMAGE
virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image);
+ virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp);
#endif // wxUSE_IMAGE
// create a graphics bitmap from a native bitmap
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc)
{
ENSURE_LOADED_OR_RETURN(NULL);
-#ifdef __WXGTK20__
- const wxDCImpl *impl = dc.GetImpl();
- cairo_t* context = (cairo_t*) impl->GetCairoContext();
- if (context)
- return new wxCairoContext(this,dc);
- else
-#endif
- return new wxCairoContext(this,dc);
+ return new wxCairoContext(this, dc);
}
#ifdef __WXMSW__
return bmp;
}
+wxImage wxCairoRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp)
+{
+ ENSURE_LOADED_OR_RETURN(wxNullImage);
+
+ const wxCairoBitmapData* const
+ data = static_cast<wxCairoBitmapData*>(bmp.GetGraphicsData());
+
+ return data ? data->ConvertToImage() : wxNullImage;
+}
+
#endif // wxUSE_IMAGE
+
wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromNativeBitmap( void* bitmap )
{
ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);