Add wxBitmap::NewFromPNGData() for creating bitmaps from PNG data.
This simple function can be used to create a wxBitmap from the raw image data in PNG format. It is just a thin wrapper around wxImage load functions under almost all platforms but has two advantages: 1. It can be implemented natively for some platforms (currently only OS X). 2. It can be used in a single expression as it doesn't require creating a temporary wxMemoryInputStream and this will be required by wxBITMAP_PNG() macro that will be added soon. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -584,6 +584,31 @@ public:
|
||||
*/
|
||||
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
|
||||
|
||||
/**
|
||||
Loads a bitmap from the memory containing image data in PNG format.
|
||||
|
||||
This helper function provides the simplest way to create a wxBitmap
|
||||
from PNG image data. On most platforms, it's simply a wrapper around
|
||||
wxImage loading functions and so requires the PNG image handler to be
|
||||
registered by either calling wxInitAllImageHandlers() which also
|
||||
registers all the other image formats or including the necessary
|
||||
header:
|
||||
@code
|
||||
#include <wx/imagpng.h>
|
||||
@endcode
|
||||
and calling
|
||||
@code
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
@endcode
|
||||
in your application startup code.
|
||||
|
||||
However under OS X this function uses native image loading and so
|
||||
doesn't require wxWidgets PNG support.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
static wxBitmap NewFromPNGData(const void* data, size_t size);
|
||||
|
||||
/**
|
||||
Finds the handler with the given name, and removes it.
|
||||
The handler is not deleted.
|
||||
|
Reference in New Issue
Block a user