update to list all methods. Convert no arg functions to METH_NOARG (slight

2002-08-30  James Henstridge  <james@daa.com.au>

    * pygimp-*.c: update to list all methods.  Convert no arg
    functions to METH_NOARG (slight code size reduction).
This commit is contained in:
James Henstridge 2002-08-30 15:00:00 +00:00 committed by James Henstridge
parent 29aa6f5037
commit e7d1c4fa91
4 changed files with 436 additions and 234 deletions

View File

@ -1,5 +1,8 @@
2002-08-30 James Henstridge <james@daa.com.au>
* pygimp-*.c: update to list all methods. Convert no arg
functions to METH_NOARG (slight code size reduction).
* pygimp-drawable.c (PyGimpDrawable_Type): add getsets for common
drawable attributes.
(PyGimpLayer_Type): convert getattr and setattr to getsets.

View File

@ -28,12 +28,6 @@
/* maximum bits per pixel ... */
#define MAX_BPP 4
/* part of Hans Breuer's pygimp on win32 patch */
#if defined(_MSC_VER)
/* reduce strict checking in glibconfig.h */
# pragma warning(default:4047)
#endif
PyObject *pygimp_error;
#ifndef PG_DEBUG
@ -217,11 +211,9 @@ pygimp_main(PyObject *self, PyObject *args)
}
static PyObject *
pygimp_quit(PyObject *self, PyObject *args)
pygimp_quit(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":quit"))
return NULL;
gimp_quit();
Py_INCREF(Py_None);
return Py_None;
@ -295,13 +287,11 @@ pygimp_progress_update(PyObject *self, PyObject *args)
}
static PyObject *
pygimp_image_list(PyObject *self, PyObject *args)
pygimp_image_list(PyObject *self)
{
gint32 *imgs;
int nimgs, i;
PyObject *ret;
if (!PyArg_ParseTuple(args, ":image_list"))
return NULL;
imgs = gimp_image_list(&nimgs);
ret = PyList_New(nimgs);
for (i = 0; i < nimgs; i++)
@ -454,48 +444,40 @@ pygimp_register_save_handler(PyObject *self, PyObject *args)
}
static PyObject *
pygimp_gamma(PyObject *self, PyObject *args)
pygimp_gamma(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":gamma"))
return NULL;
return PyFloat_FromDouble(gimp_gamma());
}
static PyObject *
pygimp_install_cmap(PyObject *self, PyObject *args)
pygimp_install_cmap(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":install_cmap"))
return NULL;
return PyInt_FromLong(gimp_install_cmap());
}
static PyObject *
pygimp_gtkrc(PyObject *self, PyObject *args)
pygimp_gtkrc(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":gtkrc"))
return NULL;
return PyString_FromString(gimp_gtkrc());
}
static PyObject *
pygimp_get_background(PyObject *self, PyObject *args)
pygimp_get_background(PyObject *self)
{
GimpRGB colour;
guchar r, g, b;
if (!PyArg_ParseTuple(args, ":get_background"))
return NULL;
gimp_palette_get_background(&colour);
gimp_rgb_get_uchar(&colour, &r, &g, &b);
return Py_BuildValue("(iii)", (int)r, (int)g, (int)b);
}
static PyObject *
pygimp_get_foreground(PyObject *self, PyObject *args)
pygimp_get_foreground(PyObject *self)
{
GimpRGB colour;
guchar r, g, b;
if (!PyArg_ParseTuple(args, ":get_foreground"))
return NULL;
gimp_palette_get_foreground(&colour);
gimp_rgb_get_uchar(&colour, &r, &g, &b);
return Py_BuildValue("(iii)", (int)r, (int)g, (int)b);
@ -540,13 +522,12 @@ pygimp_set_foreground(PyObject *self, PyObject *args)
}
static PyObject *
pygimp_gradients_get_list(PyObject *self, PyObject *args)
pygimp_gradients_get_list(PyObject *self)
{
char **list;
int num, i;
PyObject *ret;
if (!PyArg_ParseTuple(args, ":gradients_get_list"))
return NULL;
list = gimp_gradients_get_list(&num);
ret = PyList_New(num);
for (i = 0; i < num; i++)
@ -556,10 +537,8 @@ pygimp_gradients_get_list(PyObject *self, PyObject *args)
}
static PyObject *
pygimp_gradients_get_gradient(PyObject *self, PyObject *args)
pygimp_gradients_get_gradient(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":gradients_get_gradient"))
return NULL;
return PyString_FromString(gimp_gradients_get_gradient());
}
@ -643,10 +622,8 @@ pygimp_delete(PyObject *self, PyObject *args)
static PyObject *
pygimp_displays_flush(PyObject *self, PyObject *args)
pygimp_displays_flush(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":flush"))
return NULL;
gimp_displays_flush();
Py_INCREF(Py_None);
return Py_None;
@ -678,19 +655,15 @@ pygimp_tile_cache_ntiles(PyObject *self, PyObject *args)
static PyObject *
pygimp_tile_width(PyObject *self, PyObject *args)
pygimp_tile_width(PyObject *self)
{
if (PyArg_ParseTuple(args, ":tile_width"))
return NULL;
return PyInt_FromLong(gimp_tile_width());
}
static PyObject *
pygimp_tile_height(PyObject *self, PyObject *args)
pygimp_tile_height(PyObject *self)
{
if (PyArg_ParseTuple(args, ":tile_height"))
return NULL;
return PyInt_FromLong(gimp_tile_height());
}
@ -698,10 +671,8 @@ void gimp_extension_ack (void);
void gimp_extension_process (guint timeout);
static PyObject *
pygimp_extension_ack(PyObject *self, PyObject *args)
pygimp_extension_ack(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":extension_ack"))
return NULL;
gimp_extension_ack();
Py_INCREF(Py_None);
return Py_None;
@ -765,10 +736,30 @@ pygimp_parasite_detach(PyObject *self, PyObject *args)
}
static PyObject *
pygimp_default_display(PyObject *self, PyObject *args)
pygimp_parasite_list(PyObject *self)
{
gint num_parasites;
gchar **parasites;
if (gimp_parasite_list(&num_parasites, &parasites)) {
PyObject *ret;
gint i;
ret = PyTuple_New(num_parasites);
for (i = 0; i < num_parasites; i++) {
PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
g_free(parasites[i]);
}
g_free(parasites);
return ret;
}
PyErr_SetString(pygimp_error, "could not list parasites");
return NULL;
}
static PyObject *
pygimp_default_display(PyObject *self)
{
if (!PyArg_ParseTuple(args, ":default_display"))
return NULL;
return pygimp_display_new(gimp_default_display());
}
@ -812,43 +803,44 @@ id2display(PyObject *self, PyObject *args)
static struct PyMethodDef gimp_methods[] = {
{"main", (PyCFunction)pygimp_main, METH_VARARGS},
{"quit", (PyCFunction)pygimp_quit, METH_VARARGS},
{"quit", (PyCFunction)pygimp_quit, METH_NOARGS},
{"set_data", (PyCFunction)pygimp_set_data, METH_VARARGS},
{"get_data", (PyCFunction)pygimp_get_data, METH_VARARGS},
{"progress_init", (PyCFunction)pygimp_progress_init, METH_VARARGS},
{"progress_update", (PyCFunction)pygimp_progress_update, METH_VARARGS},
{"image_list", (PyCFunction)pygimp_image_list, METH_VARARGS},
{"image_list", (PyCFunction)pygimp_image_list, METH_NOARGS},
{"install_procedure", (PyCFunction)pygimp_install_procedure, METH_VARARGS},
{"install_temp_proc", (PyCFunction)pygimp_install_temp_proc, METH_VARARGS},
{"uninstall_temp_proc", (PyCFunction)pygimp_uninstall_temp_proc, METH_VARARGS},
{"register_magic_load_handler", (PyCFunction)pygimp_register_magic_load_handler, METH_VARARGS},
{"register_load_handler", (PyCFunction)pygimp_register_load_handler, METH_VARARGS},
{"register_save_handler", (PyCFunction)pygimp_register_save_handler, METH_VARARGS},
{"gamma", (PyCFunction)pygimp_gamma, METH_VARARGS},
{"install_cmap", (PyCFunction)pygimp_install_cmap, METH_VARARGS},
{"gtkrc", (PyCFunction)pygimp_gtkrc, METH_VARARGS},
{"get_background", (PyCFunction)pygimp_get_background, METH_VARARGS},
{"get_foreground", (PyCFunction)pygimp_get_foreground, METH_VARARGS},
{"gamma", (PyCFunction)pygimp_gamma, METH_NOARGS},
{"install_cmap", (PyCFunction)pygimp_install_cmap, METH_NOARGS},
{"gtkrc", (PyCFunction)pygimp_gtkrc, METH_NOARGS},
{"get_background", (PyCFunction)pygimp_get_background, METH_NOARGS},
{"get_foreground", (PyCFunction)pygimp_get_foreground, METH_NOARGS},
{"set_background", (PyCFunction)pygimp_set_background, METH_VARARGS},
{"set_foreground", (PyCFunction)pygimp_set_foreground, METH_VARARGS},
{"gradients_get_list", (PyCFunction)pygimp_gradients_get_list, METH_VARARGS},
{"gradients_get_gradient", (PyCFunction)pygimp_gradients_get_gradient, METH_VARARGS},
{"gradients_get_list", (PyCFunction)pygimp_gradients_get_list, METH_NOARGS},
{"gradients_get_gradient", (PyCFunction)pygimp_gradients_get_gradient, METH_NOARGS},
{"gradients_set_gradient", (PyCFunction)pygimp_gradients_set_gradient, METH_VARARGS},
{"gradients_sample_uniform", (PyCFunction)pygimp_gradients_sample_uniform, METH_VARARGS},
{"gradients_sample_custom", (PyCFunction)pygimp_gradients_sample_custom, METH_VARARGS},
{"delete", (PyCFunction)pygimp_delete, METH_VARARGS},
{"displays_flush", (PyCFunction)pygimp_displays_flush, METH_VARARGS},
{"displays_flush", (PyCFunction)pygimp_displays_flush, METH_NOARGS},
{"tile_cache_size", (PyCFunction)pygimp_tile_cache_size, METH_VARARGS},
{"tile_cache_ntiles", (PyCFunction)pygimp_tile_cache_ntiles, METH_VARARGS},
{"tile_width", (PyCFunction)pygimp_tile_width, METH_VARARGS},
{"tile_height", (PyCFunction)pygimp_tile_height, METH_VARARGS},
{"extension_ack", (PyCFunction)pygimp_extension_ack, METH_VARARGS},
{"tile_width", (PyCFunction)pygimp_tile_width, METH_NOARGS},
{"tile_height", (PyCFunction)pygimp_tile_height, METH_NOARGS},
{"extension_ack", (PyCFunction)pygimp_extension_ack, METH_NOARGS},
{"extension_process", (PyCFunction)pygimp_extension_process, METH_VARARGS},
{"parasite_find", (PyCFunction)pygimp_parasite_find, METH_VARARGS},
{"parasite_attach", (PyCFunction)pygimp_parasite_attach, METH_VARARGS},
{"attach_new_parasite",(PyCFunction)pygimp_attach_new_parasite,METH_VARARGS},
{"parasite_detach", (PyCFunction)pygimp_parasite_detach, METH_VARARGS},
{"default_display", (PyCFunction)pygimp_default_display, METH_VARARGS},
{"parasite_list", (PyCFunction)pygimp_parasite_list, METH_NOARGS},
{"default_display", (PyCFunction)pygimp_default_display, METH_NOARGS},
{"_id2image", (PyCFunction)id2image, METH_VARARGS},
{"_id2drawable", (PyCFunction)id2drawable, METH_VARARGS},
{"_id2display", (PyCFunction)id2display, METH_VARARGS},

View File

@ -3,7 +3,7 @@
Copyright (C) 1997-2002 James Henstridge <james@daa.com.au>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@ -30,10 +30,8 @@ ensure_drawable(PyGimpDrawable *self)
}
static PyObject *
drw_flush(PyGimpDrawable *self, PyObject *args)
drw_flush(PyGimpDrawable *self)
{
if (!PyArg_ParseTuple(args, ":flush"))
return NULL;
ensure_drawable(self);
gimp_drawable_flush(self->drawable);
Py_INCREF(Py_None);
@ -113,6 +111,20 @@ drw_get_pixel_rgn(PyGimpDrawable *self, PyObject *args)
return pygimp_pixel_rgn_new(self, x, y, w, h, dirty, shadow);
}
static PyObject *
drw_offset(PyGimpDrawable *self, PyObject *args)
{
gboolean wrap_around;
GimpOffsetType fill_type;
gint offset_x, offset_y;
if (!PyArg_ParseTuple(args, "iiii:offset", &wrap_around, &fill_type,
&offset_x, &offset_y))
return NULL;
return PyInt_FromLong(gimp_drawable_offset(self->ID, wrap_around,
fill_type, offset_x, offset_y));
}
static PyObject *
drw_parasite_find(PyGimpDrawable *self, PyObject *args)
{
@ -158,19 +170,43 @@ drw_parasite_detach(PyGimpDrawable *self, PyObject *args)
return Py_None;
}
static PyObject *
drw_parasite_list(PyGimpImage *self)
{
gint num_parasites;
gchar **parasites;
if (gimp_drawable_parasite_list(self->ID, &num_parasites, &parasites)) {
PyObject *ret;
gint i;
ret = PyTuple_New(num_parasites);
for (i = 0; i < num_parasites; i++) {
PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
g_free(parasites[i]);
}
g_free(parasites);
return ret;
}
PyErr_SetString(pygimp_error, "could not list parasites");
return NULL;
}
/* for inclusion with the methods of layer and channel objects */
static PyMethodDef drw_methods[] = {
{"flush", (PyCFunction)drw_flush, METH_VARARGS},
{"flush", (PyCFunction)drw_flush, METH_NOARGS},
{"update", (PyCFunction)drw_update, METH_VARARGS},
{"merge_shadow", (PyCFunction)drw_merge_shadow, METH_VARARGS},
{"fill", (PyCFunction)drw_fill, METH_VARARGS},
{"get_tile", (PyCFunction)drw_get_tile, METH_VARARGS},
{"get_tile2", (PyCFunction)drw_get_tile2, METH_VARARGS},
{"get_pixel_rgn", (PyCFunction)drw_get_pixel_rgn, METH_VARARGS},
{"offset", (PyCFunction)drw_offset, METH_VARARGS},
{"parasite_find", (PyCFunction)drw_parasite_find, METH_VARARGS},
{"parasite_attach", (PyCFunction)drw_parasite_attach, METH_VARARGS},
{"attach_new_parasite",(PyCFunction)drw_attach_new_parasite,METH_VARARGS},
{"parasite_detach", (PyCFunction)drw_parasite_detach, METH_VARARGS},
{"parasite_list", (PyCFunction)drw_parasite_list, METH_VARARGS},
{NULL, NULL, 0}
};
@ -198,6 +234,12 @@ drw_get_height(PyGimpDrawable *self, void *closure)
return PyInt_FromLong(gimp_drawable_height(self->ID));
}
static PyObject *
drw_get_image(PyGimpDrawable *self, void *closure)
{
return pygimp_image_new(gimp_drawable_image(self->ID));
}
static PyObject *
drw_get_is_rgb(PyGimpDrawable *self, void *closure)
{
@ -246,6 +288,12 @@ drw_get_type(PyGimpDrawable *self, void *closure)
return PyInt_FromLong(gimp_drawable_type(self->ID));
}
static PyObject *
drw_get_type_with_alpha(PyGimpDrawable *self, void *closure)
{
return PyInt_FromLong(gimp_drawable_type_with_alpha(self->ID));
}
static PyObject *
drw_get_width(PyGimpDrawable *self, void *closure)
{
@ -257,6 +305,7 @@ static PyGetSetDef drw_getsets[] = {
{ "bpp", (getter)drw_get_bpp, (setter)0 },
{ "has_alpha", (getter)drw_get_has_alpha, (setter)0 },
{ "height", (getter)drw_get_height, (setter)0 },
{ "image", (getter)drw_get_image, (setter)0 },
{ "is_rgb", (getter)drw_get_is_rgb, (setter)0 },
{ "is_gray", (getter)drw_get_is_gray, (setter)0 },
{ "is_grey", (getter)drw_get_is_gray, (setter)0 },
@ -265,6 +314,7 @@ static PyGetSetDef drw_getsets[] = {
{ "mask_bounds", (getter)drw_get_mask_bounds, (setter)0 },
{ "offsets", (getter)drw_get_offsets, (setter)0 },
{ "type", (getter)drw_get_type, (setter)0 },
{ "type_with_alpha", (getter)drw_get_type_with_alpha, (setter)0 },
{ "width", (getter)drw_get_width, (setter)0 },
{ NULL, (getter)0, (setter)0 }
};
@ -284,7 +334,7 @@ drw_repr(PyGimpLayer *self)
gchar *name;
name = gimp_drawable_name(self->ID);
s = PyString_FromFormat("<gimp.Drawable '%s'>", name);
s = PyString_FromFormat("<gimp.Drawable '%s'>", name?name:"(null)");
g_free(name);
return s;
}
@ -400,10 +450,8 @@ lay_copy(PyGimpLayer *self, PyObject *args)
static PyObject *
lay_add_alpha(PyGimpLayer *self, PyObject *args)
lay_add_alpha(PyGimpLayer *self)
{
if (!PyArg_ParseTuple(args, ":add_alpha"))
return NULL;
gimp_layer_add_alpha(self->ID);
Py_INCREF(Py_None);
return Py_None;
@ -472,48 +520,27 @@ lay_set_offsets(PyGimpLayer *self, PyObject *args)
return Py_None;
}
static PyObject *
lay_get_tattoo(PyGimpLayer *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":get_tattoo"))
return NULL;
return PyInt_FromLong(gimp_layer_get_tattoo(self->ID));
}
static PyMethodDef lay_methods[] = {
{"copy", (PyCFunction)lay_copy, METH_VARARGS},
{"add_alpha", (PyCFunction)lay_add_alpha, METH_VARARGS},
{"add_alpha", (PyCFunction)lay_add_alpha, METH_NOARGS},
{"create_mask", (PyCFunction)lay_create_mask, METH_VARARGS},
{"resize", (PyCFunction)lay_resize, METH_VARARGS},
{"scale", (PyCFunction)lay_scale, METH_VARARGS},
{"translate", (PyCFunction)lay_translate, METH_VARARGS},
{"set_offsets", (PyCFunction)lay_set_offsets, METH_VARARGS},
{"get_tattoo", (PyCFunction)lay_get_tattoo, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
static PyObject *
lay_get_image(PyGimpLayer *self, void *closure)
lay_get_is_floating_sel(PyGimpLayer *self, void *closure)
{
gint32 id = gimp_layer_get_image_id(self->ID);
if (id == -1) {
Py_INCREF(Py_None);
return Py_None;
}
return pygimp_image_new(id);
}
static PyObject *
lay_get_is_floating_selection(PyGimpLayer *self, void *closure)
{
return PyInt_FromLong(gimp_layer_is_floating_selection(self->ID));
return PyInt_FromLong(gimp_layer_is_floating_sel(self->ID));
}
static PyObject *
lay_get_mask(PyGimpLayer *self, void *closure)
{
gint32 id = gimp_layer_get_mask_id(self->ID);
gint32 id = gimp_layer_mask(self->ID);
if (id == -1) {
Py_INCREF(Py_None);
return Py_None;
@ -562,6 +589,27 @@ lay_set_edit_mask(PyGimpLayer *self, PyObject *value, void *closure)
return 0;
}
static PyObject *
lay_get_linked(PyGimpLayer *self, void *closure)
{
return PyInt_FromLong(gimp_layer_get_linked(self->ID));
}
static int
lay_set_linked(PyGimpLayer *self, PyObject *value, void *closure)
{
if (value == NULL) {
PyErr_SetString(PyExc_TypeError, "can not delete linked.");
return -1;
}
if (!PyInt_Check(value)) {
PyErr_SetString(PyExc_TypeError, "type mis-match.");
return -1;
}
gimp_layer_set_linked(self->ID, PyInt_AsLong(value));
return 0;
}
static PyObject *
lay_get_mode(PyGimpLayer *self, void *closure)
{
@ -626,14 +674,13 @@ lay_set_opacity(PyGimpLayer *self, PyObject *value, void *closure)
}
static PyObject *
lay_get_preserve_transparency(PyGimpLayer *self, void *closure)
lay_get_preserve_trans(PyGimpLayer *self, void *closure)
{
return PyInt_FromLong(gimp_layer_get_preserve_transparency(self->ID));
return PyInt_FromLong(gimp_layer_get_preserve_trans(self->ID));
}
static int
lay_set_preserve_transparency(PyGimpLayer *self, PyObject *value,
void *closure)
lay_set_preserve_trans(PyGimpLayer *self, PyObject *value, void *closure)
{
if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
@ -644,7 +691,7 @@ lay_set_preserve_transparency(PyGimpLayer *self, PyObject *value,
PyErr_SetString(PyExc_TypeError, "type mis-match.");
return -1;
}
gimp_layer_set_preserve_transparency(self->ID, PyInt_AsLong(value));
gimp_layer_set_preserve_trans(self->ID, PyInt_AsLong(value));
return 0;
}
@ -669,6 +716,27 @@ lay_set_show_mask(PyGimpLayer *self, PyObject *value, void *closure)
return 0;
}
static PyObject *
lay_get_tattoo(PyGimpLayer *self, void *closure)
{
return PyInt_FromLong(gimp_layer_get_tattoo(self->ID));
}
static int
lay_set_tattoo(PyGimpLayer *self, PyObject *value, void *closure)
{
if (value == NULL) {
PyErr_SetString(PyExc_TypeError, "can not delete tattoo.");
return -1;
}
if (!PyInt_Check(value)) {
PyErr_SetString(PyExc_TypeError, "type mis-match.");
return -1;
}
gimp_layer_set_tattoo(self->ID, PyInt_AsLong(value));
return 0;
}
static PyObject *
lay_get_visible(PyGimpLayer *self, void *closure)
{
@ -691,18 +759,18 @@ lay_set_visible(PyGimpLayer *self, PyObject *value, void *closure)
}
static PyGetSetDef lay_getsets[] = {
{ "image", (getter)lay_get_image, (setter)0 },
{ "is_floating_selection", (getter)lay_get_is_floating_selection,
(setter)0 },
{ "is_floating_sel", (getter)lay_get_is_floating_sel, (setter)0 },
{ "mask", (getter)lay_get_mask, (setter)0 },
{ "apply_mask", (getter)lay_get_apply_mask, (setter)lay_set_apply_mask },
{ "edit_mask", (getter)lay_get_edit_mask, (setter)lay_set_edit_mask },
{ "linked", (getter)lay_get_linked, (setter)lay_set_linked },
{ "mode", (getter)lay_get_mode, (setter)lay_set_mode },
{ "name", (getter)lay_get_name, (setter)lay_set_name },
{ "opacity", (getter)lay_get_opacity, (setter)lay_set_opacity },
{ "preserve_transparency", (getter)lay_get_preserve_transparency,
(setter)lay_set_preserve_transparency },
{ "preserve_trans", (getter)lay_get_preserve_trans,
(setter)lay_set_preserve_trans },
{ "show_mask", (getter)lay_get_show_mask, (setter)lay_set_show_mask },
{ "tattoo", (getter)lay_get_tattoo, (setter)lay_set_tattoo },
{ "visible", (getter)lay_get_visible, (setter)lay_set_visible },
{ NULL, (getter)0, (setter)0 }
};
@ -809,12 +877,10 @@ pygimp_layer_new(gint32 ID)
static PyObject *
chn_copy(PyGimpChannel *self, PyObject *args)
chn_copy(PyGimpChannel *self)
{
gint32 id;
if (!PyArg_ParseTuple(args, ":copy"))
return NULL;
id = gimp_channel_copy(self->ID);
if (id == -1) {
PyErr_SetString(pygimp_error, "can't copy channel");
@ -824,16 +890,22 @@ chn_copy(PyGimpChannel *self, PyObject *args)
}
static PyObject *
chn_get_tattoo(PyGimpChannel *self, PyObject *args)
chn_combine_masks(PyGimpChannel *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":get_tattoo"))
PyGimpChannel *channel2;
GimpChannelOps operation;
gint offx, offy;
if (!PyArg_ParseTuple(args, "O!iii:combine_masks", &PyGimpChannel_Type,
&channel2, &operation, &offx, &offy))
return NULL;
return PyInt_FromLong(gimp_channel_get_tattoo(self->ID));
return PyInt_FromLong(gimp_channel_combine_masks(self->ID, channel2->ID,
operation, offx, offy));
}
static PyMethodDef chn_methods[] = {
{"copy", (PyCFunction)chn_copy, METH_VARARGS},
{"get_tattoo", (PyCFunction)chn_get_tattoo, METH_VARARGS},
{"copy", (PyCFunction)chn_copy, METH_NOARGS},
{"combine_masks", (PyCFunction)chn_combine_masks, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
@ -868,17 +940,6 @@ chn_set_color(PyGimpChannel *self, PyObject *value, void *closure)
return 0;
}
static PyObject *
chn_get_image(PyGimpChannel *self, void *closure)
{
gint32 id = gimp_channel_get_image_id(self->ID);
if (id == -1) {
Py_INCREF(Py_None);
return Py_None;
}
return pygimp_image_new(id);
}
static PyObject *
chn_get_name(PyGimpChannel *self, void *closure)
{
@ -942,6 +1003,27 @@ chn_set_show_masked(PyGimpLayer *self, PyObject *value, void *closure)
return 0;
}
static PyObject *
chn_get_tattoo(PyGimpChannel *self, void *closure)
{
return PyInt_FromLong(gimp_channel_get_tattoo(self->ID));
}
static int
chn_set_tattoo(PyGimpChannel *self, PyObject *value, void *closure)
{
if (value == NULL) {
PyErr_SetString(PyExc_TypeError, "can not delete tattoo.");
return -1;
}
if (!PyInt_Check(value)) {
PyErr_SetString(PyExc_TypeError, "type mis-match.");
return -1;
}
gimp_channel_set_tattoo(self->ID, PyInt_AsLong(value));
return 0;
}
static PyObject *
chn_get_visible(PyGimpLayer *self, void *closure)
{
@ -966,10 +1048,10 @@ chn_set_visible(PyGimpLayer *self, PyObject *value, void *closure)
static PyGetSetDef chn_getsets[] = {
{ "color", (getter)chn_get_color, (setter)chn_set_color },
{ "colour", (getter)chn_get_color, (setter)chn_set_color },
{ "image", (getter)chn_get_image, (setter)0 },
{ "name", (getter)chn_get_name, (setter)chn_set_name },
{ "opacity", (getter)chn_get_opacity, (setter)chn_set_opacity },
{ "show_masked", (getter)chn_get_show_masked, (setter)chn_set_show_masked},
{ "tattoo", (getter)chn_get_tattoo, (setter)chn_set_tattoo },
{ "visible", (getter)chn_get_visible, (setter)chn_set_visible },
{ NULL, (getter)0, (setter)0 }
};

View File

@ -30,9 +30,7 @@ img_add_channel(PyGimpImage *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!i:add_channel", &PyGimpChannel_Type, &chn, &pos))
return NULL;
gimp_image_add_channel(self->ID, chn->ID, pos);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_add_channel(self->ID, chn->ID, pos));
}
@ -42,11 +40,10 @@ img_add_layer(PyGimpImage *self, PyObject *args)
PyGimpLayer *lay;
int pos;
if (!PyArg_ParseTuple(args, "O!i:add_layer", &PyGimpLayer_Type, &lay, &pos))
if (!PyArg_ParseTuple(args, "O!i:add_layer", &PyGimpLayer_Type, &lay,
&pos))
return NULL;
gimp_image_add_layer(self->ID, lay->ID, pos);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_add_layer(self->ID, lay->ID, pos));
}
@ -58,67 +55,37 @@ img_add_layer_mask(PyGimpImage *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!O!:add_layer_mask", &PyGimpLayer_Type, &lay,
&PyGimpChannel_Type, &mask))
return NULL;
gimp_image_add_layer_mask(self->ID, lay->ID, mask->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_add_layer_mask(self->ID, lay->ID,
mask->ID));
}
static PyObject *
img_clean_all(PyGimpImage *self, PyObject *args)
img_clean_all(PyGimpImage *self)
{
if (!PyArg_ParseTuple(args, ":clean_all"))
return NULL;
gimp_image_clean_all(self->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_clean_all(self->ID));
}
static PyObject *
img_disable_undo(PyGimpImage *self, PyObject *args)
img_disable_undo(PyGimpImage *self)
{
/*GimpParam *return_vals;
int nreturn_vals;*/
if (!PyArg_ParseTuple(args, ":disable_undo"))
return NULL;
/*return_vals = gimp_run_procedure("gimp_undo_push_group_start",
&nreturn_vals, GIMP_PDB_IMAGE, self->ID,
GIMP_PDB_END);
gimp_destroy_params(return_vals, nreturn_vals);*/
gimp_image_undo_disable(self->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_undo_disable(self->ID));
}
static PyObject *
img_enable_undo(PyGimpImage *self, PyObject *args)
img_enable_undo(PyGimpImage *self)
{
/*GimpParam *return_vals;
int nreturn_vals;*/
if (!PyArg_ParseTuple(args, ":enable_undo"))
return NULL;
/*return_vals = gimp_run_procedure("gimp_undo_push_group_start",
&nreturn_vals, GIMP_PDB_IMAGE, self->ID,
GIMP_PDB_END);
gimp_destroy_params(return_vals, nreturn_vals);*/
gimp_image_undo_enable(self->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_undo_enable(self->ID));
}
static PyObject *
img_flatten(PyGimpImage *self, PyObject *args)
img_flatten(PyGimpImage *self)
{
if (!PyArg_ParseTuple(args, ":flatten"))
return NULL;
gimp_image_flatten(self->ID);
Py_INCREF(Py_None);
return Py_None;
return pygimp_layer_new(gimp_image_flatten(self->ID));
}
@ -128,29 +95,34 @@ img_lower_channel(PyGimpImage *self, PyObject *args)
PyGimpChannel *chn;
if (!PyArg_ParseTuple(args, "O!:lower_channel", &PyGimpChannel_Type, &chn))
return NULL;
gimp_image_lower_channel(self->ID, chn->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_lower_channel(self->ID, chn->ID));
}
static PyObject *
img_lower_layer(PyGimpImage *self, PyObject *args)
{
PyGimpLayer *lay;
if (!PyArg_ParseTuple(args, "O!:lower_layer", &PyGimpLayer_Type, &lay))
return NULL;
gimp_image_lower_layer(self->ID, lay->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_lower_layer(self->ID, lay->ID));
}
static PyObject *
img_lower_layer_to_bottom(PyGimpImage *self, PyObject *args)
{
PyGimpLayer *lay;
if (!PyArg_ParseTuple(args, "O!:lower_layer_to_bottom",
&PyGimpLayer_Type, &lay))
return NULL;
return PyInt_FromLong(gimp_image_lower_layer_to_bottom(self->ID, lay->ID));
}
static PyObject *
img_merge_visible_layers(PyGimpImage *self, PyObject *args)
{
gint32 id;
int merge;
if (!PyArg_ParseTuple(args, "i:merge_visible_layers", &merge))
return NULL;
id = gimp_image_merge_visible_layers(self->ID, merge);
@ -161,6 +133,23 @@ img_merge_visible_layers(PyGimpImage *self, PyObject *args)
return pygimp_layer_new(id);
}
static PyObject *
img_merge_down(PyGimpImage *self, PyObject *args)
{
gint32 id;
PyGimpLayer *layer;
int merge;
if (!PyArg_ParseTuple(args, "O!i:merge_visible_layers",
&PyGimpLayer_Type, &layer, &merge))
return NULL;
id = gimp_image_merge_down(self->ID, layer->ID, merge);
if (id == -1) {
PyErr_SetString(pygimp_error, "Can't merge layers.");
return NULL;
}
return pygimp_layer_new(id);
}
static PyObject *
img_pick_correlate_layer(PyGimpImage *self, PyObject *args)
@ -186,23 +175,27 @@ img_raise_channel(PyGimpImage *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!:raise_channel", &PyGimpChannel_Type, &chn))
return NULL;
gimp_image_raise_channel(self->ID, chn->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_raise_channel(self->ID, chn->ID));
}
static PyObject *
img_raise_layer(PyGimpImage *self, PyObject *args)
{
PyGimpLayer *lay;
if (!PyArg_ParseTuple(args, "O!:raise_layer", &PyGimpLayer_Type, &lay))
return NULL;
gimp_image_raise_layer(self->ID, lay->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_raise_layer(self->ID, lay->ID));
}
static PyObject *
img_raise_layer_to_top(PyGimpImage *self, PyObject *args)
{
PyGimpLayer *lay;
if (!PyArg_ParseTuple(args, "O!:raise_layer_to_top",
&PyGimpLayer_Type, &lay))
return NULL;
return PyInt_FromLong(gimp_image_raise_layer_to_top(self->ID, lay->ID));
}
static PyObject *
img_remove_channel(PyGimpImage *self, PyObject *args)
@ -210,9 +203,7 @@ img_remove_channel(PyGimpImage *self, PyObject *args)
PyGimpChannel *chn;
if (!PyArg_ParseTuple(args, "O!:remove_channel", &PyGimpChannel_Type, &chn))
return NULL;
gimp_image_remove_channel(self->ID, chn->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_remove_channel(self->ID, chn->ID));
}
@ -222,9 +213,7 @@ img_remove_layer(PyGimpImage *self, PyObject *args)
PyGimpLayer *lay;
if (!PyArg_ParseTuple(args, "O!:remove_layer", &PyGimpLayer_Type, &lay))
return NULL;
gimp_image_remove_layer(self->ID, lay->ID);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_remove_layer(self->ID, lay->ID));
}
@ -236,25 +225,57 @@ img_remove_layer_mask(PyGimpImage *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!i:remove_layer_mask", &PyGimpLayer_Type, &lay,
&mode))
return NULL;
gimp_image_remove_layer_mask(self->ID, lay->ID, mode);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_remove_layer_mask(self->ID, lay->ID,
mode));
}
static PyObject *
img_resize(PyGimpImage *self, PyObject *args)
{
unsigned int new_w, new_h;
int new_w, new_h;
int offs_x, offs_y;
if (!PyArg_ParseTuple(args, "iiii:resize", &new_w, &new_h,
&offs_x, &offs_y))
return NULL;
gimp_image_resize(self->ID, new_w, new_h, offs_x, offs_y);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_resize(self->ID, new_w, new_h,
offs_x, offs_y));
}
static PyObject *
img_scale(PyGimpImage *self, PyObject *args)
{
gint new_width, new_height;
if (!PyArg_ParseTuple(args, "ii:scale", &new_width, &new_height))
return NULL;
return PyInt_FromLong(gimp_image_scale(self->ID, new_width, new_height));
}
static PyObject *
img_crop(PyGimpImage *self, PyObject *args)
{
int new_w, new_h;
int offs_x, offs_y;
if (!PyArg_ParseTuple(args, "iiii:crop", &new_w, &new_h,
&offs_x, &offs_y))
return NULL;
return PyInt_FromLong(gimp_image_crop(self->ID, new_w, new_h,
offs_x, offs_y));
}
static PyObject *
img_free_shadow(PyGimpImage *self)
{
return PyInt_FromLong(gimp_image_free_shadow(self->ID));
}
static PyObject *
img_unset_active_channel(PyGimpImage *self)
{
return PyInt_FromLong(gimp_image_unset_active_channel(self->ID));
}
static PyObject *
img_get_component_active(PyGimpImage *self, PyObject *args)
@ -262,8 +283,7 @@ img_get_component_active(PyGimpImage *self, PyObject *args)
int comp;
if (!PyArg_ParseTuple(args, "i:get_component_active", &comp))
return NULL;
return PyInt_FromLong((long)
gimp_image_get_component_active(self->ID, comp));
return PyInt_FromLong(gimp_image_get_component_active(self->ID, comp));
}
@ -275,8 +295,7 @@ img_get_component_visible(PyGimpImage *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:get_component_visible", &comp))
return NULL;
return PyInt_FromLong((long)
gimp_image_get_component_visible(self->ID, comp));
return PyInt_FromLong(gimp_image_get_component_visible(self->ID, comp));
}
@ -286,9 +305,7 @@ img_set_component_active(PyGimpImage *self, PyObject *args)
int comp, a;
if (!PyArg_ParseTuple(args, "ii:set_component_active", &comp, &a))
return NULL;
gimp_image_set_component_active(self->ID, comp, a);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_set_component_active(self->ID, comp, a));
}
@ -298,9 +315,7 @@ img_set_component_visible(PyGimpImage *self, PyObject *args)
int comp, v;
if (!PyArg_ParseTuple(args, "ii:set_component_visible", &comp, &v))
return NULL;
gimp_image_set_component_visible(self->ID, comp, v);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_set_component_visible(self->ID, comp, v));
}
static PyObject *
@ -319,9 +334,7 @@ img_parasite_attach(PyGimpImage *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!:parasite_attach", &PyGimpParasite_Type,
&parasite))
return NULL;
gimp_image_parasite_attach(self->ID, parasite->para);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_parasite_attach(self->ID,parasite->para));
}
static PyObject *
@ -343,16 +356,31 @@ img_parasite_detach(PyGimpImage *self, PyObject *args)
char *name;
if (!PyArg_ParseTuple(args, "s:parasite_detach", &name))
return NULL;
gimp_image_parasite_detach(self->ID, name);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_parasite_detach(self->ID, name));
}
static PyObject *
img_parasite_list(PyGimpImage *self)
{
gint num_parasites;
gchar **parasites;
if (gimp_image_parasite_list(self->ID, &num_parasites, &parasites)) {
PyObject *ret;
gint i;
ret = PyTuple_New(num_parasites);
for (i = 0; i < num_parasites; i++) {
PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
g_free(parasites[i]);
}
g_free(parasites);
return ret;
}
PyErr_SetString(pygimp_error, "could not list parasites");
return NULL;
}
/* gimp_image_set_resolution
* gimp_image_get_resolution
* gimp_set_unit
* gimp_get_unit
*/
static PyObject *
img_get_layer_by_tattoo(PyGimpImage *self, PyObject *args)
{
@ -378,9 +406,7 @@ img_add_hguide(PyGimpImage *self, PyObject *args)
int ypos;
if (!PyArg_ParseTuple(args, "i:add_hguide", &ypos))
return NULL;
gimp_image_add_hguide(self->ID, ypos);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_add_hguide(self->ID, ypos));
}
static PyObject *
@ -389,9 +415,7 @@ img_add_vguide(PyGimpImage *self, PyObject *args)
int xpos;
if (!PyArg_ParseTuple(args, "i:add_vguide", &xpos))
return NULL;
gimp_image_add_vguide(self->ID, xpos);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_add_vguide(self->ID, xpos));
}
static PyObject *
@ -400,9 +424,7 @@ img_delete_guide(PyGimpImage *self, PyObject *args)
int guide;
if (!PyArg_ParseTuple(args, "i:delete_guide", &guide))
return NULL;
gimp_image_delete_guide(self->ID, guide);
Py_INCREF(Py_None);
return Py_None;
return PyInt_FromLong(gimp_image_delete_guide(self->ID, guide));
}
static PyObject *
@ -432,20 +454,47 @@ img_get_guide_position(PyGimpImage *self, PyObject *args)
return PyInt_FromLong(gimp_image_get_guide_position(self->ID, guide));
}
static PyObject *
img_undo_is_enabled(PyGimpImage *self)
{
return PyInt_FromLong(gimp_image_undo_is_enabled(self->ID));
}
static PyObject *
img_undo_freeze(PyGimpImage *self)
{
return PyInt_FromLong(gimp_image_undo_freeze(self->ID));
}
static PyObject *
img_undo_thaw(PyGimpImage *self)
{
return PyInt_FromLong(gimp_image_undo_thaw(self->ID));
}
static PyObject *
img_duplicate(PyGimpImage *self)
{
return pygimp_image_new(gimp_image_duplicate(self->ID));
}
static PyMethodDef img_methods[] = {
{"add_channel", (PyCFunction)img_add_channel, METH_VARARGS},
{"add_layer", (PyCFunction)img_add_layer, METH_VARARGS},
{"add_layer_mask", (PyCFunction)img_add_layer_mask, METH_VARARGS},
{"clean_all", (PyCFunction)img_clean_all, METH_VARARGS},
{"disable_undo", (PyCFunction)img_disable_undo, METH_VARARGS},
{"enable_undo", (PyCFunction)img_enable_undo, METH_VARARGS},
{"flatten", (PyCFunction)img_flatten, METH_VARARGS},
{"clean_all", (PyCFunction)img_clean_all, METH_NOARGS},
{"disable_undo", (PyCFunction)img_disable_undo, METH_NOARGS},
{"enable_undo", (PyCFunction)img_enable_undo, METH_NOARGS},
{"flatten", (PyCFunction)img_flatten, METH_NOARGS},
{"lower_channel", (PyCFunction)img_lower_channel, METH_VARARGS},
{"lower_layer", (PyCFunction)img_lower_layer, METH_VARARGS},
{"lower_layer_to_bottom", (PyCFunction)img_lower_layer_to_bottom, METH_VARARGS},
{"merge_visible_layers", (PyCFunction)img_merge_visible_layers, METH_VARARGS},
{"merge_down", (PyCFunction)img_merge_down, METH_VARARGS},
{"pick_correlate_layer", (PyCFunction)img_pick_correlate_layer, METH_VARARGS},
{"raise_channel", (PyCFunction)img_raise_channel, METH_VARARGS},
{"raise_layer", (PyCFunction)img_raise_layer, METH_VARARGS},
{"raise_layer_to_top", (PyCFunction)img_raise_layer_to_top, METH_VARARGS},
{"remove_channel", (PyCFunction)img_remove_channel, METH_VARARGS},
{"remove_layer", (PyCFunction)img_remove_layer, METH_VARARGS},
{"remove_layer_mask", (PyCFunction)img_remove_layer_mask, METH_VARARGS},
@ -458,6 +507,7 @@ static PyMethodDef img_methods[] = {
{"parasite_attach", (PyCFunction)img_parasite_attach, METH_VARARGS},
{"attach_new_parasite", (PyCFunction)img_attach_new_parasite,METH_VARARGS},
{"parasite_detach", (PyCFunction)img_parasite_detach, METH_VARARGS},
{"parasite_list", (PyCFunction)img_parasite_list, METH_NOARGS},
{"get_layer_by_tattoo",(PyCFunction)img_get_layer_by_tattoo,METH_VARARGS},
{"get_channel_by_tattoo",(PyCFunction)img_get_channel_by_tattoo,METH_VARARGS},
{"add_hguide", (PyCFunction)img_add_hguide, METH_VARARGS},
@ -466,6 +516,14 @@ static PyMethodDef img_methods[] = {
{"find_next_guide", (PyCFunction)img_find_next_guide, METH_VARARGS},
{"get_guide_orientation",(PyCFunction)img_get_guide_orientation,METH_VARARGS},
{"get_guide_position", (PyCFunction)img_get_guide_position, METH_VARARGS},
{"scale", (PyCFunction)img_scale, METH_VARARGS},
{"crop", (PyCFunction)img_crop, METH_VARARGS},
{"free_shadow", (PyCFunction)img_free_shadow, METH_NOARGS},
{"unset_active_channel", (PyCFunction)img_unset_active_channel, METH_NOARGS},
{"undo_is_enabled", (PyCFunction)img_undo_is_enabled, METH_NOARGS},
{"undo_freeze", (PyCFunction)img_undo_freeze, METH_NOARGS},
{"undo_thaw", (PyCFunction)img_undo_thaw, METH_NOARGS},
{"duplicate", (PyCFunction)img_duplicate, METH_NOARGS},
{NULL, NULL} /* sentinel */
};
@ -502,6 +560,18 @@ img_set_active_channel(PyGimpImage *self, PyObject *value, void *closure)
return 0;
}
static PyObject *
img_get_active_drawable(PyGimpImage *self, void *closure)
{
gint32 id = gimp_image_active_drawable(self->ID);
if (id == -1) {
Py_INCREF(Py_None);
return Py_None;
}
return pygimp_drawable_new(NULL, id);
}
static PyObject *
img_get_active_layer(PyGimpImage *self, void *closure)
{
@ -622,6 +692,19 @@ img_get_floating_selection(PyGimpImage *self, void *closure)
return pygimp_layer_new(id);
}
static PyObject *
img_get_floating_sel_attached_to(PyGimpImage *self, void *closure)
{
gint32 id;
id = gimp_image_floating_sel_attached_to(self->ID);
if (id == -1) {
Py_INCREF(Py_None);
return Py_None;
}
return pygimp_layer_new(id);
}
static PyObject *
img_get_layers(PyGimpImage *self, void *closure)
{
@ -637,12 +720,48 @@ img_get_layers(PyGimpImage *self, void *closure)
return ret;
}
static PyObject *
img_get_name(PyGimpImage *self, void *closure)
{
gchar *name;
name = gimp_image_get_name(self->ID);
if (name) {
PyObject *ret = PyString_FromString(name);
g_free(name);
return ret;
}
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
img_get_selection(PyGimpImage *self, void *closure)
{
return pygimp_channel_new(gimp_image_get_selection(self->ID));
}
static PyObject *
img_get_tattoo_state(PyGimpImage *self, void *closure)
{
return PyInt_FromLong(gimp_image_get_tattoo_state(self->ID));
}
static int
img_set_tattoo_state(PyGimpImage *self, PyObject *value, void *closure)
{
if (value == NULL) {
PyErr_SetString(PyExc_TypeError, "can not delete tattoo_state.");
return -1;
}
if (!PyInt_Check(value)) {
PyErr_SetString(PyExc_TypeError, "type mis-match.");
return -1;
}
gimp_image_set_tattoo_state(self->ID, PyInt_AsLong(value));
return 0;
}
static PyObject *
img_get_height(PyGimpImage *self, void *closure)
{
@ -708,6 +827,7 @@ static PyGetSetDef img_getsets[] = {
{ "ID", (getter)img_get_ID, (setter)0 },
{ "active_channel", (getter)img_get_active_channel,
(setter)img_set_active_channel },
{ "active_drawable", (getter)img_get_active_drawable, (setter)0 },
{ "active_layer", (getter)img_get_active_layer,
(setter)img_set_active_layer },
{ "base_type", (getter)img_get_base_type, (setter)0 },
@ -715,10 +835,15 @@ static PyGetSetDef img_getsets[] = {
{ "cmap", (getter)img_get_cmap, (setter)img_set_cmap },
{ "filename", (getter)img_get_filename, (setter)img_set_filename },
{ "floating_selection", (getter)img_get_floating_selection, (setter)0 },
{ "floating_sel_attached_to", (getter)img_get_floating_sel_attached_to,
(setter)0 },
{ "height", (getter)img_get_height, (setter)0 },
{ "layers", (getter)img_get_layers, (setter)0 },
{ "name", (getter)img_get_name, (setter)0 },
{ "resolution", (getter)img_get_resolution, (setter)img_set_resolution },
{ "selection", (getter)img_get_selection, (setter)0 },
{ "tattoo_state", (getter)img_get_tattoo_state,
(setter)img_set_tattoo_state },
{ "unit", (getter)img_get_unit, (setter)img_set_unit },
{ "width", (getter)img_get_width, (setter)0 },
{ NULL, (getter)0, (setter)0 }