Added support for static (inlined) wxImages with
alpha channel. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -139,6 +139,7 @@ public:
|
|||||||
wxImage(){}
|
wxImage(){}
|
||||||
wxImage( int width, int height, bool clear = true );
|
wxImage( int width, int height, bool clear = true );
|
||||||
wxImage( int width, int height, unsigned char* data, bool static_data = false );
|
wxImage( int width, int height, unsigned char* data, bool static_data = false );
|
||||||
|
wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
||||||
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||||
wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
|
wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
|
||||||
|
|
||||||
@@ -152,6 +153,7 @@ public:
|
|||||||
|
|
||||||
bool Create( int width, int height, bool clear = true );
|
bool Create( int width, int height, bool clear = true );
|
||||||
bool Create( int width, int height, unsigned char* data, bool static_data = false );
|
bool Create( int width, int height, unsigned char* data, bool static_data = false );
|
||||||
|
bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
// creates an identical copy of the image (the = operator
|
// creates an identical copy of the image (the = operator
|
||||||
|
@@ -94,10 +94,11 @@ wxImageRefData::wxImageRefData()
|
|||||||
|
|
||||||
wxImageRefData::~wxImageRefData()
|
wxImageRefData::~wxImageRefData()
|
||||||
{
|
{
|
||||||
if ( !m_static )
|
if (!m_static)
|
||||||
|
{
|
||||||
free( m_data );
|
free( m_data );
|
||||||
|
free( m_alpha );
|
||||||
free(m_alpha);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxList wxImage::sm_handlers;
|
wxList wxImage::sm_handlers;
|
||||||
@@ -120,6 +121,11 @@ wxImage::wxImage( int width, int height, unsigned char* data, bool static_data )
|
|||||||
Create( width, height, data, static_data );
|
Create( width, height, data, static_data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxImage::wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data )
|
||||||
|
{
|
||||||
|
Create( width, height, data, alpha, static_data );
|
||||||
|
}
|
||||||
|
|
||||||
wxImage::wxImage( const wxString& name, long type, int index )
|
wxImage::wxImage( const wxString& name, long type, int index )
|
||||||
{
|
{
|
||||||
LoadFile( name, type, index );
|
LoadFile( name, type, index );
|
||||||
@@ -193,6 +199,24 @@ bool wxImage::Create( int width, int height, unsigned char* data, bool static_da
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxImage::Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data )
|
||||||
|
{
|
||||||
|
UnRef();
|
||||||
|
|
||||||
|
wxCHECK_MSG( data, false, _T("NULL data in wxImage::Create") );
|
||||||
|
|
||||||
|
m_refData = new wxImageRefData();
|
||||||
|
|
||||||
|
M_IMGDATA->m_data = data;
|
||||||
|
M_IMGDATA->m_alpha = alpha;
|
||||||
|
M_IMGDATA->m_width = width;
|
||||||
|
M_IMGDATA->m_height = height;
|
||||||
|
M_IMGDATA->m_ok = true;
|
||||||
|
M_IMGDATA->m_static = static_data;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void wxImage::Destroy()
|
void wxImage::Destroy()
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
Reference in New Issue
Block a user