gimp/app/pdb/plug-in-compat-cmds.c

219 lines
9.5 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl. */
#include "config.h"
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "pdb-types.h"
#include "core/gimpdrawable-operation.h"
#include "core/gimpdrawable.h"
#include "core/gimpparamspecs.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
#include "gimpprocedure.h"
#include "internal-procs.h"
#include "gimp-intl.h"
static GValueArray *
plug_in_pixelize_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 pixel_width;
drawable = gimp_value_get_drawable (&args->values[2], gimp);
pixel_width = g_value_get_int (&args->values[3]);
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "gegl:pixelise",
"size-x", pixel_width,
"size-y", pixel_width,
NULL);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Pixelize"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
plug_in_pixelize2_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 pixel_width;
gint32 pixel_height;
drawable = gimp_value_get_drawable (&args->values[2], gimp);
pixel_width = g_value_get_int (&args->values[3]);
pixel_height = g_value_get_int (&args->values[4]);
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *node =
gegl_node_new_child (NULL,
"operation", "gegl:pixelise",
"size-x", pixel_width,
"size-y", pixel_height,
NULL);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Pixelize"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
void
register_plug_in_compat_procs (GimpPDB *pdb)
{
GimpProcedure *procedure;
/*
* gimp-plug-in-pixelize
*/
procedure = gimp_procedure_new (plug_in_pixelize_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"plug-in-pixelize");
gimp_procedure_set_static_strings (procedure,
"plug-in-pixelize",
"Simplify image into an array of solid-colored squares",
"Pixelize the contents of the specified drawable with specified pixelizing width.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997",
NULL);
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("run-mode",
"run mode",
"The run mode",
GIMP_TYPE_RUN_MODE,
GIMP_RUN_INTERACTIVE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"Input image (unused)",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
"Input drawable",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("pixel-width",
"pixel width",
"Pixel width (the decrease in resolution)",
1, GIMP_MAX_IMAGE_SIZE, 1,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-pixelize2
*/
procedure = gimp_procedure_new (plug_in_pixelize2_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"plug-in-pixelize2");
gimp_procedure_set_static_strings (procedure,
"plug-in-pixelize2",
"Simplify image into an array of solid-colored rectangles",
"Pixelize the contents of the specified drawable with specified pixelizing width and height.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997",
NULL);
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("run-mode",
"run mode",
"The run mode",
GIMP_TYPE_RUN_MODE,
GIMP_RUN_INTERACTIVE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"Input image (unused)",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
"Input drawable",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("pixel-width",
"pixel width",
"Pixel width (the decrease in horizontal resolution)",
1, GIMP_MAX_IMAGE_SIZE, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("pixel-height",
"pixel height",
"Pixel height (the decrease in vertical resolution)",
1, GIMP_MAX_IMAGE_SIZE, 1,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}