Commit e6703aa6 authored by Michael Natterer's avatar Michael Natterer

plug-ins, pdb: remove the papertile plug-in and add a PDB compat proc

parent 41fda5ed
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 754 procedures registered total */
/* 755 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......
......@@ -2023,6 +2023,96 @@ plug_in_nova_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GimpValueArray *
plug_in_papertile_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 tile_size;
gdouble move_max;
gint32 fractional_type;
gboolean wrap_around;
gboolean centering;
gint32 background_type;
GimpRGB background_color;
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
tile_size = g_value_get_int (gimp_value_array_index (args, 3));
move_max = g_value_get_double (gimp_value_array_index (args, 4));
fractional_type = g_value_get_int (gimp_value_array_index (args, 5));
wrap_around = g_value_get_boolean (gimp_value_array_index (args, 6));
centering = g_value_get_boolean (gimp_value_array_index (args, 7));
background_type = g_value_get_int (gimp_value_array_index (args, 8));
gimp_value_get_rgb (gimp_value_array_index (args, 9), &background_color);
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *node;
GimpRGB color;
GeglColor *gegl_color;
gint bg_type;
switch (background_type)
{
default:
bg_type = background_type;
gimp_rgba_set (&color, 0.0, 0.0, 1.0, 1.0);
break;
case 3:
bg_type = 3;
gimp_context_get_foreground (context, &color);
break;
case 4:
bg_type = 3;
gimp_context_get_background (context, &color);
break;
case 5:
bg_type = 3;
color = background_color;
break;
}
gegl_color = gimp_gegl_color_new (&color);
node = gegl_node_new_child (NULL,
"operation", "gegl:tile-paper",
"tile-width", tile_size,
"tile-height", tile_size,
"move-rate", move_max,
"bg-color", gegl_color,
"centering", centering,
"wrap-around", wrap_around,
"background-type", bg_type,
"fractional-type", fractional_type,
NULL);
g_object_unref (gegl_color);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Paper Tile"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
plug_in_pixelize_invoker (GimpProcedure *procedure,
Gimp *gimp,
......@@ -5310,6 +5400,91 @@ register_plug_in_compat_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-papertile
*/
procedure = gimp_procedure_new (plug_in_papertile_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"plug-in-papertile");
gimp_procedure_set_static_strings (procedure,
"plug-in-papertile",
"Cut image into paper tiles, and slide them",
"This plug-in cuts an image into paper tiles and slides each paper tile.",
"Compatibility procedure. Please see 'gegl:tile-paper' for credits.",
"Compatibility procedure. Please see 'gegl:tile-paper' for credits.",
"2015",
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 ("tile-size",
"tile size",
"Tile size (pixels)",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("move-max",
"move max",
"Max move rate (%)",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("fractional-type",
"fractional type",
"Fractional type { BACKGROUND (0), IGNORE (1), FORCE (2) }",
0, 2, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("wrap-around",
"wrap around",
"Wrap around",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("centering",
"centering",
"Centering",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("background-type",
"background type",
"Background type { TRANSPARENT (0), INVERTED (1), IMAGE (2), FG (3), BG (4), COLOR (5) }",
0, 5, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_rgb ("background-color",
"background color",
"Background color (for background-type == 5)",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("background-alpha",
"background alpha",
"Background alpha (unused)",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-pixelize
*/
......
......@@ -188,8 +188,6 @@
/sphere-designer.exe
/tile
/tile.exe
/tile-paper
/tile-paper.exe
/tile-small
/tile-small.exe
/unit-editor
......
......@@ -137,7 +137,6 @@ libexec_PROGRAMS = \
sparkle \
sphere-designer \
tile \
tile-paper \
tile-small \
unit-editor \
unsharp-mask \
......@@ -1820,23 +1819,6 @@ tile_LDADD = \
$(INTLLIBS) \
$(tile_RC)
tile_paper_SOURCES = \
tile-paper.c
tile_paper_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(tile_paper_RC)
tile_small_SOURCES = \
tile-small.c
......
......@@ -91,7 +91,6 @@ softglow_RC = softglow.rc.o
sparkle_RC = sparkle.rc.o
sphere_designer_RC = sphere-designer.rc.o
tile_RC = tile.rc.o
tile_paper_RC = tile-paper.rc.o
tile_small_RC = tile-small.rc.o
unit_editor_RC = unit-editor.rc.o
unsharp_mask_RC = unsharp-mask.rc.o
......
......@@ -92,7 +92,6 @@
'sparkle' => { ui => 1 },
'sphere-designer' => { ui => 1 },
'tile' => { ui => 1 },
'tile-paper' => { ui => 1 },
'tile-small' => { ui => 1 },
'unit-editor' => { ui => 1 },
'unsharp-mask' => { ui => 1 },
......
This diff is collapsed.
......@@ -96,7 +96,6 @@ plug-ins/common/softglow.c
plug-ins/common/sparkle.c
plug-ins/common/sphere-designer.c
plug-ins/common/tile.c
plug-ins/common/tile-paper.c
plug-ins/common/tile-small.c
plug-ins/common/unit-editor.c
plug-ins/common/unsharp-mask.c
......
......@@ -2086,6 +2086,104 @@ CODE
);
}
sub plug_in_papertile {
$blurb = 'Cut image into paper tiles, and slide them';
$help = <<'HELP';
This plug-in cuts an image into paper tiles and slides each paper tile.
HELP
&std_pdb_compat('gegl:tile-paper');
$date = '2015';
@inargs = (
{ name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
desc => 'The run mode' },
{ name => 'image', type => 'image', dead => 1,
desc => 'Input image (unused)' },
{ name => 'drawable', type => 'drawable',
desc => 'Input drawable' },
{ name => 'tile_size', type => 'int32',
desc => 'Tile size (pixels)' },
{ name => 'move_max', type => 'float',
desc => 'Max move rate (%)' },
{ name => 'fractional_type', type => '0 <= int32 <= 2',
desc => 'Fractional type { BACKGROUND (0), IGNORE (1), FORCE (2) }' },
{ name => 'wrap_around', type => 'boolean',
desc => 'Wrap around' },
{ name => 'centering', type => 'boolean',
desc => 'Centering' },
{ name => 'background_type', type => '0 <= int32 <= 5',
desc => 'Background type { TRANSPARENT (0), INVERTED (1), IMAGE (2), FG (3), BG (4), COLOR (5) }' },
{ name => 'background_color', type => 'color',
desc => 'Background color (for background-type == 5)' },
{ name => 'background_alpha', type => 'int32', dead => 1,
desc => 'Background alpha (unused)' }
);
%invoke = (
code => <<'CODE'
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
{
GeglNode *node;
GimpRGB color;
GeglColor *gegl_color;
gint bg_type;
switch (background_type)
{
default:
bg_type = background_type;
gimp_rgba_set (&color, 0.0, 0.0, 1.0, 1.0);
break;
case 3:
bg_type = 3;
gimp_context_get_foreground (context, &color);
break;
case 4:
bg_type = 3;
gimp_context_get_background (context, &color);
break;
case 5:
bg_type = 3;
color = background_color;
break;
}
gegl_color = gimp_gegl_color_new (&color);
node = gegl_node_new_child (NULL,
"operation", "gegl:tile-paper",
"tile-width", tile_size,
"tile-height", tile_size,
"move-rate", move_max,
"bg-color", gegl_color,
"centering", centering,
"wrap-around", wrap_around,
"background-type", bg_type,
"fractional-type", fractional_type,
NULL);
g_object_unref (gegl_color);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Paper Tile"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
CODE
);
}
sub plug_in_pixelize {
$blurb = 'Simplify image into an array of solid-colored squares';
......@@ -3852,6 +3950,7 @@ CODE
plug_in_mblur_inward
plug_in_mosaic
plug_in_nova
plug_in_papertile
plug_in_pixelize
plug_in_pixelize2
plug_in_plasma
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment