1
/* -*- Mode: C; c-basic-offset: 4 -*-
2
Gimp-Python - allows the writing of Gimp plugins in Python.
3
Copyright (C) 1997-2002 James Henstridge <james@daa.com.au>
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
static PyMethodDef disp_methods[] = {
26
{NULL, NULL} /* sentinel */
30
disp_dealloc(PyGimpDisplay *self)
36
disp_repr(PyGimpDisplay *self)
40
s = PyString_FromString("<display>");
45
disp_init(PyGimpDisplay *self, PyObject *args, PyObject *kwargs)
49
if (!PyArg_ParseTuple(args, "O!:gimp.Display.__init__",
50
&PyGimpImage_Type, &img))
52
self->ID = gimp_display_new(img->ID);
54
PyErr_SetString(pygimp_error, "could not create image");
60
PyTypeObject PyGimpDisplay_Type = {
61
PyObject_HEAD_INIT(NULL)
63
"gimp.Display", /* tp_name */
64
sizeof(PyGimpDisplay), /* tp_basicsize */
67
(destructor)disp_dealloc, /* tp_dealloc */
68
(printfunc)0, /* tp_print */
69
(getattrfunc)0, /* tp_getattr */
70
(setattrfunc)0, /* tp_setattr */
71
(cmpfunc)0, /* tp_compare */
72
(reprfunc)disp_repr, /* tp_repr */
74
0, /* tp_as_sequence */
75
0, /* tp_as_mapping */
76
(hashfunc)0, /* tp_hash */
77
(ternaryfunc)0, /* tp_call */
78
(reprfunc)0, /* tp_str */
79
(getattrofunc)0, /* tp_getattro */
80
(setattrofunc)0, /* tp_setattro */
82
Py_TPFLAGS_DEFAULT, /* tp_flags */
83
NULL, /* Documentation string */
84
(traverseproc)0, /* tp_traverse */
85
(inquiry)0, /* tp_clear */
86
(richcmpfunc)0, /* tp_richcompare */
87
0, /* tp_weaklistoffset */
88
(getiterfunc)0, /* tp_iter */
89
(iternextfunc)0, /* tp_iternext */
90
disp_methods, /* tp_methods */
93
(PyTypeObject *)0, /* tp_base */
94
(PyObject *)0, /* tp_dict */
97
0, /* tp_dictoffset */
98
(initproc)disp_init, /* tp_init */
99
(allocfunc)0, /* tp_alloc */
100
(newfunc)0, /* tp_new */
104
pygimp_display_new(gint32 ID)
108
self = PyObject_NEW(PyGimpDisplay, &PyGimpDisplay_Type);
112
return (PyObject *)self;