add wxImage::Clear (patch by troelsk); closes #10141
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ecba92ec08
commit
fc3762b5fc
@ -240,6 +240,9 @@ public:
|
||||
bool Create( char** xpmData ) { return Create(const_cast<const char* const*>(xpmData)); }
|
||||
#endif
|
||||
void Destroy();
|
||||
|
||||
// initialize the image data with zeroes
|
||||
void Clear(unsigned char value = 0);
|
||||
|
||||
// creates an identical copy of the image (the = operator
|
||||
// just raises the ref count)
|
||||
|
@ -566,12 +566,20 @@ public:
|
||||
@param height
|
||||
The height of the image in pixels.
|
||||
@param clear
|
||||
If @true, initialize the image data with zeros.
|
||||
If @true, initialize the image data with zeroes.
|
||||
|
||||
@return @true if the call succeeded, @false otherwise.
|
||||
*/
|
||||
bool Create(int width, int height, bool clear = true);
|
||||
|
||||
/**
|
||||
Initialize the image data with zeroes (the default) or with the
|
||||
byte value given as @a value.
|
||||
|
||||
@since 2.9.0
|
||||
*/
|
||||
void Clear(unsigned char value = 0);
|
||||
|
||||
/**
|
||||
Destroys the image data.
|
||||
*/
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
// what to test (in alphabetic order)? Define TEST_ALL to 0 to do a single
|
||||
// test, define it to 1 to do all tests.
|
||||
#define TEST_ALL 1
|
||||
#define TEST_ALL 0
|
||||
|
||||
|
||||
#if TEST_ALL
|
||||
@ -89,7 +89,7 @@
|
||||
#define TEST_WCHAR
|
||||
#define TEST_ZIP
|
||||
#else // #if TEST_ALL
|
||||
#define TEST_EXECUTE
|
||||
#define TEST_FTP
|
||||
#endif
|
||||
|
||||
// some tests are interactive, define this to run them
|
||||
@ -2405,8 +2405,6 @@ static void TestSocketClient()
|
||||
|
||||
#include "wx/protocol/ftp.h"
|
||||
|
||||
static wxFTP ftp;
|
||||
|
||||
#define FTP_ANONYMOUS
|
||||
|
||||
#ifdef FTP_ANONYMOUS
|
||||
|
@ -195,13 +195,15 @@ bool wxImage::Create( int width, int height, bool clear )
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clear)
|
||||
memset(M_IMGDATA->m_data, 0, width*height*3);
|
||||
|
||||
M_IMGDATA->m_width = width;
|
||||
M_IMGDATA->m_height = height;
|
||||
M_IMGDATA->m_ok = true;
|
||||
|
||||
if (clear)
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -246,6 +248,11 @@ void wxImage::Destroy()
|
||||
UnRef();
|
||||
}
|
||||
|
||||
void wxImage::Clear(unsigned char value)
|
||||
{
|
||||
memset(M_IMGDATA->m_data, value, M_IMGDATA->m_width*M_IMGDATA->m_height*3);
|
||||
}
|
||||
|
||||
wxObjectRefData* wxImage::CreateRefData() const
|
||||
{
|
||||
return new wxImageRefData;
|
||||
|
Loading…
Reference in New Issue
Block a user