X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7beb59f36c016d27cf8949eb8c0d38fc63ad536a..324eeecb3cdc9522e136af6670443148772b412a:/include/wx/image.h diff --git a/include/wx/image.h b/include/wx/image.h index 3bbc77a9d1..6fb884955b 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 ); @@ -316,7 +330,7 @@ private: extern void WXDLLEXPORT wxInitAllImageHandlers(); -WXDLLEXPORT_DATA(extern wxImage) wxNullImage; +extern WXDLLEXPORT_DATA(wxImage) wxNullImage; //----------------------------------------------------------------------------- // wxImage handlers