pygimp: undeprecate quite some stuff

This commit is contained in:
Michael Natterer 2010-11-24 22:02:22 +01:00
parent 7b320c7bf6
commit 09ebacdb82
2 changed files with 154 additions and 64 deletions

View File

@ -1116,7 +1116,7 @@ pygimp_delete(PyObject *self, PyObject *args)
if (pygimp_image_check(img)) if (pygimp_image_check(img))
gimp_image_delete(img->ID); gimp_image_delete(img->ID);
else if (pygimp_drawable_check(img)) else if (pygimp_drawable_check(img))
gimp_drawable_delete(img->ID); gimp_item_delete(img->ID);
else if (pygimp_display_check(img)) else if (pygimp_display_check(img))
gimp_display_delete(img->ID); gimp_display_delete(img->ID);
@ -1264,6 +1264,7 @@ pygimp_parasite_attach(PyObject *self, PyObject *args)
static PyObject * static PyObject *
pygimp_attach_new_parasite(PyObject *self, PyObject *args) pygimp_attach_new_parasite(PyObject *self, PyObject *args)
{ {
GimpParasite *parasite;
char *name, *data; char *name, *data;
int flags, size; int flags, size;
@ -1271,11 +1272,16 @@ pygimp_attach_new_parasite(PyObject *self, PyObject *args)
&data, &size)) &data, &size))
return NULL; return NULL;
if (!gimp_attach_new_parasite(name, flags, size, data)) { parasite = gimp_parasite_new (name, flags, size, data);
if (!gimp_parasite_attach (parasite)) {
PyErr_Format(pygimp_error, "could not attach new parasite '%s'", name); PyErr_Format(pygimp_error, "could not attach new parasite '%s'", name);
gimp_parasite_free (parasite);
return NULL; return NULL;
} }
gimp_parasite_free (parasite);
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
} }

View File

@ -483,10 +483,15 @@ drw_transform_flip(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&recursion_level, &clip_result)) &recursion_level, &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_flip(self->ID, x0, y0, x1, y1, gimp_context_push ();
transform_direction, interpolation, gimp_context_set_transform_direction (transform_direction);
supersample, recursion_level, gimp_context_set_interpolation (interpolation);
clip_result); gimp_context_set_transform_recursion (recursion_level);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_flip (self->ID, x0, y0, x1, y1);
gimp_context_pop ();
return transform_result(self, id, "flip"); return transform_result(self, id, "flip");
} }
@ -508,8 +513,13 @@ drw_transform_flip_simple(PyGimpDrawable *self, PyObject *args, PyObject *kwargs
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_flip_simple(self->ID, flip_type, auto_center, gimp_context_push ();
axis, clip_result); gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_flip_simple (self->ID, flip_type,
auto_center, axis);
gimp_context_pop ();
return transform_result(self, id, "flip"); return transform_result(self, id, "flip");
} }
@ -530,8 +540,14 @@ drw_transform_flip_default(PyGimpDrawable *self, PyObject *args, PyObject *kwarg
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_flip_default(self->ID, x0, y0, x1, y1, gimp_context_push ();
interpolate, clip_result); if (! interpolate)
gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_flip (self->ID, x0, y0, x1, y1);
gimp_context_pop ();
return transform_result(self, id, "flip"); return transform_result(self, id, "flip");
} }
@ -558,11 +574,16 @@ drw_transform_perspective(PyGimpDrawable *self, PyObject *args, PyObject *kwargs
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_perspective(self->ID, gimp_context_push ();
x0, y0, x1, y1, x2, y2, x3, y3, gimp_context_set_transform_direction (transform_direction);
transform_direction, interpolation, gimp_context_set_interpolation (interpolation);
supersample, recursion_level, gimp_context_set_transform_recursion (recursion_level);
clip_result); gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_perspective (self->ID,
x0, y0, x1, y1, x2, y2, x3, y3);
gimp_context_pop ();
return transform_result(self, id, "apply perspective transform to"); return transform_result(self, id, "apply perspective transform to");
} }
@ -584,10 +605,15 @@ drw_transform_perspective_default(PyGimpDrawable *self, PyObject *args, PyObject
&interpolate, &clip_result)) &interpolate, &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_perspective_default(self->ID, gimp_context_push ();
x0, y0, x1, y1, if (! interpolate)
x2, y2, x3, y3, gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
interpolate, clip_result); gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_perspective (self->ID,
x0, y0, x1, y1, x2, y2, x3, y3);
gimp_context_pop ();
return transform_result(self, id, "apply perspective transform to"); return transform_result(self, id, "apply perspective transform to");
} }
@ -614,11 +640,16 @@ drw_transform_rotate(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_rotate(self->ID, angle, auto_center, gimp_context_push ();
center_x, center_y, gimp_context_set_transform_direction (transform_direction);
transform_direction, interpolation, gimp_context_set_interpolation (interpolation);
supersample, recursion_level, gimp_context_set_transform_recursion (recursion_level);
clip_result); gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_rotate (self->ID, angle, auto_center,
center_x, center_y);
gimp_context_pop ();
return transform_result(self, id, "rotate"); return transform_result(self, id, "rotate");
} }
@ -641,10 +672,14 @@ drw_transform_rotate_simple(PyGimpDrawable *self, PyObject *args, PyObject *kwar
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_rotate_simple(self->ID, rotate_type, gimp_context_push ();
auto_center, gimp_context_set_transform_resize (clip_result);
center_x, center_y,
clip_result); id = gimp_item_transform_rotate_simple (self->ID, rotate_type,
auto_center,
center_x, center_y);
gimp_context_pop ();
return transform_result(self, id, "rotate"); return transform_result(self, id, "rotate");
} }
@ -666,9 +701,15 @@ drw_transform_rotate_default(PyGimpDrawable *self, PyObject *args, PyObject *kwa
&interpolate, &clip_result)) &interpolate, &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_rotate_default(self->ID, angle, auto_center, gimp_context_push ();
center_x, center_y, if (! interpolate)
interpolate, clip_result); gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_rotate (self->ID, angle, auto_center,
center_x, center_y);
gimp_context_pop ();
return transform_result(self, id, "rotate"); return transform_result(self, id, "rotate");
} }
@ -693,10 +734,15 @@ drw_transform_scale(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&recursion_level, &clip_result)) &recursion_level, &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_scale(self->ID, x0, y0, x1, y1, gimp_context_push ();
transform_direction, interpolation, gimp_context_set_transform_direction (transform_direction);
supersample, recursion_level, gimp_context_set_interpolation (interpolation);
clip_result); gimp_context_set_transform_recursion (recursion_level);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_scale (self->ID, x0, y0, x1, y1);
gimp_context_pop ();
return transform_result(self, id, "scale"); return transform_result(self, id, "scale");
} }
@ -717,8 +763,14 @@ drw_transform_scale_default(PyGimpDrawable *self, PyObject *args, PyObject *kwar
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_scale_default(self->ID, x0, y0, x1, y1, gimp_context_push ();
interpolate, clip_result); if (! interpolate)
gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_scale (self->ID, x0, y0, x1, y1);
gimp_context_pop ();
return transform_result(self, id, "scale"); return transform_result(self, id, "scale");
} }
@ -744,10 +796,15 @@ drw_transform_shear(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_shear(self->ID, shear_type, magnitude, gimp_context_push ();
transform_direction, interpolation, gimp_context_set_transform_direction (transform_direction);
supersample, recursion_level, gimp_context_set_interpolation (interpolation);
clip_result); gimp_context_set_transform_recursion (recursion_level);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_shear (self->ID, shear_type, magnitude);
gimp_context_pop ();
return transform_result(self, id, "shear"); return transform_result(self, id, "shear");
} }
@ -769,9 +826,14 @@ drw_transform_shear_default(PyGimpDrawable *self, PyObject *args, PyObject *kwar
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_shear_default(self->ID, shear_type, gimp_context_push ();
magnitude, interpolate, if (! interpolate)
clip_result); gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_shear (self->ID, shear_type, magnitude);
gimp_context_pop ();
return transform_result(self, id, "shear"); return transform_result(self, id, "shear");
} }
@ -799,10 +861,16 @@ drw_transform_2d(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_2d(self->ID, source_x, source_y, gimp_context_push ();
scale_x, scale_y, angle, dest_x, dest_y, gimp_context_set_transform_direction (transform_direction);
transform_direction, interpolation, gimp_context_set_interpolation (interpolation);
supersample, recursion_level, clip_result); gimp_context_set_transform_recursion (recursion_level);
gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_2d (self->ID, source_x, source_y,
scale_x, scale_y, angle, dest_x, dest_y);
gimp_context_pop ();
return transform_result(self, id, "apply 2d transform to"); return transform_result(self, id, "apply 2d transform to");
} }
@ -825,10 +893,15 @@ drw_transform_2d_default(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_2d_default(self->ID, source_x, source_y, gimp_context_push ();
scale_x, scale_y, angle, if (! interpolate)
dest_x, dest_y, interpolate, gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
clip_result); gimp_context_set_transform_resize (clip_result);
id = gimp_item_transform_2d (self->ID, source_x, source_y,
scale_x, scale_y, angle, dest_x, dest_y);
gimp_context_pop ();
return transform_result(self, id, "apply 2d transform to"); return transform_result(self, id, "apply 2d transform to");
} }
@ -860,13 +933,18 @@ drw_transform_matrix(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
&clip_result)) &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_matrix(self->ID, gimp_context_push ();
coeff_0_0, coeff_0_1, coeff_0_2, gimp_context_set_transform_direction (transform_direction);
coeff_1_0, coeff_1_1, coeff_1_2, gimp_context_set_interpolation (interpolation);
coeff_2_0, coeff_2_1, coeff_2_2, gimp_context_set_transform_recursion (recursion_level);
transform_direction, interpolation, gimp_context_set_transform_resize (clip_result);
supersample, recursion_level,
clip_result); id = gimp_item_transform_matrix (self->ID,
coeff_0_0, coeff_0_1, coeff_0_2,
coeff_1_0, coeff_1_1, coeff_1_2,
coeff_2_0, coeff_2_1, coeff_2_2);
gimp_context_pop ();
return transform_result(self, id, "apply 2d matrix transform to"); return transform_result(self, id, "apply 2d matrix transform to");
} }
@ -894,11 +972,17 @@ drw_transform_matrix_default(PyGimpDrawable *self, PyObject *args, PyObject *kwa
&interpolate, &clip_result)) &interpolate, &clip_result))
return NULL; return NULL;
id = gimp_drawable_transform_matrix_default(self->ID, gimp_context_push ();
coeff_0_0, coeff_0_1, coeff_0_2, if (! interpolate)
coeff_1_0, coeff_1_1, coeff_1_2, gimp_context_set_interpolation (GIMP_INTERPOLATION_NONE);
coeff_2_0, coeff_2_1, coeff_2_2, gimp_context_set_transform_resize (clip_result);
interpolate, clip_result);
id = gimp_item_transform_matrix (self->ID,
coeff_0_0, coeff_0_1, coeff_0_2,
coeff_1_0, coeff_1_1, coeff_1_2,
coeff_2_0, coeff_2_1, coeff_2_2);
gimp_context_pop ();
return transform_result(self, id, "apply 2d matrix transform to"); return transform_result(self, id, "apply 2d matrix transform to");
} }