///////////////////////////////////////////////////////////////////////////// // Name: _bitmap.i // Purpose: SWIG interface for wxBitmap and wxMask // // Author: Robin Dunn // // Created: 7-July-1997 // RCS-ID: $Id$ // Copyright: (c) 2003 by Total Control Software // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // Not a %module //--------------------------------------------------------------------------- %{ #include static char** ConvertListOfStrings(PyObject* listOfStrings) { char** cArray = NULL; int count; if (!PyList_Check(listOfStrings)) { PyErr_SetString(PyExc_TypeError, "Expected a list of strings."); return NULL; } count = PyList_Size(listOfStrings); cArray = new char*[count]; for(int x=0; xSetMask(mask); } } DocStr(GetSubBitmap, "Returns a sub bitmap of the current one as long as the rect belongs entirely\n" "to the bitmap. This function preserves bit depth and mask information."); virtual wxBitmap GetSubBitmap(const wxRect& rect) const; DocStr(SaveFile, "Saves a bitmap in the named file."); virtual bool SaveFile(const wxString &name, wxBitmapType type, wxPalette *palette = (wxPalette *)NULL); DocStr(LoadFile, "Loads a bitmap from a file"); virtual bool LoadFile(const wxString &name, wxBitmapType type); #if wxUSE_PALETTE virtual wxPalette *GetPalette() const; virtual void SetPalette(const wxPalette& palette); #endif virtual bool CopyFromIcon(const wxIcon& icon); DocStr(SetHeight, "Set the height property (does not affect the bitmap data).") virtual void SetHeight(int height); DocStr(SetWidth, "Set the width property (does not affect the bitmap data).") virtual void SetWidth(int width); DocStr(SetDepth, "Set the depth property (does not affect the bitmap data).") virtual void SetDepth(int depth); #ifdef __WXMSW__ bool CopyFromCursor(const wxCursor& cursor); int GetQuality(); void SetQuality(int q); #endif %pythoncode { def __nonzero__(self): return self.Ok() } }; //--------------------------------------------------------------------------- DocStr(wxMask, "This class encapsulates a monochrome mask bitmap, where the masked area is\n" "black and the unmasked area is white. When associated with a bitmap and drawn\n" "in a device context, the unmasked area of the bitmap will be drawn, and the\n" "masked area will not be drawn."); class wxMask : public wxObject { public: #if 0 DocCtorStr( wxMask(const wxBitmap& bitmap), "Constructs a mask from a monochrome bitmap."); #endif DocStr(wxMask, "Constructs a mask from a bitmap and a colour in that bitmap that indicates\n" "the transparent portions of the mask, by default BLACK is used."); %extend { wxMask(const wxBitmap& bitmap, const wxColour& colour = wxNullColour) { if ( !colour.Ok() ) return new wxMask(bitmap, *wxBLACK); else return new wxMask(bitmap, colour); } } //~wxMask(); }; %pythoncode { MaskColour = Mask } //--------------------------------------------------------------------------- //---------------------------------------------------------------------------