gimp r27039 - in trunk: . app/pdb libgimp tools/pdbgen/pdb
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27039 - in trunk: . app/pdb libgimp tools/pdbgen/pdb
- Date: Wed, 24 Sep 2008 08:28:16 +0000 (UTC)
Author: neo
Date: Wed Sep 24 08:28:16 2008
New Revision: 27039
URL: http://svn.gnome.org/viewvc/gimp?rev=27039&view=rev
Log:
2008-09-24 Sven Neumann <sven gimp org>
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/image.pdb: added new scale procedures that
allow to specify the interpolation explicitly. Fixes bug
#486977.
Also pass the progress parameter to the scale and rotate
functions.
* app/pdb/image-cmds.c
* app/pdb/internal-procs.c
* app/pdb/layer-cmds.c
* libgimp/gimpimage_pdb.[ch]
* libgimp/gimplayer_pdb.[ch]: regenerated.
* libgimp/gimp.def: updated.
Modified:
trunk/ChangeLog
trunk/app/pdb/image-cmds.c
trunk/app/pdb/internal-procs.c
trunk/app/pdb/layer-cmds.c
trunk/libgimp/gimp.def
trunk/libgimp/gimpimage_pdb.c
trunk/libgimp/gimpimage_pdb.h
trunk/libgimp/gimplayer_pdb.c
trunk/libgimp/gimplayer_pdb.h
trunk/tools/pdbgen/pdb/image.pdb
trunk/tools/pdbgen/pdb/layer.pdb
Modified: trunk/app/pdb/image-cmds.c
==============================================================================
--- trunk/app/pdb/image-cmds.c (original)
+++ trunk/app/pdb/image-cmds.c Wed Sep 24 08:28:16 2008
@@ -48,6 +48,7 @@
#include "core/gimplist.h"
#include "core/gimpparamspecs.h"
#include "core/gimppickable.h"
+#include "core/gimpprogress.h"
#include "core/gimpselection.h"
#include "core/gimpunit.h"
#include "vectors/gimpvectors.h"
@@ -400,9 +401,49 @@
if (success)
{
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
gimp_image_scale (image, new_width, new_height,
gimp->config->interpolation_type,
- NULL);
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GValueArray *
+image_scale_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 new_width;
+ gint32 new_height;
+ gint32 interpolation;
+
+ image = gimp_value_get_image (&args->values[0], gimp);
+ new_width = g_value_get_int (&args->values[1]);
+ new_height = g_value_get_int (&args->values[2]);
+ interpolation = g_value_get_enum (&args->values[3]);
+
+ if (success)
+ {
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
+ gimp_image_scale (image, new_width, new_height, interpolation, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -488,7 +529,13 @@
if (success)
{
- gimp_image_rotate (image, context, rotate_type, NULL);
+ if (progress)
+ gimp_progress_start (progress, _("Rotating"), FALSE);
+
+ gimp_image_rotate (image, context, rotate_type, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
}
return gimp_procedure_get_return_values (procedure, success,
@@ -2776,8 +2823,8 @@
"gimp-image-scale");
gimp_procedure_set_static_strings (procedure,
"gimp-image-scale",
- "Scale the image to the specified extents.",
- "This procedure scales the image so that its new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous image's content. All channels within the image are scaled according to the specified parameters; this includes the image selection mask. All layers within the image are repositioned according to the specified offsets.",
+ "Scale the image using the default interpolation method.",
+ "This procedure scales the image so that its new width and height are equal to the supplied parameters. All layers and channels within the image are scaled according to the specified parameters; this includes the image selection mask. The default interpolation method is used.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@@ -2804,6 +2851,48 @@
g_object_unref (procedure);
/*
+ * gimp-image-scale-full
+ */
+ procedure = gimp_procedure_new (image_scale_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-scale-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-scale-full",
+ "Scale the image using a specific interpolation method.",
+ "This procedure scales the image so that its new width and height are equal to the supplied parameters. All layers and channels within the image are scaled according to the specified parameters; this includes the image selection mask. This procedure allows you to specify the interpolation method explicitly.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New image width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New image height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-image-crop
*/
procedure = gimp_procedure_new (image_crop_invoker);
@@ -2838,13 +2927,13 @@
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("offx",
"offx",
- "x offset: (0 <= offx <= (width - new_width))",
+ "X offset: (0 <= offx <= (width - new_width))",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("offy",
"offy",
- "y offset: (0 <= offy <= (height - new_height))",
+ "Y offset: (0 <= offy <= (height - new_height))",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
Modified: trunk/app/pdb/internal-procs.c
==============================================================================
--- trunk/app/pdb/internal-procs.c (original)
+++ trunk/app/pdb/internal-procs.c Wed Sep 24 08:28:16 2008
@@ -29,7 +29,7 @@
#include "internal-procs.h"
-/* 591 procedures registered total */
+/* 593 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
Modified: trunk/app/pdb/layer-cmds.c
==============================================================================
--- trunk/app/pdb/layer-cmds.c (original)
+++ trunk/app/pdb/layer-cmds.c Wed Sep 24 08:28:16 2008
@@ -35,6 +35,7 @@
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
#include "core/gimpprojection.h"
#include "gimppdb.h"
@@ -283,11 +284,66 @@
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
- gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
- gimp->config->interpolation_type, NULL,
- local_origin);
+ {
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
+ gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
+ gimp->config->interpolation_type, progress,
+ local_origin);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
else
- success = FALSE;
+ {
+ success = FALSE;
+ }
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GValueArray *
+layer_scale_full_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpLayer *layer;
+ gint32 new_width;
+ gint32 new_height;
+ gboolean local_origin;
+ gint32 interpolation;
+
+ layer = gimp_value_get_layer (&args->values[0], gimp);
+ new_width = g_value_get_int (&args->values[1]);
+ new_height = g_value_get_int (&args->values[2]);
+ local_origin = g_value_get_boolean (&args->values[3]);
+ interpolation = g_value_get_enum (&args->values[4]);
+
+ if (success)
+ {
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
+ {
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
+ gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
+ interpolation, progress,
+ local_origin);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ else
+ {
+ success = FALSE;
+ }
}
return gimp_procedure_get_return_values (procedure, success,
@@ -1194,8 +1250,8 @@
"gimp-layer-scale");
gimp_procedure_set_static_strings (procedure,
"gimp-layer-scale",
- "Scale the layer to the specified extents.",
- "This procedure scales the layer so that its new width and height are equal to the supplied parameters. The 'local-origin' parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image.",
+ "Scale the layer using the default interpolation method.",
+ "This procedure scales the layer so that its new width and height are equal to the supplied parameters. The 'local-origin' parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image. The default interpolation method is used for scaling.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@@ -1228,6 +1284,54 @@
g_object_unref (procedure);
/*
+ * gimp-layer-scale-full
+ */
+ procedure = gimp_procedure_new (layer_scale_full_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-layer-scale-full");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-layer-scale-full",
+ "Scale the layer using a specific interpolation method.",
+ "This procedure scales the layer so that its new width and height are equal to the supplied parameters. The 'local-origin' parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image. This procedure allows you to specify the interpolation method explicitly.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_layer_id ("layer",
+ "layer",
+ "The layer",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-width",
+ "new width",
+ "New layer width",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("new-height",
+ "new height",
+ "New layer height",
+ 1, GIMP_MAX_IMAGE_SIZE, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("local-origin",
+ "local origin",
+ "Use a local origin (as opposed to the image origin)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("interpolation",
+ "interpolation",
+ "Type of interpolation",
+ GIMP_TYPE_INTERPOLATION_TYPE,
+ GIMP_INTERPOLATION_NONE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-layer-resize
*/
procedure = gimp_procedure_new (layer_resize_invoker);
Modified: trunk/libgimp/gimp.def
==============================================================================
--- trunk/libgimp/gimp.def (original)
+++ trunk/libgimp/gimp.def Wed Sep 24 08:28:16 2008
@@ -382,6 +382,7 @@
gimp_image_resize_to_layers
gimp_image_rotate
gimp_image_scale
+ gimp_image_scale_full
gimp_image_set_active_channel
gimp_image_set_active_layer
gimp_image_set_active_vectors
@@ -429,6 +430,7 @@
gimp_layer_resize
gimp_layer_resize_to_image_size
gimp_layer_scale
+ gimp_layer_scale_full
gimp_layer_set_apply_mask
gimp_layer_set_edit_mask
gimp_layer_set_lock_alpha
Modified: trunk/libgimp/gimpimage_pdb.c
==============================================================================
--- trunk/libgimp/gimpimage_pdb.c (original)
+++ trunk/libgimp/gimpimage_pdb.c Wed Sep 24 08:28:16 2008
@@ -414,14 +414,13 @@
* @new_width: New image width.
* @new_height: New image height.
*
- * Scale the image to the specified extents.
+ * Scale the image using the default interpolation method.
*
* This procedure scales the image so that its new width and height are
- * equal to the supplied parameters. Offsets are also provided which
- * describe the position of the previous image's content. All channels
- * within the image are scaled according to the specified parameters;
- * this includes the image selection mask. All layers within the image
- * are repositioned according to the specified offsets.
+ * equal to the supplied parameters. All layers and channels within the
+ * image are scaled according to the specified parameters; this
+ * includes the image selection mask. The default interpolation method
+ * is used.
*
* Returns: TRUE on success.
*/
@@ -449,12 +448,56 @@
}
/**
+ * gimp_image_scale_full:
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ * @interpolation: Type of interpolation.
+ *
+ * Scale the image using a specific interpolation method.
+ *
+ * This procedure scales the image so that its new width and height are
+ * equal to the supplied parameters. All layers and channels within the
+ * image are scaled according to the specified parameters; this
+ * includes the image selection mask. This procedure allows you to
+ * specify the interpolation method explicitly.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.6
+ */
+gboolean
+gimp_image_scale_full (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ GimpInterpolationType interpolation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-scale-full",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
* gimp_image_crop:
* @image_ID: The image.
* @new_width: New image width: (0 < new_width <= width).
* @new_height: New image height: (0 < new_height <= height).
- * @offx: x offset: (0 <= offx <= (width - new_width)).
- * @offy: y offset: (0 <= offy <= (height - new_height)).
+ * @offx: X offset: (0 <= offx <= (width - new_width)).
+ * @offy: Y offset: (0 <= offy <= (height - new_height)).
*
* Crop the image to the specified extents.
*
Modified: trunk/libgimp/gimpimage_pdb.h
==============================================================================
--- trunk/libgimp/gimpimage_pdb.h (original)
+++ trunk/libgimp/gimpimage_pdb.h Wed Sep 24 08:28:16 2008
@@ -29,162 +29,166 @@
/* For information look into the C source or the html documentation */
-gboolean gimp_image_is_valid (gint32 image_ID);
-gint* gimp_image_list (gint *num_images);
-gint32 gimp_image_new (gint width,
- gint height,
- GimpImageBaseType type);
-gint32 gimp_image_duplicate (gint32 image_ID);
-gboolean gimp_image_delete (gint32 image_ID);
-GimpImageBaseType gimp_image_base_type (gint32 image_ID);
-gint gimp_image_width (gint32 image_ID);
-gint gimp_image_height (gint32 image_ID);
+gboolean gimp_image_is_valid (gint32 image_ID);
+gint* gimp_image_list (gint *num_images);
+gint32 gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type);
+gint32 gimp_image_duplicate (gint32 image_ID);
+gboolean gimp_image_delete (gint32 image_ID);
+GimpImageBaseType gimp_image_base_type (gint32 image_ID);
+gint gimp_image_width (gint32 image_ID);
+gint gimp_image_height (gint32 image_ID);
#ifndef GIMP_DISABLE_DEPRECATED
-gboolean gimp_image_free_shadow (gint32 image_ID);
+gboolean gimp_image_free_shadow (gint32 image_ID);
#endif /* GIMP_DISABLE_DEPRECATED */
-gboolean gimp_image_resize (gint32 image_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_image_resize_to_layers (gint32 image_ID);
-gboolean gimp_image_scale (gint32 image_ID,
- gint new_width,
- gint new_height);
-gboolean gimp_image_crop (gint32 image_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_image_flip (gint32 image_ID,
- GimpOrientationType flip_type);
-gboolean gimp_image_rotate (gint32 image_ID,
- GimpRotationType rotate_type);
-gint* gimp_image_get_layers (gint32 image_ID,
- gint *num_layers);
-gint* gimp_image_get_channels (gint32 image_ID,
- gint *num_channels);
-gint* gimp_image_get_vectors (gint32 image_ID,
- gint *num_vectors);
-gint32 gimp_image_get_active_drawable (gint32 image_ID);
-gboolean gimp_image_unset_active_channel (gint32 image_ID);
-gint32 gimp_image_get_floating_sel (gint32 image_ID);
-gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
-gboolean gimp_image_pick_color (gint32 image_ID,
- gint32 drawable_ID,
- gdouble x,
- gdouble y,
- gboolean sample_merged,
- gboolean sample_average,
- gdouble average_radius,
- GimpRGB *color);
-gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
- gint x,
- gint y);
-gboolean gimp_image_add_layer (gint32 image_ID,
- gint32 layer_ID,
- gint position);
-gboolean gimp_image_remove_layer (gint32 image_ID,
- gint32 layer_ID);
-gint gimp_image_get_layer_position (gint32 image_ID,
- gint32 layer_ID);
-gboolean gimp_image_raise_layer (gint32 image_ID,
- gint32 layer_ID);
-gboolean gimp_image_lower_layer (gint32 image_ID,
- gint32 layer_ID);
-gboolean gimp_image_raise_layer_to_top (gint32 image_ID,
- gint32 layer_ID);
-gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID,
- gint32 layer_ID);
-gboolean gimp_image_add_channel (gint32 image_ID,
- gint32 channel_ID,
- gint position);
-gboolean gimp_image_remove_channel (gint32 image_ID,
- gint32 channel_ID);
-gint gimp_image_get_channel_position (gint32 image_ID,
- gint32 channel_ID);
-gboolean gimp_image_raise_channel (gint32 image_ID,
- gint32 channel_ID);
-gboolean gimp_image_lower_channel (gint32 image_ID,
- gint32 channel_ID);
-gboolean gimp_image_add_vectors (gint32 image_ID,
- gint32 vectors_ID,
- gint position);
-gboolean gimp_image_remove_vectors (gint32 image_ID,
- gint32 vectors_ID);
-gint gimp_image_get_vectors_position (gint32 image_ID,
- gint32 vectors_ID);
-gboolean gimp_image_raise_vectors (gint32 image_ID,
- gint32 vectors_ID);
-gboolean gimp_image_lower_vectors (gint32 image_ID,
- gint32 vectors_ID);
-gboolean gimp_image_raise_vectors_to_top (gint32 image_ID,
- gint32 vectors_ID);
-gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID,
- gint32 vectors_ID);
-gint32 gimp_image_flatten (gint32 image_ID);
-gint32 gimp_image_merge_visible_layers (gint32 image_ID,
- GimpMergeType merge_type);
-gint32 gimp_image_merge_down (gint32 image_ID,
- gint32 merge_layer_ID,
- GimpMergeType merge_type);
-G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
- gint *num_bytes);
-G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
- gint num_bytes,
- const guint8 *colormap);
-gboolean gimp_image_clean_all (gint32 image_ID);
-gboolean gimp_image_is_dirty (gint32 image_ID);
-G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
- gint width,
- gint height,
- gint *actual_width,
- gint *actual_height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data);
-gint32 gimp_image_get_active_layer (gint32 image_ID);
-gboolean gimp_image_set_active_layer (gint32 image_ID,
- gint32 active_layer_ID);
-gint32 gimp_image_get_active_channel (gint32 image_ID);
-gboolean gimp_image_set_active_channel (gint32 image_ID,
- gint32 active_channel_ID);
-gint32 gimp_image_get_active_vectors (gint32 image_ID);
-gboolean gimp_image_set_active_vectors (gint32 image_ID,
- gint32 active_vectors_ID);
-gint32 gimp_image_get_selection (gint32 image_ID);
-gboolean gimp_image_get_component_active (gint32 image_ID,
- GimpChannelType component);
-gboolean gimp_image_set_component_active (gint32 image_ID,
- GimpChannelType component,
- gboolean active);
-gboolean gimp_image_get_component_visible (gint32 image_ID,
- GimpChannelType component);
-gboolean gimp_image_set_component_visible (gint32 image_ID,
- GimpChannelType component,
- gboolean visible);
-gchar* gimp_image_get_filename (gint32 image_ID);
-gboolean gimp_image_set_filename (gint32 image_ID,
- const gchar *filename);
-gchar* gimp_image_get_name (gint32 image_ID);
-gboolean gimp_image_get_resolution (gint32 image_ID,
- gdouble *xresolution,
- gdouble *yresolution);
-gboolean gimp_image_set_resolution (gint32 image_ID,
- gdouble xresolution,
- gdouble yresolution);
-GimpUnit gimp_image_get_unit (gint32 image_ID);
-gboolean gimp_image_set_unit (gint32 image_ID,
- GimpUnit unit);
-gint gimp_image_get_tattoo_state (gint32 image_ID);
-gboolean gimp_image_set_tattoo_state (gint32 image_ID,
- gint tattoo_state);
-gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
- gint tattoo);
+gboolean gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_resize_to_layers (gint32 image_ID);
+gboolean gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height);
+gboolean gimp_image_scale_full (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ GimpInterpolationType interpolation);
+gboolean gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type);
+gboolean gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type);
+gint* gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers);
+gint* gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels);
+gint* gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors);
+gint32 gimp_image_get_active_drawable (gint32 image_ID);
+gboolean gimp_image_unset_active_channel (gint32 image_ID);
+gint32 gimp_image_get_floating_sel (gint32 image_ID);
+gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
+gboolean gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color);
+gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y);
+gboolean gimp_image_add_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint position);
+gboolean gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID);
+gint gimp_image_get_layer_position (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_raise_layer (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_lower_layer (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_raise_layer_to_top (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_add_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint position);
+gboolean gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID);
+gint gimp_image_get_channel_position (gint32 image_ID,
+ gint32 channel_ID);
+gboolean gimp_image_raise_channel (gint32 image_ID,
+ gint32 channel_ID);
+gboolean gimp_image_lower_channel (gint32 image_ID,
+ gint32 channel_ID);
+gboolean gimp_image_add_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint position);
+gboolean gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gint gimp_image_get_vectors_position (gint32 image_ID,
+ gint32 vectors_ID);
+gboolean gimp_image_raise_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gboolean gimp_image_lower_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gboolean gimp_image_raise_vectors_to_top (gint32 image_ID,
+ gint32 vectors_ID);
+gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID,
+ gint32 vectors_ID);
+gint32 gimp_image_flatten (gint32 image_ID);
+gint32 gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type);
+gint32 gimp_image_merge_down (gint32 image_ID,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type);
+G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap);
+gboolean gimp_image_clean_all (gint32 image_ID);
+gboolean gimp_image_is_dirty (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gint32 gimp_image_get_active_layer (gint32 image_ID);
+gboolean gimp_image_set_active_layer (gint32 image_ID,
+ gint32 active_layer_ID);
+gint32 gimp_image_get_active_channel (gint32 image_ID);
+gboolean gimp_image_set_active_channel (gint32 image_ID,
+ gint32 active_channel_ID);
+gint32 gimp_image_get_active_vectors (gint32 image_ID);
+gboolean gimp_image_set_active_vectors (gint32 image_ID,
+ gint32 active_vectors_ID);
+gint32 gimp_image_get_selection (gint32 image_ID);
+gboolean gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active);
+gboolean gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ gboolean visible);
+gchar* gimp_image_get_filename (gint32 image_ID);
+gboolean gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename);
+gchar* gimp_image_get_name (gint32 image_ID);
+gboolean gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution);
+gboolean gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution);
+GimpUnit gimp_image_get_unit (gint32 image_ID);
+gboolean gimp_image_set_unit (gint32 image_ID,
+ GimpUnit unit);
+gint gimp_image_get_tattoo_state (gint32 image_ID);
+gboolean gimp_image_set_tattoo_state (gint32 image_ID,
+ gint tattoo_state);
+gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ gint tattoo);
G_END_DECLS
Modified: trunk/libgimp/gimplayer_pdb.c
==============================================================================
--- trunk/libgimp/gimplayer_pdb.c (original)
+++ trunk/libgimp/gimplayer_pdb.c Wed Sep 24 08:28:16 2008
@@ -269,13 +269,13 @@
* @new_height: New layer height.
* @local_origin: Use a local origin (as opposed to the image origin).
*
- * Scale the layer to the specified extents.
+ * Scale the layer using the default interpolation method.
*
* This procedure scales the layer so that its new width and height are
* equal to the supplied parameters. The 'local-origin' parameter
* specifies whether to scale from the center of the layer, or from the
* image origin. This operation only works if the layer has been added
- * to an image.
+ * to an image. The default interpolation method is used for scaling.
*
* Returns: TRUE on success.
*/
@@ -305,6 +305,54 @@
}
/**
+ * gimp_layer_scale_full:
+ * @layer_ID: The layer.
+ * @new_width: New layer width.
+ * @new_height: New layer height.
+ * @local_origin: Use a local origin (as opposed to the image origin).
+ * @interpolation: Type of interpolation.
+ *
+ * Scale the layer using a specific interpolation method.
+ *
+ * This procedure scales the layer so that its new width and height are
+ * equal to the supplied parameters. The 'local-origin' parameter
+ * specifies whether to scale from the center of the layer, or from the
+ * image origin. This operation only works if the layer has been added
+ * to an image. This procedure allows you to specify the interpolation
+ * method explicitly.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.6
+ */
+gboolean
+gimp_layer_scale_full (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin,
+ GimpInterpolationType interpolation)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-layer-scale-full",
+ &nreturn_vals,
+ GIMP_PDB_LAYER, layer_ID,
+ GIMP_PDB_INT32, new_width,
+ GIMP_PDB_INT32, new_height,
+ GIMP_PDB_INT32, local_origin,
+ GIMP_PDB_INT32, interpolation,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
* gimp_layer_resize:
* @layer_ID: The layer.
* @new_width: New layer width.
Modified: trunk/libgimp/gimplayer_pdb.h
==============================================================================
--- trunk/libgimp/gimplayer_pdb.h (original)
+++ trunk/libgimp/gimplayer_pdb.h Wed Sep 24 08:28:16 2008
@@ -29,65 +29,70 @@
/* For information look into the C source or the html documentation */
-G_GNUC_INTERNAL gint32 _gimp_layer_new (gint32 image_ID,
- gint width,
- gint height,
- GimpImageType type,
- const gchar *name,
- gdouble opacity,
- GimpLayerModeEffects mode);
-gint32 gimp_layer_new_from_visible (gint32 image_ID,
- gint32 dest_image_ID,
- const gchar *name);
-gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
- gint32 dest_image_ID);
-G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
- gboolean add_alpha);
-gboolean gimp_layer_add_alpha (gint32 layer_ID);
-gboolean gimp_layer_flatten (gint32 layer_ID);
-gboolean gimp_layer_scale (gint32 layer_ID,
- gint new_width,
- gint new_height,
- gboolean local_origin);
-gboolean gimp_layer_resize (gint32 layer_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_layer_resize_to_image_size (gint32 layer_ID);
-gboolean gimp_layer_translate (gint32 layer_ID,
- gint offx,
- gint offy);
-gboolean gimp_layer_set_offsets (gint32 layer_ID,
- gint offx,
- gint offy);
-gint32 gimp_layer_create_mask (gint32 layer_ID,
- GimpAddMaskType mask_type);
-gint32 gimp_layer_get_mask (gint32 layer_ID);
-gint32 gimp_layer_from_mask (gint32 mask_ID);
-gboolean gimp_layer_add_mask (gint32 layer_ID,
- gint32 mask_ID);
-gboolean gimp_layer_remove_mask (gint32 layer_ID,
- GimpMaskApplyMode mode);
-gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
-gboolean gimp_layer_get_lock_alpha (gint32 layer_ID);
-gboolean gimp_layer_set_lock_alpha (gint32 layer_ID,
- gboolean lock_alpha);
-gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
-gboolean gimp_layer_set_apply_mask (gint32 layer_ID,
- gboolean apply_mask);
-gboolean gimp_layer_get_show_mask (gint32 layer_ID);
-gboolean gimp_layer_set_show_mask (gint32 layer_ID,
- gboolean show_mask);
-gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
-gboolean gimp_layer_set_edit_mask (gint32 layer_ID,
- gboolean edit_mask);
-gdouble gimp_layer_get_opacity (gint32 layer_ID);
-gboolean gimp_layer_set_opacity (gint32 layer_ID,
- gdouble opacity);
-GimpLayerModeEffects gimp_layer_get_mode (gint32 layer_ID);
-gboolean gimp_layer_set_mode (gint32 layer_ID,
- GimpLayerModeEffects mode);
+G_GNUC_INTERNAL gint32 _gimp_layer_new (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpImageType type,
+ const gchar *name,
+ gdouble opacity,
+ GimpLayerModeEffects mode);
+gint32 gimp_layer_new_from_visible (gint32 image_ID,
+ gint32 dest_image_ID,
+ const gchar *name);
+gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
+ gint32 dest_image_ID);
+G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
+ gboolean add_alpha);
+gboolean gimp_layer_add_alpha (gint32 layer_ID);
+gboolean gimp_layer_flatten (gint32 layer_ID);
+gboolean gimp_layer_scale (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin);
+gboolean gimp_layer_scale_full (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin,
+ GimpInterpolationType interpolation);
+gboolean gimp_layer_resize (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_layer_resize_to_image_size (gint32 layer_ID);
+gboolean gimp_layer_translate (gint32 layer_ID,
+ gint offx,
+ gint offy);
+gboolean gimp_layer_set_offsets (gint32 layer_ID,
+ gint offx,
+ gint offy);
+gint32 gimp_layer_create_mask (gint32 layer_ID,
+ GimpAddMaskType mask_type);
+gint32 gimp_layer_get_mask (gint32 layer_ID);
+gint32 gimp_layer_from_mask (gint32 mask_ID);
+gboolean gimp_layer_add_mask (gint32 layer_ID,
+ gint32 mask_ID);
+gboolean gimp_layer_remove_mask (gint32 layer_ID,
+ GimpMaskApplyMode mode);
+gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
+gboolean gimp_layer_get_lock_alpha (gint32 layer_ID);
+gboolean gimp_layer_set_lock_alpha (gint32 layer_ID,
+ gboolean lock_alpha);
+gboolean gimp_layer_get_apply_mask (gint32 layer_ID);
+gboolean gimp_layer_set_apply_mask (gint32 layer_ID,
+ gboolean apply_mask);
+gboolean gimp_layer_get_show_mask (gint32 layer_ID);
+gboolean gimp_layer_set_show_mask (gint32 layer_ID,
+ gboolean show_mask);
+gboolean gimp_layer_get_edit_mask (gint32 layer_ID);
+gboolean gimp_layer_set_edit_mask (gint32 layer_ID,
+ gboolean edit_mask);
+gdouble gimp_layer_get_opacity (gint32 layer_ID);
+gboolean gimp_layer_set_opacity (gint32 layer_ID,
+ gdouble opacity);
+GimpLayerModeEffects gimp_layer_get_mode (gint32 layer_ID);
+gboolean gimp_layer_set_mode (gint32 layer_ID,
+ GimpLayerModeEffects mode);
G_END_DECLS
Modified: trunk/tools/pdbgen/pdb/image.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/image.pdb (original)
+++ trunk/tools/pdbgen/pdb/image.pdb Wed Sep 24 08:28:16 2008
@@ -255,15 +255,14 @@
}
sub image_scale {
- $blurb = 'Scale the image to the specified extents.';
+ $blurb = 'Scale the image using the default interpolation method.';
$help = <<'HELP';
+
This procedure scales the image so that its new width and height are
-equal to the supplied parameters. Offsets are also provided which
-describe the position of the previous image's content. All channels
-within the image are scaled according to the specified parameters;
-this includes the image selection mask. All layers within the image
-are repositioned according to the specified offsets.
+equal to the supplied parameters. All layers and channels within the
+image are scaled according to the specified parameters; this includes
+the image selection mask. The default interpolation method is used.
HELP
&std_pdb_misc;
@@ -281,9 +280,55 @@
headers => [ qw("config/gimpcoreconfig.h" "core/gimpimage-scale.h") ],
code => <<'CODE'
{
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
gimp_image_scale (image, new_width, new_height,
gimp->config->interpolation_type,
- NULL);
+ progress);
+
+ if (progress)
+ gimp_progress_end (progress);
+}
+CODE
+ );
+}
+
+sub image_scale_full {
+ $blurb = 'Scale the image using a specific interpolation method.';
+
+ $help = <<'HELP';
+This procedure scales the image so that its new width and height are
+equal to the supplied parameters. All layers and channels within the
+image are scaled according to the specified parameters; this includes
+the image selection mask. This procedure allows you to specify the
+interpolation method explicitly.
+HELP
+
+ &neo_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image width' },
+ { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New image height' },
+ { name => 'interpolation', type => 'enum GimpInterpolationType',
+ desc => 'Type of interpolation' }
+ );
+
+ %invoke = (
+ headers => [ qw("config/gimpcoreconfig.h" "core/gimpimage-scale.h") ],
+ code => <<'CODE'
+{
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
+ gimp_image_scale (image, new_width, new_height, interpolation, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
}
CODE
);
@@ -311,9 +356,9 @@
{ name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
desc => 'New image height: (0 < new_height <= height)' },
{ name => 'offx', type => '0 <= int32',
- desc => 'x offset: (0 <= offx <= (width - new_width))' },
+ desc => 'X offset: (0 <= offx <= (width - new_width))' },
{ name => 'offy', type => '0 <= int32',
- desc => 'y offset: (0 <= offy <= (height - new_height))' }
+ desc => 'Y offset: (0 <= offy <= (height - new_height))' }
);
%invoke = (
@@ -378,7 +423,13 @@
headers => [ qw("core/gimpimage-rotate.h") ],
code => <<'CODE'
{
- gimp_image_rotate (image, context, rotate_type, NULL);
+ if (progress)
+ gimp_progress_start (progress, _("Rotating"), FALSE);
+
+ gimp_image_rotate (image, context, rotate_type, progress);
+
+ if (progress)
+ gimp_progress_end (progress);
}
CODE
);
@@ -2570,6 +2621,7 @@
"base/temp-buf.h"
"core/gimp.h"
"core/gimplist.h"
+ "core/gimpprogress.h"
"core/gimpunit.h"
"gimppdberror.h"
"gimppdb-utils.h"
@@ -2582,7 +2634,7 @@
image_width image_height
image_free_shadow
image_resize image_resize_to_layers
- image_scale
+ image_scale image_scale_full
image_crop image_flip image_rotate
image_get_layers
image_get_channels
@@ -2624,7 +2676,7 @@
image_get_channel_by_tattoo
image_get_vectors_by_tattoo);
-%exports = (app => [ procs], lib => [ procs[0 45,48..75]]);
+%exports = (app => [ procs], lib => [ procs[0 46,49..76]]);
$desc = 'Image';
Modified: trunk/tools/pdbgen/pdb/layer.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/layer.pdb (original)
+++ trunk/tools/pdbgen/pdb/layer.pdb Wed Sep 24 08:28:16 2008
@@ -318,14 +318,14 @@
}
sub layer_scale {
- $blurb = 'Scale the layer to the specified extents.';
+ $blurb = 'Scale the layer using the default interpolation method.';
$help = <<'HELP';
This procedure scales the layer so that its new width and height are
equal to the supplied parameters. The 'local-origin' parameter
specifies whether to scale from the center of the layer, or from the
image origin. This operation only works if the layer has been added to
-an image.
+an image. The default interpolation method is used for scaling.
HELP
&std_pdb_misc;
@@ -345,11 +345,72 @@
code => <<'CODE'
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
- gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
- gimp->config->interpolation_type, NULL,
- local_origin);
+ {
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
+ gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
+ gimp->config->interpolation_type, progress,
+ local_origin);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
else
- success = FALSE;
+ {
+ success = FALSE;
+ }
+}
+CODE
+ );
+}
+
+sub layer_scale_full {
+ $blurb = 'Scale the layer using a specific interpolation method.';
+
+ $help = <<'HELP';
+This procedure scales the layer so that its new width and height are
+equal to the supplied parameters. The 'local-origin' parameter
+specifies whether to scale from the center of the layer, or from the
+image origin. This operation only works if the layer has been added to
+an image. This procedure allows you to specify the interpolation
+method explicitly.
+HELP
+
+ &neo_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'layer', type => 'layer',
+ desc => 'The layer' },
+ { name => 'new_width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New layer width' },
+ { name => 'new_height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
+ desc => 'New layer height' },
+ { name => 'local_origin', type => 'boolean',
+ desc => 'Use a local origin (as opposed to the image origin)' },
+ { name => 'interpolation', type => 'enum GimpInterpolationType',
+ desc => 'Type of interpolation' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
+ {
+ if (progress)
+ gimp_progress_start (progress, _("Scaling"), FALSE);
+
+ gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
+ interpolation, progress,
+ local_origin);
+
+ if (progress)
+ gimp_progress_end (progress);
+ }
+ else
+ {
+ success = FALSE;
+ }
}
CODE
);
@@ -998,6 +1059,7 @@
"core/gimp.h"
"core/gimpimage-undo.h"
"core/gimpitem-linked.h"
+ "core/gimpprogress.h"
"core/gimpprojection.h"
"gimppdb-utils.h"
"gimp-intl.h");
@@ -1008,7 +1070,7 @@
layer_copy
layer_add_alpha
layer_flatten
- layer_scale
+ layer_scale layer_scale_full
layer_resize layer_resize_to_image_size
layer_translate
layer_set_offsets
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]