add wxSize overloads to wxBitmap ctors and to wxBitmap::Create

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-03-14 13:57:51 +00:00
parent 72a9034bd4
commit 732d8c74f8
22 changed files with 129 additions and 119 deletions

View File

@@ -148,6 +148,7 @@ public:
wxBitmap(const wxBitmap& bmp); wxBitmap(const wxBitmap& bmp);
wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const char bits[], int width, int height, int depth = 1);
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(const char* const* bits); wxBitmap(const char* const* bits);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH); wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH);
@@ -156,6 +157,7 @@ public:
*/ */
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0; virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual int GetHeight() const = 0; virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0; virtual int GetWidth() const = 0;

View File

@@ -59,9 +59,11 @@ protected:
WX_NSBitmapImageRep m_cocoaNSBitmapImageRep; WX_NSBitmapImageRep m_cocoaNSBitmapImageRep;
}; };
// ======================================================================== // ========================================================================
// wxBitmap // wxBitmap
// ======================================================================== // ========================================================================
class WXDLLIMPEXP_CORE wxBitmap: public wxGDIObject class WXDLLIMPEXP_CORE wxBitmap: public wxGDIObject
{ {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@@ -83,10 +85,13 @@ public:
// Constructor for generalised creation from data // Constructor for generalised creation from data
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
// 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)
{ (void)Create(width, height, depth); }
wxBitmap(const wxSize& sz, int depth = -1)
{ (void)Create(sz, depth); }
// Convert from wxImage: // Convert from wxImage:
wxBitmap(const wxImage& image, int depth = -1) wxBitmap(const wxImage& image, int depth = -1)
{ CreateFromImage(image, depth); } { CreateFromImage(image, depth); }
// Convert from wxIcon // Convert from wxIcon
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
@@ -100,7 +105,10 @@ public:
// Initialize from wxImage // Initialize from wxImage
bool CreateFromImage(const wxImage& image, int depth=-1); bool CreateFromImage(const wxImage& image, int depth=-1);
virtual bool Create(int width, int height, int depth = -1); virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
bool Create(NSImage* cocoaNSImage); bool Create(NSImage* cocoaNSImage);
bool Create(NSBitmapImageRep* cocoaNSBitmapImageRep); bool Create(NSBitmapImageRep* cocoaNSBitmapImageRep);
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);

View File

@@ -26,7 +26,8 @@ class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase
public: public:
wxBitmap() {} wxBitmap() {}
wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); } wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); }
wxBitmap(int width, int height, int depth = -1); wxBitmap(int width, int height, int depth = -1) { Create(width, height, depth); }
wxBitmap(const wxSize& sz, int depth = -1) { Create(sz, depth); }
wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const char bits[], int width, int height, int depth = 1);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
wxBitmap(const char* const* bits); wxBitmap(const char* const* bits);
@@ -35,7 +36,9 @@ public:
#endif #endif
bool Create(const wxIDirectFBSurfacePtr& surface); bool Create(const wxIDirectFBSurfacePtr& surface);
bool Create(int width, int height, int depth = -1); bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual int GetHeight() const; virtual int GetHeight() const;
virtual int GetWidth() const; virtual int GetWidth() const;

View File

@@ -51,13 +51,16 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{ {
public: public:
wxBitmap() { } wxBitmap() { }
wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH ); wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH )
{ Create(width, height, depth); }
wxBitmap( const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH )
{ Create(sz, depth); }
wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const char* const* bits ); wxBitmap( const char* const* bits );
#ifdef wxNEEDS_CHARPP #ifdef wxNEEDS_CHARPP
// needed for old GCC // needed for old GCC
wxBitmap(char** data) wxBitmap(char** data)
{ *this = wxBitmap(const_cast<const char* const*>(data)); } { *this = wxBitmap(const_cast<const char* const*>(data)); }
#endif #endif
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
#if wxUSE_IMAGE #if wxUSE_IMAGE
@@ -67,6 +70,8 @@ public:
virtual ~wxBitmap(); virtual ~wxBitmap();
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual int GetHeight() const; virtual int GetHeight() const;
virtual int GetWidth() const; virtual int GetWidth() const;

View File

@@ -64,8 +64,9 @@ private:
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{ {
public: public:
wxBitmap(); wxBitmap() {}
wxBitmap( int width, int height, int depth = -1 ); wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); }
wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const char* const* bits ); wxBitmap( const char* const* bits );
#ifdef wxNEEDS_CHARPP #ifdef wxNEEDS_CHARPP
@@ -79,7 +80,9 @@ public:
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
virtual ~wxBitmap(); virtual ~wxBitmap();
bool Create(int width, int height, int depth = -1); bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual int GetHeight() const; virtual int GetHeight() const;
virtual int GetWidth() const; virtual int GetWidth() const;

View File

@@ -27,14 +27,19 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{ {
public: public:
wxBitmap() {} wxBitmap() {}
wxBitmap(int width, int height, int depth = -1); wxBitmap(int width, int height, int depth = -1)
{ Create(width, height, depth); }
wxBitmap(const wxSize& sz, int depth = -1)
{ Create(sz, depth); }
wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const char bits[], int width, int height, int depth = 1);
wxBitmap(const char* const* bits); wxBitmap(const char* const* bits);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
wxBitmap(const wxImage& image, int depth = -1); wxBitmap(const wxImage& image, int depth = -1);
virtual ~wxBitmap() {} virtual ~wxBitmap() {}
bool Create(int width, int height, int depth = -1); bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual int GetHeight() const; virtual int GetHeight() const;
virtual int GetWidth() const; virtual int GetWidth() const;

View File

@@ -73,7 +73,8 @@ public:
// //
// NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor
// taking a DC argument if you want to force using DDB in this case // taking a DC argument if you want to force using DDB in this case
wxBitmap(int width, int height, int depth = -1); wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); }
wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); }
// Create a bitmap compatible with the given DC // Create a bitmap compatible with the given DC
wxBitmap(int width, int height, const wxDC& dc); wxBitmap(int width, int height, const wxDC& dc);
@@ -137,6 +138,9 @@ public:
#endif #endif
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual bool Create(int width, int height, const wxDC& dc); virtual bool Create(int width, int height, const wxDC& dc);
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);

View File

@@ -114,7 +114,16 @@ 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 nWidth, int nHeight, int nDepth = -1 ); wxBitmap( int nWidth, int nHeight, int nDepth = -1 )
{
Init();
(void)Create(nWidth, nHeight, nDepth);
}
wxBitmap( const wxSize& sz, int nDepth = -1 )
{
Init();
(void)Create(sz, nDepth);
}
wxBitmap( const wxImage& image, int depth = -1 ) wxBitmap( const wxImage& image, int depth = -1 )
{ (void)CreateFromImage(image, depth); } { (void)CreateFromImage(image, depth); }
@@ -152,8 +161,11 @@ public:
virtual bool Create( int nWidth virtual bool Create( int nWidth
,int nHeight ,int nHeight
,int nDepth = -1 ,int nDepth = wxBITMAP_SCREEN_DEPTH
); );
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual bool Create( const void* pData virtual bool Create( const void* pData
,wxBitmapType lType ,wxBitmapType lType
,int nWidth ,int nWidth

View File

@@ -87,7 +87,7 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler;
public: public:
wxBitmap(); // Platform-specific wxBitmap() {} // Platform-specific
// Initialize with raw data. // Initialize with raw data.
wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const char bits[], int width, int height, int depth = 1);
@@ -102,7 +102,8 @@ public:
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
// 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) { (void)Create(width, height, depth); }
wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); }
// Convert from wxImage: // Convert from wxImage:
wxBitmap(const wxImage& image, int depth = -1); wxBitmap(const wxImage& image, int depth = -1);
@@ -110,14 +111,17 @@ public:
// Convert from wxIcon // Convert from wxIcon
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
virtual ~wxBitmap(); virtual ~wxBitmap() {}
wxImage ConvertToImage() const; 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;
virtual bool Create(int width, int height, int depth = -1); virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
// virtual bool Create( WXHICON icon) ; // virtual bool Create( WXHICON icon) ;
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);

View File

@@ -58,7 +58,8 @@ public:
// //
// NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor
// taking a DC argument if you want to force using DDB in this case // taking a DC argument if you want to force using DDB in this case
wxBitmap(int width, int height, int depth = -1); wxBitmap(int width, int height, int depth = -1) { /*TODO*/ }
wxBitmap(const wxSize& sz, int depth = -1) { /*TODO*/ }
// Create a bitmap compatible with the given DC // Create a bitmap compatible with the given DC
wxBitmap(int width, int height, const wxDC& dc); wxBitmap(int width, int height, const wxDC& dc);
@@ -91,7 +92,7 @@ public:
return *this; return *this;
} }
virtual ~wxBitmap(); virtual ~wxBitmap() {}
#if wxUSE_IMAGE && wxUSE_WXDIB #if wxUSE_IMAGE && wxUSE_WXDIB
wxImage ConvertToImage() const; wxImage ConvertToImage() const;
@@ -111,7 +112,10 @@ public:
bool CopyFromDIB(const wxDIB& dib); bool CopyFromDIB(const wxDIB& dib);
#endif #endif
virtual bool Create(int width, int height, int depth = -1); virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
virtual bool Create(int width, int height, const wxDC& dc); virtual bool Create(int width, int height, const wxDC& dc);
virtual bool Create(const void* data, long type, int width, int height, int depth = 1); virtual bool Create(const void* data, long type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_DEFAULT_TYPE); virtual bool LoadFile(const wxString& name, long type = wxBITMAP_DEFAULT_TYPE);

View File

@@ -65,8 +65,10 @@ private:
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{ {
public: public:
wxBitmap(); wxBitmap() {}
wxBitmap( int width, int height, int depth = -1 ); wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); }
wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const char* const* bits ); wxBitmap( const char* const* bits );
#ifdef wxNEEDS_CHARPP #ifdef wxNEEDS_CHARPP
@@ -81,7 +83,10 @@ public:
static void InitStandardHandlers(); static void InitStandardHandlers();
bool Create(int width, int height, int depth = -1); bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
bool Create(const void* data, wxBitmapType type, bool Create(const void* data, wxBitmapType type,
int width, int height, int depth = -1); int width, int height, int depth = -1);
// create the wxBitmap using a _copy_ of the pixmap // create the wxBitmap using a _copy_ of the pixmap

View File

@@ -274,6 +274,11 @@ public:
*/ */
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
/**
@overload
*/
wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH);
/** /**
Creates a bitmap from XPM data. Creates a bitmap from XPM data.
*/ */
@@ -375,10 +380,15 @@ public:
Creates a fresh bitmap. Creates a fresh bitmap.
If the final argument is omitted, the display depth of the screen is used. If the final argument is omitted, the display depth of the screen is used.
This overload works on all platforms. @return @true if the creation was successful.
*/ */
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
/**
@overload
*/
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH);
/* /*
Creates a bitmap from the given data, which can be of arbitrary type. Creates a bitmap from the given data, which can be of arbitrary type.

View File

@@ -39,6 +39,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase)
// ======================================================================== // ========================================================================
// wxBitmapRefData // wxBitmapRefData
// ======================================================================== // ========================================================================
class wxBitmapRefData: public wxGDIRefData class wxBitmapRefData: public wxGDIRefData
{ {
friend class wxBitmap; friend class wxBitmap;
@@ -61,8 +62,6 @@ protected:
wxMask *m_bitmapMask; // Optional mask wxMask *m_bitmapMask; // Optional mask
}; };
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
wxBitmapRefData::wxBitmapRefData() wxBitmapRefData::wxBitmapRefData()
{ {
m_ok = FALSE; m_ok = FALSE;
@@ -102,6 +101,9 @@ wxBitmapRefData::~wxBitmapRefData()
// ======================================================================== // ========================================================================
// wxBitmap // wxBitmap
// ======================================================================== // ========================================================================
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
wxBitmap::wxBitmap() wxBitmap::wxBitmap()
@@ -125,11 +127,6 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
/* TODO: create the bitmap from data */ /* TODO: create the bitmap from data */
} }
wxBitmap::wxBitmap(int w, int h, int d)
{
(void)Create(w, h, d);
}
wxBitmap::wxBitmap(NSImage* cocoaNSImage) wxBitmap::wxBitmap(NSImage* cocoaNSImage)
{ {
(void) Create(cocoaNSImage); (void) Create(cocoaNSImage);

View File

@@ -394,11 +394,6 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxBitmapBase) IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxBitmapBase)
wxBitmap::wxBitmap(int width, int height, int depth)
{
Create(width, height, depth);
}
bool wxBitmap::Create(const wxIDirectFBSurfacePtr& surface) bool wxBitmap::Create(const wxIDirectFBSurfacePtr& surface)
{ {
UnRef(); UnRef();

View File

@@ -179,7 +179,7 @@ GdkBitmap *wxMask::GetBitmap() const
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmap // wxBitmapRefData
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxBitmapRefData: public wxGDIRefData class wxBitmapRefData: public wxGDIRefData
@@ -226,17 +226,15 @@ wxBitmapRefData::~wxBitmapRefData()
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
} }
//-----------------------------------------------------------------------------
// wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define M_BMPDATA static_cast<wxBitmapRefData*>(m_refData) #define M_BMPDATA static_cast<wxBitmapRefData*>(m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap(int width, int height, int depth)
{
Create(width, height, depth);
}
wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type) wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type)
{ {
LoadFile(filename, type); LoadFile(filename, type);

View File

@@ -220,8 +220,9 @@ GdkBitmap *wxMask::GetBitmap() const
return m_bitmap; return m_bitmap;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmap // wxBitmapRefData
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxBitmapRefData : public wxGDIRefData class wxBitmapRefData : public wxGDIRefData
@@ -347,21 +348,15 @@ wxBitmapRefData::~wxBitmapRefData()
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
} }
//-----------------------------------------------------------------------------
// wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define M_BMPDATA ((wxBitmapRefData *)m_refData) #define M_BMPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap()
{
}
wxBitmap::wxBitmap( int width, int height, int depth )
{
Create( width, height, depth );
}
wxGDIRefData *wxBitmap::CreateGDIRefData() const wxGDIRefData *wxBitmap::CreateGDIRefData() const
{ {
return new wxBitmapRefData; return new wxBitmapRefData;

View File

@@ -58,7 +58,7 @@ static pixel_format_t gs_pixel_format_wxImage =
{0xFF,0x00,0, 0xFF,0x08,0, 0xFF,0x10,0, 0x00,0x00,0}; // RGB 24bpp for wxImage {0xFF,0x00,0, 0xFF,0x08,0, 0xFF,0x10,0, 0x00,0x00,0}; // RGB 24bpp for wxImage
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmap // wxBitmapRefData
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxBitmapRefData: public wxGDIRefData class wxBitmapRefData: public wxGDIRefData
@@ -163,18 +163,15 @@ wxBitmapRefData::~wxBitmapRefData()
delete m_palette; delete m_palette;
} }
//-----------------------------------------------------------------------------
// wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define M_BMPDATA ((wxBitmapRefData *)m_refData) #define M_BMPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxBitmapBase)
wxBitmap::wxBitmap(int width, int height, int depth)
{
Create(width, height, depth);
}
wxGDIRefData *wxBitmap::CreateGDIRefData() const wxGDIRefData *wxBitmap::CreateGDIRefData() const
{ {
return new wxBitmapRefData; return new wxBitmapRefData;

View File

@@ -56,7 +56,7 @@
#endif // no CLR_INVALID #endif // no CLR_INVALID
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Bitmap data // wxBitmapRefData
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData
@@ -512,11 +512,6 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
#endif #endif
} }
wxBitmap::wxBitmap(int w, int h, int d)
{
(void)Create(w, h, d);
}
wxBitmap::wxBitmap(int w, int h, const wxDC& dc) wxBitmap::wxBitmap(int w, int h, const wxDC& dc)
{ {
(void)Create(w, h, dc); (void)Create(w, h, dc);

View File

@@ -276,19 +276,6 @@ wxBitmap::wxBitmap(
SetHBITMAP((WXHBITMAP)hBmp); SetHBITMAP((WXHBITMAP)hBmp);
} // end of wxBitmap::wxBitmap } // end of wxBitmap::wxBitmap
wxBitmap::wxBitmap(
int nW
, int nH
, int nD
)
{
Init();
(void)Create( nW
,nH
,nD
);
} // end of wxBitmap::wxBitmap
wxBitmap::wxBitmap( wxBitmap::wxBitmap(
const void* pData const void* pData
, wxBitmapType lType , wxBitmapType lType

View File

@@ -608,13 +608,13 @@ PicHandle wxBitmapRefData::GetPictHandle()
err = GraphicsExportDoExport(exporter, NULL); err = GraphicsExportDoExport(exporter, NULL);
CGImageRelease( imageRef ); CGImageRelease( imageRef );
size_t handleSize = GetHandleSize( (Handle) m_pictHandle ); size_t handleSize = GetHandleSize( (Handle) m_pictHandle );
// the 512 bytes header is only needed for pict files, but not in memory // the 512 bytes header is only needed for pict files, but not in memory
if ( handleSize >= 512 ) if ( handleSize >= 512 )
{ {
memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 ); memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 );
SetHandleSize( (Handle) m_pictHandle, handleSize - 512 ); SetHandleSize( (Handle) m_pictHandle, handleSize - 512 );
} }
} }
CloseComponent( exporter ); CloseComponent( exporter );
} }
@@ -785,6 +785,12 @@ wxBitmapRefData::~wxBitmapRefData()
Free() ; Free() ;
} }
// ----------------------------------------------------------------------------
// wxBitmap
// ----------------------------------------------------------------------------
bool wxBitmap::CopyFromIcon(const wxIcon& icon) bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{ {
bool created = false ; bool created = false ;
@@ -890,14 +896,6 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon)
return true; return true;
} }
wxBitmap::wxBitmap()
{
}
wxBitmap::~wxBitmap()
{
}
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits) wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)
{ {
wxBitmapRefData* bitmapRefData; wxBitmapRefData* bitmapRefData;
@@ -952,11 +950,6 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
} /* bitmapRefData->IsOk() */ } /* bitmapRefData->IsOk() */
} }
wxBitmap::wxBitmap(int w, int h, int d)
{
(void)Create(w, h, d);
}
wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth) wxBitmap::wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth)
{ {
(void) Create(data, type, width, height, depth); (void) Create(data, type, width, height, depth);

View File

@@ -198,19 +198,11 @@ bool wxBitmap::CopyFromDIB(const wxDIB& dib)
#endif // NEVER_USE_DIB #endif // NEVER_USE_DIB
wxBitmap::~wxBitmap()
{
}
wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
{ {
Init(); Init();
} }
wxBitmap::wxBitmap(int w, int h, int d)
{
}
wxBitmap::wxBitmap(int w, int h, const wxDC& dc) wxBitmap::wxBitmap(int w, int h, const wxDC& dc)
{ {
} }

View File

@@ -224,7 +224,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmap // wxBitmapRefData
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxBitmapRefData : public wxGDIRefData class wxBitmapRefData : public wxGDIRefData
@@ -347,19 +347,15 @@ static WXPixmap wxGetSubPixmap( WXDisplay* xdisplay, WXPixmap xpixmap,
return (WXPixmap)ret; return (WXPixmap)ret;
} }
//-----------------------------------------------------------------------------
// wxBitmap
//-----------------------------------------------------------------------------
#define M_BMPDATA ((wxBitmapRefData *)m_refData) #define M_BMPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap()
{
}
wxBitmap::wxBitmap( int width, int height, int depth )
{
Create( width, height, depth );
}
bool wxBitmap::Create( int width, int height, int depth ) bool wxBitmap::Create( int width, int height, int depth )
{ {
UnRef(); UnRef();