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:
Robin Dunn
2004-04-15 18:23:17 +00:00
parent 1980f3fa71
commit ba938c3d00
3 changed files with 62 additions and 7 deletions

View File

@@ -83,14 +83,24 @@ public:
%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(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 );
%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) {
if (width > 0 && height > 0)
return new wxImage(width, height, clear);
else
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) {
return new wxImage(bitmap.ConvertToImage());
}
@@ -161,6 +171,13 @@ public:
int GetWidth();
int GetHeight();
%extend {
wxSize GetSize() {
wxSize size(self->GetWidth(), self->GetHeight());
return size;
}
}
wxImage GetSubImage(const wxRect& rect);
wxImage Copy();
void Paste( const wxImage &image, int x, int y );