Added some convenience methods to wx.Bitmap: SetSize, GetSize, and
wx.EmptyBitmap can be called with a wx.Size (or a 2-element sequence) object too. Similar changes were done for wx.Image as well. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,6 +13,12 @@ size is smaller than the item's GetBestSize. When a window is added
|
|||||||
to a sizer it's initial size, if any, is set as the window's minimal
|
to a sizer it's initial size, if any, is set as the window's minimal
|
||||||
size using SetSizeHints if there isn't already a minimal size.
|
size using SetSizeHints if there isn't already a minimal size.
|
||||||
|
|
||||||
|
Added some convenience methods to wx.Bitmap: SetSize, GetSize, and
|
||||||
|
wx.EmptyBitmap can be called with a wx.Size (or a 2-element sequence)
|
||||||
|
object too. Similar changes were done for wx.Image as well.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2.5.1.5
|
2.5.1.5
|
||||||
-------
|
-------
|
||||||
|
@@ -53,12 +53,12 @@ public:
|
|||||||
|
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
|
|
||||||
DocCtorStrName(
|
// DocCtorStrName(
|
||||||
wxBitmap(int width, int height, int depth=-1),
|
// wxBitmap(int width, int height, int depth=-1),
|
||||||
"Creates a new bitmap of the given size. A depth of -1 indicates the depth of\n"
|
// "Creates a new bitmap of the given size. A depth of -1 indicates the depth of\n"
|
||||||
"the current screen or visual. Some platforms only support 1 for monochrome and\n"
|
// "the current screen or visual. Some platforms only support 1 for monochrome and\n"
|
||||||
"-1 for the current colour setting.",
|
// "-1 for the current colour setting.",
|
||||||
EmptyBitmap);
|
// EmptyBitmap);
|
||||||
|
|
||||||
DocCtorStrName(
|
DocCtorStrName(
|
||||||
wxBitmap(const wxIcon& icon),
|
wxBitmap(const wxIcon& icon),
|
||||||
@@ -100,6 +100,21 @@ public:
|
|||||||
PyString_AsStringAndSize(bits, &buf, &length);
|
PyString_AsStringAndSize(bits, &buf, &length);
|
||||||
return new wxBitmap(buf, width, height, depth);
|
return new wxBitmap(buf, width, height, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DocStr(wxBitmap(const wxSize& size, int depth=-1),
|
||||||
|
"Creates a new bitmap of the given size. A depth of -1 indicates
|
||||||
|
the depth of the current screen or visual. Some platforms only
|
||||||
|
support 1 for monochrome and -1 for the current colour setting.");
|
||||||
|
|
||||||
|
%nokwargs wxBitmap(int width, int height, int depth=-1);
|
||||||
|
%nokwargs wxBitmap(const wxSize& size, int depth=-1);
|
||||||
|
%name(EmptyBitmap)wxBitmap(int width, int height, int depth=-1) {
|
||||||
|
return new wxBitmap(width, height, depth);
|
||||||
|
}
|
||||||
|
%name(EmptyBitmap)wxBitmap(const wxSize& size, int depth=-1) {
|
||||||
|
return new wxBitmap(size.x, size.y, depth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -128,6 +143,16 @@ public:
|
|||||||
"monochrome bitmap.");
|
"monochrome bitmap.");
|
||||||
int GetDepth();
|
int GetDepth();
|
||||||
|
|
||||||
|
|
||||||
|
%extend {
|
||||||
|
DocStr(GetSize, "Get the size of the bitmap.");
|
||||||
|
wxSize GetSize() {
|
||||||
|
wxSize size(self->GetWidth(), self->GetHeight());
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DocStr(ConvertToImage,
|
DocStr(ConvertToImage,
|
||||||
"Creates a platform-independent image from a platform-dependent bitmap. This\n"
|
"Creates a platform-independent image from a platform-dependent bitmap. This\n"
|
||||||
"preserves mask information so that bitmaps and images can be converted back\n"
|
"preserves mask information so that bitmaps and images can be converted back\n"
|
||||||
@@ -182,6 +207,13 @@ public:
|
|||||||
DocStr(SetDepth, "Set the depth property (does not affect the bitmap data).")
|
DocStr(SetDepth, "Set the depth property (does not affect the bitmap data).")
|
||||||
virtual void SetDepth(int depth);
|
virtual void SetDepth(int depth);
|
||||||
|
|
||||||
|
%extend {
|
||||||
|
DocStr(SetSize, "Set the bitmap size");
|
||||||
|
void SetSize(const wxSize& size) {
|
||||||
|
self->SetWidth(size.x);
|
||||||
|
self->SetHeight(size.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
bool CopyFromCursor(const wxCursor& cursor);
|
bool CopyFromCursor(const wxCursor& cursor);
|
||||||
|
@@ -83,13 +83,23 @@ public:
|
|||||||
%name(ImageFromMime) wxImage(const wxString& name, const wxString& mimetype, int index = -1);
|
%name(ImageFromMime) wxImage(const wxString& name, const wxString& mimetype, int index = -1);
|
||||||
%name(ImageFromStream) wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
|
%name(ImageFromStream) wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
|
||||||
%name(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 );
|
%name(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%extend {
|
%extend {
|
||||||
|
|
||||||
|
%nokwargs wxImage(int width=0, int height=0, bool clear = True);
|
||||||
|
%nokwargs wxImage(const wxSize& size, bool clear = True);
|
||||||
%name(EmptyImage) wxImage(int width=0, int height=0, bool clear = True) {
|
%name(EmptyImage) wxImage(int width=0, int height=0, bool clear = True) {
|
||||||
if (width > 0 && height > 0)
|
if (width > 0 && height > 0)
|
||||||
return new wxImage(width, height, clear);
|
return new wxImage(width, height, clear);
|
||||||
else
|
else
|
||||||
return new wxImage;
|
return new wxImage;
|
||||||
}
|
}
|
||||||
|
%name(EmptyImage) wxImage(const wxSize& size, bool clear = True) {
|
||||||
|
return new wxImage(size.x, size.y, clear);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
%name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) {
|
%name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) {
|
||||||
return new wxImage(bitmap.ConvertToImage());
|
return new wxImage(bitmap.ConvertToImage());
|
||||||
@@ -161,6 +171,13 @@ public:
|
|||||||
int GetWidth();
|
int GetWidth();
|
||||||
int GetHeight();
|
int GetHeight();
|
||||||
|
|
||||||
|
%extend {
|
||||||
|
wxSize GetSize() {
|
||||||
|
wxSize size(self->GetWidth(), self->GetHeight());
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxImage GetSubImage(const wxRect& rect);
|
wxImage GetSubImage(const wxRect& rect);
|
||||||
wxImage Copy();
|
wxImage Copy();
|
||||||
void Paste( const wxImage &image, int x, int y );
|
void Paste( const wxImage &image, int x, int y );
|
||||||
|
Reference in New Issue
Block a user