1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface file for wxImage, wxImageHandler, etc.
7 // Created: 28-Apr-1999
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
31 //---------------------------------------------------------------------------
33 class wxImageHandler {
37 wxString GetExtension();
39 wxString GetMimeType();
41 //bool LoadFile(wxImage* image, wxInputStream& stream);
42 //bool SaveFile(wxImage* image, wxOutputStream& stream);
44 void SetName(const wxString& name);
45 void SetExtension(const wxString& extension);
46 void SetType(long type);
47 void SetMimeType(const wxString& mimetype);
50 //---------------------------------------------------------------------------
52 class wxPNGHandler : public wxImageHandler {
58 class wxJPEGHandler : public wxImageHandler {
64 class wxBMPHandler : public wxImageHandler {
70 class wxGIFHandler : public wxImageHandler {
77 //---------------------------------------------------------------------------
81 wxImage( const wxString& name, long type = wxBITMAP_TYPE_PNG );
84 wxBitmap ConvertToBitmap();
85 void Create( int width, int height );
87 wxImage Scale( int width, int height );
88 void Rescale(int width, int height);
90 void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
91 unsigned char GetRed( int x, int y );
92 unsigned char GetGreen( int x, int y );
93 unsigned char GetBlue( int x, int y );
95 bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_PNG );
96 %name(LoadMimeFile)bool LoadFile( const wxString& name, const wxString& mimetype );
98 bool SaveFile( const wxString& name, int type );
99 %name(SaveMimeFile)bool SaveFile( const wxString& name, const wxString& mimetype );
105 //unsigned char *GetData();
106 //void SetData( unsigned char *data );
109 PyObject* GetData() {
110 unsigned char* data = self->GetData();
111 int len = self->GetWidth() * self->GetHeight() * 3;
112 return PyString_FromStringAndSize((char*)data, len);
115 void SetData(PyObject* data) {
116 unsigned char* dataPtr;
118 if (! PyString_Check(data)) {
119 PyErr_SetString(PyExc_TypeError, "Expected string object");
122 dataPtr = (unsigned char*)PyString_AsString(data);
123 self->SetData(dataPtr);
127 void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
128 unsigned char GetMaskRed();
129 unsigned char GetMaskGreen();
130 unsigned char GetMaskBlue();
131 void SetMask( bool mask = TRUE );
136 // Alternate constructors
137 %new wxImage* wxNullImage();
138 %new wxImage* wxEmptyImage(int width, int height);
139 %new wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype);
140 %new wxImage* wxImageFromBitmap(const wxBitmap &bitmap);
142 wxImage* wxNullImage() {
146 wxImage* wxEmptyImage(int width, int height) {
147 return new wxImage(width, height);
150 wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype) {
151 return new wxImage(name, mimetype);
154 wxImage* wxImageFromBitmap(const wxBitmap &bitmap) {
155 return new wxImage(bitmap);
160 void wxImage_AddHandler(wxImageHandler *handler);
162 void wxImage_AddHandler(wxImageHandler *handler) {
163 wxImage::AddHandler(handler);
167 //---------------------------------------------------------------------------
168 //---------------------------------------------------------------------------