4
static PyTypeObject *_PyPangoCairoContext_Type;
5
#define PyPangoCairoContext_Type (*_PyPangoCairoContext_Type)
8
_wrap_clutter_cairo_set_source_color (PyObject *self,
12
static char *kwlist[] = { "color", NULL };
14
ClutterColor *color = NULL;
16
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
17
"O:cluttercairo.CairoContext.set_source_color",
21
if (pyg_boxed_check (py_color, CLUTTER_TYPE_COLOR))
22
color = pyg_boxed_get (py_color, ClutterColor);
25
PyErr_SetString (PyExc_TypeError, "color should be a clutter.Color");
29
clutter_cairo_set_source_color (PycairoContext_GET (self), color);
35
static PyMethodDef _PyClutterCairoContext_methods[] = {
36
{ "set_source_color", (PyCFunction)_wrap_clutter_cairo_set_source_color, METH_VARARGS | METH_KEYWORDS },
40
PyTypeObject PyClutterCairoContext_Type = {
41
PyObject_HEAD_INIT(NULL)
43
"cluttercairo.CairoContext", /* tp_name */
47
(destructor)0, /* tp_dealloc */
48
(printfunc)0, /* tp_print */
49
(getattrfunc)0, /* tp_getattr */
50
(setattrfunc)0, /* tp_setattr */
51
(cmpfunc)0, /* tp_compare */
52
(reprfunc)0, /* tp_repr */
54
0, /* tp_as_sequence */
55
0, /* tp_as_mapping */
56
(hashfunc)0, /* tp_hash */
57
(ternaryfunc)0, /* tp_call */
58
(reprfunc)0, /* tp_str */
59
(getattrofunc)0, /* tp_getattro */
60
(setattrofunc)0, /* tp_setattro */
62
Py_TPFLAGS_DEFAULT, /* tp_flags */
63
"A pangocairo.CairoContext enhanced with some additional clutter methods", /* Documentation string */
64
(traverseproc)0, /* tp_traverse */
65
(inquiry)0, /* tp_clear */
66
(richcmpfunc)0, /* tp_richcompare */
67
0, /* tp_weaklistoffset */
68
(getiterfunc)0, /* tp_iter */
69
(iternextfunc)0, /* tp_iternext */
70
_PyClutterCairoContext_methods, /* tp_methods */
73
(PyTypeObject *)0, /* tp_base */
74
(PyObject *)0, /* tp_dict */
77
0, /* tp_dictoffset */
78
(initproc)0, /* tp_init */
82
(inquiry)0, /* tp_is_gc */
83
(PyObject *)0, /* tp_bases */
3
88
#define NO_IMPORT_PYGOBJECT
4
89
#include "pygobject.h"
102
clutter_cairo_set_source_color
106
if ((module = PyImport_ImportModule ("pangocairo")) != NULL) {
107
PyObject *moddict = PyModule_GetDict (module);
109
_PyPangoCairoContext_Type = (PyTypeObject *) PyDict_GetItemString (moddict, "CairoContext");
110
if (_PyPangoCairoContext_Type == NULL) {
111
PyErr_SetString (PyExc_ImportError, "cannot import name CairoContext from pangocairo");
119
PyClutterCairoContext_Type.tp_base = &PyPangoCairoContext_Type;
120
if (PyType_Ready (&PyClutterCairoContext_Type) < 0) {
121
g_return_if_reached ();
123
if (PyDict_SetItemString (d, "CairoContext", (PyObject *) &PyClutterCairoContext_Type) < 0) {
124
g_return_if_reached ();
18
128
override clutter_cairo_create noargs
20
130
_wrap_clutter_cairo_create (PyGObject *self)
134
ret = clutter_cairo_create (CLUTTER_CAIRO (self->obj));
135
return PycairoContext_FromContext (ret, &PyClutterCairoContext_Type, NULL);
138
override clutter_cairo_create_region kwargs
140
_wrap_clutter_cairo_create_region (PyGObject *self,
144
static char *kwlist[] = { "x_offset", "y_offset", "width", "height", NULL };
145
int x_offset, y_offset;
146
PyObject *py_width = NULL, *py_height = NULL;
24
ret = clutter_cairo_create (CLUTTER_CAIRO (self->obj));
25
return PycairoContext_FromContext(ret, NULL, NULL);
148
guint width = 0, height = 0;
150
if (!PyArg_ParseTupleAndKeywords (args, kwargs,"iiOO:ClutterCairo.cairo_create_region", kwlist, &x_offset, &y_offset, &py_width, &py_height))
154
if (PyLong_Check(py_width))
155
width = PyLong_AsUnsignedLong(py_width);
156
else if (PyInt_Check(py_width))
157
width = PyInt_AsLong(py_width);
159
PyErr_SetString(PyExc_TypeError, "Parameter 'width' must be an int or a long");
160
if (PyErr_Occurred())
165
if (PyLong_Check(py_height))
166
height = PyLong_AsUnsignedLong(py_height);
167
else if (PyInt_Check(py_height))
168
height = PyInt_AsLong(py_height);
170
PyErr_SetString(PyExc_TypeError, "Parameter 'height' must be an int or a long");
171
if (PyErr_Occurred())
175
ret = clutter_cairo_create_region (CLUTTER_CAIRO (self->obj),
178
return PycairoContext_FromContext (ret, &PyClutterCairoContext_Type, NULL);