| 1 |
/* File : Fl_Pixmap.i */ |
| 2 |
//%module Fl_Pixmap |
| 3 |
|
| 4 |
%feature("docstring") ::Fl_Pixmap |
| 5 |
""" |
| 6 |
The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency. |
| 7 |
""" ; |
| 8 |
|
| 9 |
%{ |
| 10 |
#include "FL/Fl_Pixmap.H" |
| 11 |
%} |
| 12 |
|
| 13 |
//%include "macros.i" |
| 14 |
//CHANGE_OWNERSHIP(Fl_Pixmap) |
| 15 |
|
| 16 |
// This tells SWIG to treat char ** as a special case |
| 17 |
//%typemap(python,in) const char* const * pixmapData { |
| 18 |
%typemap(in) char** { |
| 19 |
/* Check if it is a list */ |
| 20 |
if (PyList_Check($input)) { |
| 21 |
Py_ssize_t size = PyList_Size($input); |
| 22 |
int i = 0; |
| 23 |
$1 = (char **) malloc((size+1)*sizeof(char *)); |
| 24 |
for (i = 0; i < size; i++) { |
| 25 |
PyObject *o = PyList_GetItem($input,i); |
| 26 |
|
| 27 |
%#if PY_VERSION_HEX>=0x03000000 |
| 28 |
if (PyUnicode_Check(o)) |
| 29 |
%#else |
| 30 |
if (PyString_Check(o)) |
| 31 |
%#endif |
| 32 |
{ |
| 33 |
//$1[i] = PyString_AsString(PyList_GetItem($input,i)); |
| 34 |
//$1[i] = SWIG_Python_str_AsChar(PyList_GetItem($input,i)); |
| 35 |
$1[i] = const_cast<char*>(PyUnicode_AsUTF8(PyList_GetItem($input,i))); |
| 36 |
} |
| 37 |
else { |
| 38 |
PyErr_SetString(PyExc_TypeError,"list must contain strings"); |
| 39 |
free($1); |
| 40 |
return NULL; |
| 41 |
} |
| 42 |
|
| 43 |
} |
| 44 |
$1[i] = NULL; |
| 45 |
|
| 46 |
} else { |
| 47 |
PyErr_SetString(PyExc_TypeError,"not a list"); |
| 48 |
return NULL; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
%typemap(freearg) char** { |
| 54 |
// this is a memory leak, but what the heck! |
| 55 |
// free((char*)$1); |
| 56 |
} |
| 57 |
|
| 58 |
//%ignore Fl_Pixmap::Fl_Pixmap(const char* const * D); |
| 59 |
%ignore Fl_Pixmap::Fl_Pixmap(const uchar* const * D); |
| 60 |
%ignore Fl_Pixmap::Fl_Pixmap(char * const * D); |
| 61 |
%ignore Fl_Pixmap::Fl_Pixmap(uchar * const * D); |
| 62 |
%ignore Fl_Pixmap::id; |
| 63 |
%ignore Fl_Pixmap::mask; |
| 64 |
|
| 65 |
|
| 66 |
%include "FL/Fl_Pixmap.H" |
| 67 |
|