pdb: deprecate gimp_layer_scale_full() and gimp_image_scale_full()

Make gimp_layer_scale() and gimp_image_scale() honor GimpPDBContext's
interpolation property and update the documentation accordingly.
This commit is contained in:
Michael Natterer 2010-09-16 20:33:56 +02:00
parent 46e4fa93b2
commit 54001221d7
11 changed files with 52 additions and 63 deletions

View File

@ -1711,7 +1711,7 @@ register_context_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-context-set-interpolation",
"Set the interpolation type.",
"This procedure modifies the interpolation setting. It affects all transform procedures which can produce sub-pixel results.",
"This procedure modifies the interpolation setting. It affects the following procedures: all transform procedures which can produce sub-pixel results, 'gimp-image-scale', 'gimp-layer-scale'.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2010",

View File

@ -28,7 +28,6 @@
#include "pdb-types.h"
#include "base/temp-buf.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
@ -57,6 +56,7 @@
#include "gimppdb.h"
#include "gimppdberror.h"
#include "gimppdb-utils.h"
#include "gimppdbcontext.h"
#include "gimpprocedure.h"
#include "internal-procs.h"
@ -402,11 +402,13 @@ image_scale_invoker (GimpProcedure *procedure,
if (success)
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
gimp_image_scale (image, new_width, new_height,
gimp->config->interpolation_type,
pdb_context->interpolation,
progress);
if (progress)
@ -3204,7 +3206,7 @@ register_image_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-scale",
"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.",
"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 interpolation method used can be set with 'gimp-context-set-interpolation'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -3238,12 +3240,12 @@ register_image_procs (GimpPDB *pdb)
"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.",
"Deprecated: Use 'gimp-image-scale' instead.",
"Deprecated: Use 'gimp-image-scale' instead.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2008",
NULL);
"gimp-image-scale");
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",

View File

@ -25,7 +25,6 @@
#include "pdb-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage-undo.h"
@ -39,6 +38,7 @@
#include "gimppdb.h"
#include "gimppdb-utils.h"
#include "gimppdbcontext.h"
#include "gimpprocedure.h"
#include "internal-procs.h"
@ -326,11 +326,13 @@ layer_scale_invoker (GimpProcedure *procedure,
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
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,
pdb_context->interpolation, progress,
local_origin);
if (progress)
@ -1328,7 +1330,7 @@ register_layer_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-layer-scale",
"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.",
"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 interpolation method used can be set with 'gimp-context-set-interpolation'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1368,12 +1370,12 @@ register_layer_procs (GimpPDB *pdb)
"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.",
"Deprecated: Use 'gimp-layer-scale' instead.",
"Deprecated: Use 'gimp-layer-scale' instead.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2008",
NULL);
"gimp-layer-scale");
gimp_procedure_add_argument (procedure,
gimp_param_spec_layer_id ("layer",
"layer",

View File

@ -1104,8 +1104,9 @@ gimp_context_get_interpolation (void)
*
* Set the interpolation type.
*
* This procedure modifies the interpolation setting. It affects all
* transform procedures which can produce sub-pixel results.
* This procedure modifies the interpolation setting. It affects the
* following procedures: all transform procedures which can produce
* sub-pixel results, gimp_image_scale(), gimp_layer_scale().
*
* Returns: TRUE on success.
*

View File

@ -428,8 +428,8 @@ gimp_image_resize_to_layers (gint32 image_ID)
* 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.
* includes the image selection mask. The interpolation method used can
* be set with gimp_context_set_interpolation().
*
* Returns: TRUE on success.
**/
@ -463,13 +463,7 @@ gimp_image_scale (gint32 image_ID,
* @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.
* Deprecated: Use gimp_image_scale() instead.
*
* Returns: TRUE on success.
*

View File

@ -50,10 +50,12 @@ gboolean gimp_image_resize_to_layers (gint32
gboolean gimp_image_scale (gint32 image_ID,
gint new_width,
gint new_height);
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_image_scale_full (gint32 image_ID,
gint new_width,
gint new_height,
GimpInterpolationType interpolation);
#endif /* GIMP_DISABLE_DEPRECATED */
gboolean gimp_image_crop (gint32 image_ID,
gint new_width,
gint new_height,

View File

@ -23,6 +23,9 @@
#include "config.h"
#include "gimp.h"
#undef GIMP_DISABLE_DEPRECATED
#undef __GIMP_LAYER_PDB_H__
#include "gimplayer_pdb.h"
/**
@ -319,7 +322,8 @@ gimp_layer_flatten (gint32 layer_ID)
* 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.
* to an image. The interpolation method used can be set with
* gimp_context_set_interpolation().
*
* Returns: TRUE on success.
**/
@ -356,14 +360,7 @@ gimp_layer_scale (gint32 layer_ID,
* @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.
* Deprecated: Use gimp_layer_scale() instead.
*
* Returns: TRUE on success.
*

View File

@ -49,11 +49,13 @@ gboolean gimp_layer_scale (gint32 l
gint new_width,
gint new_height,
gboolean local_origin);
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_layer_scale_full (gint32 layer_ID,
gint new_width,
gint new_height,
gboolean local_origin,
GimpInterpolationType interpolation);
#endif /* GIMP_DISABLE_DEPRECATED */
gboolean gimp_layer_resize (gint32 layer_ID,
gint new_width,
gint new_height,

View File

@ -895,8 +895,9 @@ sub context_set_interpolation {
$blurb = 'Set the interpolation type.';
$help = <<'HELP';
This procedure modifies the interpolation setting. It affects all
transform procedures which can produce sub-pixel results.
This procedure modifies the interpolation setting. It affects the
following procedures: all transform procedures which can produce
sub-pixel results, gimp_image_scale(), gimp_layer_scale().
HELP
&mitch_pdb_misc('2010', '2.8');

View File

@ -261,7 +261,8 @@ sub image_scale {
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.
the image selection mask. The interpolation method used can be set
with gimp_context_set_interpolation().
HELP
&std_pdb_misc;
@ -276,14 +277,16 @@ HELP
);
%invoke = (
headers => [ qw("config/gimpcoreconfig.h" "core/gimpimage-scale.h") ],
headers => [ qw("core/gimpimage-scale.h") ],
code => <<'CODE'
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
gimp_image_scale (image, new_width, new_height,
gimp->config->interpolation_type,
pdb_context->interpolation,
progress);
if (progress)
@ -294,16 +297,7 @@ 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
&std_pdb_deprecated('gimp-image-scale');
&neo_pdb_misc('2008', '2.6');
@inargs = (
@ -318,7 +312,7 @@ HELP
);
%invoke = (
headers => [ qw("config/gimpcoreconfig.h" "core/gimpimage-scale.h") ],
headers => [ qw("core/gimpimage-scale.h") ],
code => <<'CODE'
{
if (progress)
@ -2912,6 +2906,7 @@ CODE
"core/gimpcontainer.h"
"core/gimpprogress.h"
"core/gimpunit.h"
"gimppdbcontext.h"
"gimppdberror.h"
"gimppdb-utils.h"
"gimp-intl.h");

View File

@ -362,7 +362,8 @@ 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.
an image. The interpolation method used can be set with
gimp_context_set_interpolation().
HELP
&std_pdb_misc;
@ -383,11 +384,13 @@ HELP
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), NULL, TRUE, error))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
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,
pdb_context->interpolation, progress,
local_origin);
if (progress)
@ -403,17 +406,7 @@ 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
&std_pdb_deprecated('gimp-layer-scale');
&neo_pdb_misc('2008', '2.6');
@inargs = (
@ -1105,12 +1098,12 @@ CODE
}
@headers = qw("libgimpbase/gimpbase.h"
"config/gimpcoreconfig.h"
"core/gimp.h"
"core/gimpimage-undo.h"
"core/gimpitem-linked.h"
"core/gimppickable.h"
"core/gimpprogress.h"
"gimppdbcontext.h"
"gimppdb-utils.h"
"gimp-intl.h");