Debian Codegraph @

swig/fl_draw.i

raw
1 /* File : fl_draw.i */
2 //%module fl_draw
3
4 %include "typemaps.i"
5
6 %{
7 #include "FL/fl_draw.H"
8 %}
9
10 %typemap(in) const uchar * {
11 /* Check if the input support the buffer protocol */
12 Py_buffer view;
13 const void * buffer;
14 int failure = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
15 if (!failure) {
16 // work with array object
17 buffer = view.buf;
18 PyBuffer_Release(&view);
19 $1 = (uchar *) buffer;
20 } else {
21 // work with list object
22 // clear the error from PyObject_GetBuffer
23 PyErr_Clear();
24 buffer=0;
25 /* Check if is a list */
26 if (PyList_Check($input)) {
27 Py_ssize_t size = PyList_Size($input);
28 int i = 0;
29 $1 = (uchar *) malloc((size+1)*sizeof(char));
30 for (i = 0; i < size; i++) {
31 PyObject *o = PyList_GetItem($input,i);
32 if (PyInt_Check(o))
33 $1[i] = (char)PyInt_AsLong(o);
34 else {
35 PyErr_SetString(PyExc_TypeError,"list must contain ints");
36 free($1);
37 return NULL;
38 }
39 }
40 $1[i] = 0;
41 } else {
42 PyErr_SetString(PyExc_TypeError,"not a list or does not support single-segment readable buffer interface");
43 return NULL;
44 }
45 }
46 }
47
48
49 %ignore fl_color(int c);
50 %ignore fl_draw_pixmap(const char* const* data, int x,int y,Fl_Color=FL_GRAY);
51 %ignore fl_measure_pixmap(const char* const* data, int &w, int &h);
52 %ignore fl_chord(int x, int y, int w, int h, double a1, double a2);
53 %ignore fl_read_image(uchar *p, int x,int y, int w, int h, int alpha=0);
54 %ignore fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
55 %ignore fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
56 %ignore fl_measure;
57 //ToDo
58 %ignore fl_draw_check;
59
60 %apply int* OUTPUT { int& };
61
62 %include "FL/fl_draw.H"
63
64 %rename("") fl_measure; // Undo the %ignore
65
66 // Apply INOUT only to the 'x' and 'y' parameters in fl_measure
67 %apply int* OUTPUT { int& w };
68 %apply int* OUTPUT { int& h };
69 FL_EXPORT void fl_measure(const char *str, int &w, int &h, int draw_symbols = 1);
70