I moved platform specific code from wxImage to wxBitmap
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
class wxMask;
|
class wxMask;
|
||||||
class wxBitmap;
|
class wxBitmap;
|
||||||
|
class wxImage;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMask
|
// wxMask
|
||||||
@@ -68,6 +69,7 @@ public:
|
|||||||
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
||||||
wxBitmap( const wxBitmap& bmp );
|
wxBitmap( const wxBitmap& bmp );
|
||||||
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
||||||
|
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
wxBitmap& operator = ( const wxBitmap& bmp );
|
wxBitmap& operator = ( const wxBitmap& bmp );
|
||||||
bool operator == ( const wxBitmap& bmp ) const;
|
bool operator == ( const wxBitmap& bmp ) const;
|
||||||
@@ -79,6 +81,8 @@ public:
|
|||||||
int GetHeight() const;
|
int GetHeight() const;
|
||||||
int GetWidth() const;
|
int GetWidth() const;
|
||||||
int GetDepth() const;
|
int GetDepth() const;
|
||||||
|
|
||||||
|
wxImage ConvertToImage() const;
|
||||||
|
|
||||||
wxMask *GetMask() const;
|
wxMask *GetMask() const;
|
||||||
void SetMask( wxMask *mask );
|
void SetMask( wxMask *mask );
|
||||||
@@ -106,6 +110,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool CreateFromXpm(const char **bits);
|
bool CreateFromXpm(const char **bits);
|
||||||
|
bool CreateFromImage(const wxImage& image, int depth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
class wxMask;
|
class wxMask;
|
||||||
class wxBitmap;
|
class wxBitmap;
|
||||||
|
class wxImage;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMask
|
// wxMask
|
||||||
@@ -68,6 +69,7 @@ public:
|
|||||||
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
||||||
wxBitmap( const wxBitmap& bmp );
|
wxBitmap( const wxBitmap& bmp );
|
||||||
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
||||||
|
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
wxBitmap& operator = ( const wxBitmap& bmp );
|
wxBitmap& operator = ( const wxBitmap& bmp );
|
||||||
bool operator == ( const wxBitmap& bmp ) const;
|
bool operator == ( const wxBitmap& bmp ) const;
|
||||||
@@ -79,6 +81,8 @@ public:
|
|||||||
int GetHeight() const;
|
int GetHeight() const;
|
||||||
int GetWidth() const;
|
int GetWidth() const;
|
||||||
int GetDepth() const;
|
int GetDepth() const;
|
||||||
|
|
||||||
|
wxImage ConvertToImage() const;
|
||||||
|
|
||||||
wxMask *GetMask() const;
|
wxMask *GetMask() const;
|
||||||
void SetMask( wxMask *mask );
|
void SetMask( wxMask *mask );
|
||||||
@@ -106,6 +110,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool CreateFromXpm(const char **bits);
|
bool CreateFromXpm(const char **bits);
|
||||||
|
bool CreateFromImage(const wxImage& image, int depth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||||
|
@@ -98,11 +98,14 @@ public:
|
|||||||
wxImage( const wxImage& image );
|
wxImage( const wxImage& image );
|
||||||
wxImage( const wxImage* image );
|
wxImage( const wxImage* image );
|
||||||
|
|
||||||
|
#if wxUSE_GUI
|
||||||
|
// convertion to/from wxBitmap (deprecated, use wxBitmap's methods instead):
|
||||||
wxImage( const wxBitmap &bitmap );
|
wxImage( const wxBitmap &bitmap );
|
||||||
operator wxBitmap() const { return ConvertToBitmap(); }
|
operator wxBitmap() const { return ConvertToBitmap(); }
|
||||||
wxBitmap ConvertToBitmap() const;
|
wxBitmap ConvertToBitmap() const;
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
wxBitmap ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue );
|
wxBitmap ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue );
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Create( int width, int height );
|
void Create( int width, int height );
|
||||||
@@ -137,6 +140,9 @@ public:
|
|||||||
// replace one colour with another
|
// replace one colour with another
|
||||||
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
|
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
|
||||||
unsigned char r2, unsigned char g2, unsigned char b2 );
|
unsigned char r2, unsigned char g2, unsigned char b2 );
|
||||||
|
|
||||||
|
// convert to monochrome image (<r,g,b> will be replaced by white, everything else by black)
|
||||||
|
wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b );
|
||||||
|
|
||||||
// these routines are slow but safe
|
// these routines are slow but safe
|
||||||
void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
|
void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
|
||||||
@@ -229,6 +235,7 @@ private:
|
|||||||
|
|
||||||
extern void WXDLLEXPORT wxInitAllImageHandlers();
|
extern void WXDLLEXPORT wxInitAllImageHandlers();
|
||||||
|
|
||||||
|
WXDLLEXPORT_DATA(extern wxImage) wxNullImage;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxImage handlers
|
// wxImage handlers
|
||||||
|
@@ -27,6 +27,7 @@ class WXDLLEXPORT wxBitmap;
|
|||||||
class WXDLLEXPORT wxBitmapHandler;
|
class WXDLLEXPORT wxBitmapHandler;
|
||||||
class WXDLLEXPORT wxIcon;
|
class WXDLLEXPORT wxIcon;
|
||||||
class WXDLLEXPORT wxCursor;
|
class WXDLLEXPORT wxCursor;
|
||||||
|
class WXDLLEXPORT wxImage;
|
||||||
|
|
||||||
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
|
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
|
||||||
void wxMacDestroyGWorld( GWorldPtr gw ) ;
|
void wxMacDestroyGWorld( GWorldPtr gw ) ;
|
||||||
@@ -152,7 +153,13 @@ public:
|
|||||||
|
|
||||||
// If depth is omitted, will create a bitmap compatible with the display
|
// If depth is omitted, will create a bitmap compatible with the display
|
||||||
wxBitmap(int width, int height, int depth = -1);
|
wxBitmap(int width, int height, int depth = -1);
|
||||||
|
|
||||||
|
// Convert from wxImage:
|
||||||
|
wxBitmap(const wxImage& image, int depth = -1);
|
||||||
|
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
|
|
||||||
|
wxImage ConvertToImage() const;
|
||||||
|
|
||||||
// get the given part of bitmap
|
// get the given part of bitmap
|
||||||
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
||||||
|
@@ -27,6 +27,7 @@ class WXDLLEXPORT wxBitmap;
|
|||||||
class WXDLLEXPORT wxBitmapHandler;
|
class WXDLLEXPORT wxBitmapHandler;
|
||||||
class WXDLLEXPORT wxIcon;
|
class WXDLLEXPORT wxIcon;
|
||||||
class WXDLLEXPORT wxCursor;
|
class WXDLLEXPORT wxCursor;
|
||||||
|
class WXDLLEXPORT wxImage;
|
||||||
|
|
||||||
// A mask is a mono bitmap used for drawing bitmaps
|
// A mask is a mono bitmap used for drawing bitmaps
|
||||||
// transparently.
|
// transparently.
|
||||||
@@ -155,6 +156,10 @@ public:
|
|||||||
|
|
||||||
// If depth is omitted, will create a bitmap compatible with the display
|
// If depth is omitted, will create a bitmap compatible with the display
|
||||||
wxBitmap(int width, int height, int depth = -1);
|
wxBitmap(int width, int height, int depth = -1);
|
||||||
|
|
||||||
|
// Convert from wxImage:
|
||||||
|
wxBitmap(const wxImage& image, int depth = -1) { (void)CreateFromImage(image, depth); }
|
||||||
|
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
|
|
||||||
virtual bool Create(int width, int height, int depth = -1);
|
virtual bool Create(int width, int height, int depth = -1);
|
||||||
@@ -164,6 +169,8 @@ public:
|
|||||||
|
|
||||||
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_XPM);
|
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_XPM);
|
||||||
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
|
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
|
||||||
|
|
||||||
|
wxImage ConvertToImage() const;
|
||||||
|
|
||||||
bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
|
bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
|
||||||
int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
|
int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
|
||||||
@@ -212,6 +219,7 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool CreateFromXpm(const char **bits);
|
bool CreateFromXpm(const char **bits);
|
||||||
|
bool CreateFromImage(const wxImage& image, int depth);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a bitmap with transparent areas drawn in
|
// Creates a bitmap with transparent areas drawn in
|
||||||
|
@@ -28,6 +28,7 @@ class WXDLLEXPORT wxIcon;
|
|||||||
class WXDLLEXPORT wxMask;
|
class WXDLLEXPORT wxMask;
|
||||||
class WXDLLEXPORT wxCursor;
|
class WXDLLEXPORT wxCursor;
|
||||||
class WXDLLEXPORT wxControl;
|
class WXDLLEXPORT wxControl;
|
||||||
|
class WXDLLEXPORT wxImage;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Bitmap data
|
// Bitmap data
|
||||||
@@ -89,6 +90,9 @@ public:
|
|||||||
|
|
||||||
// If depth is omitted, will create a bitmap compatible with the display
|
// If depth is omitted, will create a bitmap compatible with the display
|
||||||
wxBitmap(int width, int height, int depth = -1);
|
wxBitmap(int width, int height, int depth = -1);
|
||||||
|
|
||||||
|
// Convert from wxImage:
|
||||||
|
wxBitmap(const wxImage& image, int depth = -1) { (void)CreateFromImage(image, depth); }
|
||||||
|
|
||||||
// we must have this, otherwise icons are silently copied into bitmaps using
|
// we must have this, otherwise icons are silently copied into bitmaps using
|
||||||
// the copy ctor but the resulting bitmap is invalid!
|
// the copy ctor but the resulting bitmap is invalid!
|
||||||
@@ -117,6 +121,8 @@ public:
|
|||||||
|
|
||||||
virtual ~wxBitmap();
|
virtual ~wxBitmap();
|
||||||
|
|
||||||
|
wxImage ConvertToImage() const;
|
||||||
|
|
||||||
// get the given part of bitmap
|
// get the given part of bitmap
|
||||||
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
||||||
|
|
||||||
@@ -185,6 +191,9 @@ protected:
|
|||||||
|
|
||||||
// creates the bitmap from XPM data, supposed to be called from ctor
|
// creates the bitmap from XPM data, supposed to be called from ctor
|
||||||
bool CreateFromXpm(const char **bits);
|
bool CreateFromXpm(const char **bits);
|
||||||
|
// creates the bitmap from wxImage, supposed to be called from ctor
|
||||||
|
bool CreateFromImage(const wxImage& image, int depth);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|
@@ -29,6 +29,7 @@ class WXDLLEXPORT wxIcon;
|
|||||||
class WXDLLEXPORT wxMask;
|
class WXDLLEXPORT wxMask;
|
||||||
class WXDLLEXPORT wxCursor;
|
class WXDLLEXPORT wxCursor;
|
||||||
class WXDLLEXPORT wxControl;
|
class WXDLLEXPORT wxControl;
|
||||||
|
class WXDLLEXPORT wxImage;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Bitmap data
|
// Bitmap data
|
||||||
@@ -105,6 +106,9 @@ public:
|
|||||||
,int nDepth = -1
|
,int nDepth = -1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
wxBitmap( const wxImage& image, int depth = -1 )
|
||||||
|
{ (void)CreateFromImage(image, depth); }
|
||||||
|
|
||||||
// we must have this, otherwise icons are silently copied into bitmaps using
|
// we must have this, otherwise icons are silently copied into bitmaps using
|
||||||
// the copy ctor but the resulting bitmap is invalid!
|
// the copy ctor but the resulting bitmap is invalid!
|
||||||
inline wxBitmap(const wxIcon& rIcon)
|
inline wxBitmap(const wxIcon& rIcon)
|
||||||
@@ -132,6 +136,8 @@ public:
|
|||||||
|
|
||||||
virtual ~wxBitmap();
|
virtual ~wxBitmap();
|
||||||
|
|
||||||
|
wxImage ConvertToImage() const;
|
||||||
|
|
||||||
// get the given part of bitmap
|
// get the given part of bitmap
|
||||||
wxBitmap GetSubBitmap(const wxRect& rRect) const;
|
wxBitmap GetSubBitmap(const wxRect& rRect) const;
|
||||||
|
|
||||||
@@ -226,6 +232,7 @@ protected:
|
|||||||
|
|
||||||
// creates the bitmap from XPM data, supposed to be called from ctor
|
// creates the bitmap from XPM data, supposed to be called from ctor
|
||||||
bool CreateFromXpm(const char **bits);
|
bool CreateFromXpm(const char **bits);
|
||||||
|
bool CreateFromImage(const wxImage& image, int depth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool CopyFromIconOrCursor(const wxGDIImage& rIcon);
|
bool CopyFromIconOrCursor(const wxGDIImage& rIcon);
|
||||||
|
Reference in New Issue
Block a user