Allow creating wxGraphicsBitmap and wxGraphicsContext from wxImage.

Provide a way to use wxGraphicsContext to draw on wxImage.

This is implemented internally by drawing on wxGraphicsBitmap which can be now
also created from wxImage.

Add a test of the new functionality to the image sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-09 22:07:22 +00:00
parent 12493a5fb8
commit 0a470e5ea5
8 changed files with 439 additions and 8 deletions

View File

@@ -848,6 +848,13 @@ wxGraphicsBitmap wxGraphicsContext::CreateBitmap( const wxBitmap& bmp ) const
return GetRenderer()->CreateBitmap(bmp);
}
#if wxUSE_IMAGE
wxGraphicsBitmap wxGraphicsContext::CreateBitmapFromImage(const wxImage& image) const
{
return GetRenderer()->CreateBitmapFromImage(image);
}
#endif // wxUSE_IMAGE
wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const
{
return GetRenderer()->CreateSubBitmap(bmp,x,y,w,h);
@@ -894,6 +901,13 @@ wxGraphicsContext* wxGraphicsContext::Create( wxWindow* window )
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(window);
}
#if wxUSE_IMAGE
/* static */ wxGraphicsContext* wxGraphicsContext::Create(wxImage& image)
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromImage(image);
}
#endif // wxUSE_IMAGE
wxGraphicsContext* wxGraphicsContext::Create()
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateMeasuringContext();