gimp r27042 - in trunk: . plug-ins/pygimp
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27042 - in trunk: . plug-ins/pygimp
- Date: Wed, 24 Sep 2008 09:48:44 +0000 (UTC)
Author: neo
Date: Wed Sep 24 09:48:44 2008
New Revision: 27042
URL: http://svn.gnome.org/viewvc/gimp?rev=27042&view=rev
Log:
2008-09-24 Sven Neumann <sven gimp org>
* plug-ins/pygimp/pygimp-drawable.c
* plug-ins/pygimp/pygimp-image.c: added optional interpolation
parameters to the image.scale() and layer.scale() methods.
Modified:
trunk/ChangeLog
trunk/plug-ins/pygimp/pygimp-drawable.c
trunk/plug-ins/pygimp/pygimp-image.c
Modified: trunk/plug-ins/pygimp/pygimp-drawable.c
==============================================================================
--- trunk/plug-ins/pygimp/pygimp-drawable.c (original)
+++ trunk/plug-ins/pygimp/pygimp-drawable.c Wed Sep 24 09:48:44 2008
@@ -1388,20 +1388,33 @@
static PyObject *
lay_scale(PyGimpLayer *self, PyObject *args, PyObject *kwargs)
{
- unsigned int new_w, new_h;
+ int new_width, new_height;
+ int interpolation = -1;
gboolean local_origin = FALSE;
static char *kwlist[] = { "width", "height", "local_origin", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|i:scale", kwlist,
- &new_w, &new_h, &local_origin))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|ii:scale", kwlist,
+ &new_width, &new_height,
+ &local_origin, &interpolation))
return NULL;
- if (!gimp_layer_scale(self->ID, new_w, new_h, local_origin)) {
- PyErr_Format(pygimp_error,
- "could not scale layer (ID %d) to size %dx%d",
- self->ID, new_w, new_h);
- return NULL;
+ if (interpolation != -1) {
+ if (!gimp_layer_scale_full(self->ID,
+ new_width, new_height,
+ local_origin, interpolation)) {
+ PyErr_Format(pygimp_error,
+ "could not scale layer (ID %d) to size %dx%d",
+ self->ID, new_width, new_height);
+ return NULL;
+ }
+ } else {
+ if (!gimp_layer_scale(self->ID, new_width, new_height, local_origin)) {
+ PyErr_Format(pygimp_error,
+ "could not scale layer (ID %d) to size %dx%d",
+ self->ID, new_width, new_height);
+ return NULL;
+ }
}
Py_INCREF(Py_None);
Modified: trunk/plug-ins/pygimp/pygimp-image.c
==============================================================================
--- trunk/plug-ins/pygimp/pygimp-image.c (original)
+++ trunk/plug-ins/pygimp/pygimp-image.c Wed Sep 24 09:48:44 2008
@@ -445,17 +445,27 @@
img_scale(PyGimpImage *self, PyObject *args, PyObject *kwargs)
{
int new_width, new_height;
+ int interpolation = -1;
- static char *kwlist[] = { "width", "height", NULL };
+ static char *kwlist[] = { "width", "height", "interpolation", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:scale", kwlist,
- &new_width, &new_height))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|i:scale", kwlist,
+ &new_width, &new_height, &interpolation))
return NULL;
- if (!gimp_image_scale(self->ID, new_width, new_height)) {
- PyErr_Format(pygimp_error, "could not scale image (ID %d) to %dx%d",
- self->ID, new_width, new_height);
- return NULL;
+ if (interpolation != -1) {
+ if (!gimp_image_scale_full(self->ID,
+ new_width, new_height, interpolation)) {
+ PyErr_Format(pygimp_error, "could not scale image (ID %d) to %dx%d",
+ self->ID, new_width, new_height);
+ return NULL;
+ }
+ } else {
+ if (!gimp_image_scale(self->ID, new_width, new_height)) {
+ PyErr_Format(pygimp_error, "could not scale image (ID %d) to %dx%d",
+ self->ID, new_width, new_height);
+ return NULL;
+ }
}
Py_INCREF(Py_None);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]