Added wxGraphicsBitmap::ConvertToImage().

Allow to convert wxGraphicsBitmap directly to wxImage, without passing by
wxBitmap.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-09 22:07:07 +00:00
parent 5f606e6515
commit 08b2d55fdf
4 changed files with 222 additions and 0 deletions

View File

@@ -978,6 +978,14 @@ public:
virtual CGImageRef GetBitmap() { return m_bitmap; }
bool IsMonochrome() { return m_monochrome; }
#if wxUSE_IMAGE
wxImage ConvertToImage() const
{
return wxBitmap(m_bitmap).ConvertToImage();
}
#endif // wxUSE_IMAGE
private :
CGImageRef m_bitmap;
bool m_monochrome;
@@ -993,6 +1001,18 @@ wxMacCoreGraphicsBitmapData::~wxMacCoreGraphicsBitmapData()
CGImageRelease( m_bitmap );
}
#if wxUSE_IMAGE
wxImage wxGraphicsBitmap::ConvertToImage() const
{
wxMacCoreGraphicsBitmapData* const
data = static_cast<wxMacCoreGraphicsBitmapData*>(GetRefData());
return data ? data->ConvertToImage() : wxNullImage;
}
#endif // wxUSE_IMAGE
//
// Graphics Matrix
//