Debian Codegraph @

swig/Fl_Bitmap.i

raw
1 /* File : Fl_Bitmap.i */
2 //%module Fl_Bitmap
3
4 %feature("docstring") ::Fl_Bitmap
5 """
6 The Fl_Bitmap class supports caching and drawing of mono-color
7 (bitmap) images. Images are drawn using the current color.
8 """ ;
9
10 %{
11 #include "FL/Fl_Bitmap.H"
12 %}
13
14 %typemap(in) const uchar *bits {
15 /* Check if the input support the buffer protocol */
16 Py_buffer view;
17 const void * buffer;
18 int failure = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
19 if (!failure) {
20 // work with array object
21 buffer = view.buf;
22 PyBuffer_Release(&view);
23 $1 = (uchar *) buffer;
24 } else {
25 // work with list object
26 // clear the error from PyObject_GetBuffer
27 PyErr_Clear();
28 buffer=0;
29 /* Check if is a list */
30 if (PyList_Check($input)) {
31 Py_ssize_t size = PyList_Size($input);
32 int i = 0;
33 $1 = (uchar *) malloc((size+1)*sizeof(char));
34 for (i = 0; i < size; i++) {
35 PyObject *o = PyList_GetItem($input,i);
36 if (PyInt_Check(o))
37 $1[i] = (char)PyInt_AsLong(o);
38 else {
39 PyErr_SetString(PyExc_TypeError,"list must contain ints");
40 free($1);
41 return NULL;
42 }
43 }
44 $1[i] = 0;
45 } else {
46 PyErr_SetString(PyExc_TypeError,"not a list or does not support single-segment readable buffer interface");
47 return NULL;
48 }
49 }
50 }
51
52
53 %ignore Fl_Bitmap::Fl_Bitmap(const char *bits, int W, int H);
54 %ignore Fl_Bitmap::id;
55
56 //%include "macros.i"
57 //CHANGE_OWNERSHIP(Fl_Bitmap)
58
59 %include "FL/Fl_Bitmap.H"
60
61
62