- bool Ok() const;
- int GetWidth() const;
- int GetHeight() const;
-
- char unsigned *GetData() const;
- void SetData( char unsigned *data );
-
- void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
- unsigned char GetMaskRed() const;
- unsigned char GetMaskGreen() const;
- unsigned char GetMaskBlue() const;
- void SetMask( bool mask = TRUE );
- bool HasMask() const;
-
- wxImage& operator = (const wxImage& image)
- {
- if ( (*this) != image )
- Ref(image);
- return *this;
- }
-
- bool operator == (const wxImage& image)
- { return m_refData == image.m_refData; }
- bool operator != (const wxImage& image)
- { return m_refData != image.m_refData; }
-
- static wxList& GetHandlers() { return sm_handlers; }
- static void AddHandler( wxImageHandler *handler );
- static void InsertHandler( wxImageHandler *handler );
- static bool RemoveHandler( const wxString& name );
- static wxImageHandler *FindHandler( const wxString& name );
- static wxImageHandler *FindHandler( const wxString& extension, long imageType );
- static wxImageHandler *FindHandler( long imageType );
- static wxImageHandler *FindHandlerMime( const wxString& mimetype );
-
- static void CleanUpHandlers();
- static void InitStandardHandlers();
-
- // GRG: Dic/99
- unsigned long CountColours( unsigned long stopat = -1 );
- unsigned long ComputeHistogram( wxHashTable &h );
-
+ bool Ok() const;
+ int GetWidth() const;
+ int GetHeight() const;
+
+ // these functions provide fastest access to wxImage data but should be
+ // used carefully as no checks are done
+ unsigned char *GetData() const;
+ void SetData( unsigned char *data );
+ void SetData( unsigned char *data, int new_width, int new_height );
+
+ unsigned char *GetAlpha() const; // may return NULL!
+ bool HasAlpha() const { return GetAlpha() != NULL; }
+ void SetAlpha(unsigned char *alpha = NULL);
+
+ // Mask functions
+ void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
+ unsigned char GetMaskRed() const;
+ unsigned char GetMaskGreen() const;
+ unsigned char GetMaskBlue() const;
+ void SetMask( bool mask = TRUE );
+ bool HasMask() const;
+
+#if wxUSE_PALETTE
+ // Palette functions
+ bool HasPalette() const;
+ const wxPalette& GetPalette() const;
+ void SetPalette(const wxPalette& palette);
+#endif // wxUSE_PALETTE
+
+ // Option functions (arbitrary name/value mapping)
+ void SetOption(const wxString& name, const wxString& value);
+ void SetOption(const wxString& name, int value);
+ wxString GetOption(const wxString& name) const;
+ int GetOptionInt(const wxString& name) const;
+ bool HasOption(const wxString& name) const;
+
+ unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const;
+
+ // Computes the histogram of the image and fills a hash table, indexed
+ // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry
+ // objects. Each of them contains an 'index' (useful to build a palette
+ // with the image colours) and a 'value', which is the number of pixels
+ // in the image with that colour.
+ // Returned value: # of entries in the histogram
+ unsigned long ComputeHistogram( wxImageHistogram &h ) const;
+
+ wxImage& operator = (const wxImage& image)
+ {
+ if ( (*this) != image )
+ Ref(image);
+ return *this;
+ }
+
+ bool operator == (const wxImage& image) const
+ { return m_refData == image.m_refData; }
+ bool operator != (const wxImage& image) const
+ { return m_refData != image.m_refData; }
+
+ static wxList& GetHandlers() { return sm_handlers; }
+ static void AddHandler( wxImageHandler *handler );
+ static void InsertHandler( wxImageHandler *handler );
+ static bool RemoveHandler( const wxString& name );
+ static wxImageHandler *FindHandler( const wxString& name );
+ static wxImageHandler *FindHandler( const wxString& extension, long imageType );
+ static wxImageHandler *FindHandler( long imageType );
+ static wxImageHandler *FindHandlerMime( const wxString& mimetype );
+
+ static wxString GetImageExtWildcard();
+
+ static void CleanUpHandlers();
+ static void InitStandardHandlers();