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 char bits[], int width, int height, int depth = 1);
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 wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
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(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;

View File

@@ -59,9 +59,11 @@ protected:
WX_NSBitmapImageRep m_cocoaNSBitmapImageRep;
};
// ========================================================================
// wxBitmap
// ========================================================================
class WXDLLIMPEXP_CORE wxBitmap: public wxGDIObject
{
// ------------------------------------------------------------------------
@@ -83,10 +85,13 @@ public:
// Constructor for generalised creation from data
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
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:
wxBitmap(const wxImage& image, int depth = -1)
{ CreateFromImage(image, depth); }
{ CreateFromImage(image, depth); }
// Convert from wxIcon
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
@@ -100,7 +105,10 @@ public:
// Initialize from wxImage
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(NSBitmapImageRep* cocoaNSBitmapImageRep);
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:
wxBitmap() {}
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 wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
wxBitmap(const char* const* bits);
@@ -35,7 +36,9 @@ public:
#endif
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 GetWidth() const;

View File

@@ -51,13 +51,16 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
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* const* bits );
#ifdef wxNEEDS_CHARPP
// needed for old GCC
wxBitmap(char** data)
{ *this = wxBitmap(const_cast<const char* const*>(data)); }
{ *this = wxBitmap(const_cast<const char* const*>(data)); }
#endif
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
#if wxUSE_IMAGE
@@ -67,6 +70,8 @@ public:
virtual ~wxBitmap();
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 GetWidth() const;

View File

@@ -64,8 +64,9 @@ private:
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap() {}
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* const* bits );
#ifdef wxNEEDS_CHARPP
@@ -79,7 +80,9 @@ public:
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
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 GetWidth() const;

View File

@@ -27,14 +27,19 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
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* const* bits);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
wxBitmap(const wxImage& image, int depth = -1);
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 GetWidth() const;

View File

@@ -73,7 +73,8 @@ public:
//
// 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
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
wxBitmap(int width, int height, const wxDC& dc);
@@ -137,6 +138,9 @@ public:
#endif
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(const void* data, wxBitmapType type, int width, int height, int depth = 1);
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
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 )
{ (void)CreateFromImage(image, depth); }
@@ -152,8 +161,11 @@ public:
virtual bool Create( int nWidth
,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
,wxBitmapType lType
,int nWidth

View File

@@ -87,7 +87,7 @@ class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler;
public:
wxBitmap(); // Platform-specific
wxBitmap() {} // Platform-specific
// Initialize with raw data.
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);
// 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:
wxBitmap(const wxImage& image, int depth = -1);
@@ -110,14 +111,17 @@ public:
// Convert from wxIcon
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
virtual ~wxBitmap();
virtual ~wxBitmap() {}
wxImage ConvertToImage() const;
// get the given part of bitmap
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( WXHICON icon) ;
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
// 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
wxBitmap(int width, int height, const wxDC& dc);
@@ -91,7 +92,7 @@ public:
return *this;
}
virtual ~wxBitmap();
virtual ~wxBitmap() {}
#if wxUSE_IMAGE && wxUSE_WXDIB
wxImage ConvertToImage() const;
@@ -111,7 +112,10 @@ public:
bool CopyFromDIB(const wxDIB& dib);
#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(const void* data, long type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_DEFAULT_TYPE);

View File

@@ -65,8 +65,10 @@ private:
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap() {}
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* const* bits );
#ifdef wxNEEDS_CHARPP
@@ -81,7 +83,10 @@ public:
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,
int width, int height, int depth = -1);
// create the wxBitmap using a _copy_ of the pixmap