X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7beb59f36c016d27cf8949eb8c0d38fc63ad536a..f4fffffc953f68af6c968419da446a9b2e536693:/include/wx/image.h diff --git a/include/wx/image.h b/include/wx/image.h index 3bbc77a9d1..ceaad75c96 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -136,9 +136,10 @@ public: class WXDLLEXPORT wxImage: public wxObject { public: - wxImage(); + wxImage(){} 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, unsigned char* alpha, bool static_data = false ); wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, 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, 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(); // creates an identical copy of the image (the = operator @@ -211,6 +213,18 @@ public: // otherwise: bool ConvertAlphaToMask(unsigned char threshold = 128); + // This method converts an image where the original alpha + // information is only available as a shades of a colour + // (actually shades of grey) typically when you draw anti- + // aliased text into a bitmap. The DC drawinf routines + // draw grey values on the black background although they + // actually mean to draw white with differnt alpha values. + // This method reverses it, assuming a black (!) background + // and white text (actually only the red channel is read). + // The method will then fill up the whole image with the + // colour given. + bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); + static bool CanRead( const wxString& name ); static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY ); virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );