Commit 212b44cf authored by Michael Natterer's avatar Michael Natterer

plug-ins, pdb: remove the Solid Noise plug-in and add a PDB compat procedure

parent 01c79a26
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 745 procedures registered total */
/* 746 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......
......@@ -2558,6 +2558,67 @@ plug_in_sobel_invoker (GimpProcedure *procedure,
error ? *error : NULL);
}
static GimpValueArray *
plug_in_solid_noise_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gboolean tilable;
gboolean turbulent;
gint32 seed;
gint32 detail;
gdouble xsize;
gdouble ysize;
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
tilable = g_value_get_boolean (gimp_value_array_index (args, 3));
turbulent = g_value_get_boolean (gimp_value_array_index (args, 4));
seed = g_value_get_int (gimp_value_array_index (args, 5));
detail = g_value_get_int (gimp_value_array_index (args, 6));
xsize = g_value_get_double (gimp_value_array_index (args, 7));
ysize = g_value_get_double (gimp_value_array_index (args, 8));
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;
gint x, y, width, height;
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
node = gegl_node_new_child (NULL,
"operation", "gegl:noise-solid",
"x-size", xsize,
"y-size", ysize,
"detail", detail,
"tilable", tilable,
"turbulent", turbulent,
"seed", seed,
"width", width,
"height", height,
NULL);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Solid Noise"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GimpValueArray *
plug_in_spread_invoker (GimpProcedure *procedure,
Gimp *gimp,
......@@ -5322,6 +5383,78 @@ register_plug_in_compat_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-solid-noise
*/
procedure = gimp_procedure_new (plug_in_solid_noise_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"plug-in-solid-noise");
gimp_procedure_set_static_strings (procedure,
"plug-in-solid-noise",
"Create a random cloud-like texture",
"Generates 2D textures using Perlin's classic solid noise function.",
"Compatibility procedure. Please see 'gegl:noise-solid' for credits.",
"Compatibility procedure. Please see 'gegl:noise-solid' for credits.",
"2014",
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,
g_param_spec_boolean ("tilable",
"tilable",
"Create a tilable output",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("turbulent",
"turbulent",
"Make a turbulent noise",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("seed",
"seed",
"Random seed",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("detail",
"detail",
"Detail level",
0, 15, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("xsize",
"xsize",
"Horizontal texture size",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("ysize",
"ysize",
"Vertical texture size",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-plug-in-spread
*/
......
......@@ -170,8 +170,6 @@
/newsprint.exe
/nl-filter
/nl-filter.exe
/noise-solid
/noise-solid.exe
/oilify
/oilify.exe
/photocopy
......
......@@ -128,7 +128,6 @@ libexec_PROGRAMS = \
metadata \
newsprint \
nl-filter \
noise-solid \
oilify \
photocopy \
plugin-browser \
......@@ -1669,23 +1668,6 @@ nl_filter_LDADD = \
$(INTLLIBS) \
$(nl_filter_RC)
noise_solid_SOURCES = \
noise-solid.c
noise_solid_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(noise_solid_RC)
oilify_SOURCES = \
oilify.c
......
......@@ -82,7 +82,6 @@ max_rgb_RC = max-rgb.rc.o
metadata_RC = metadata.rc.o
newsprint_RC = newsprint.rc.o
nl_filter_RC = nl-filter.rc.o
noise_solid_RC = noise-solid.rc.o
oilify_RC = oilify.rc.o
photocopy_RC = photocopy.rc.o
plugin_browser_RC = plugin-browser.rc.o
......
This diff is collapsed.
......@@ -83,7 +83,6 @@
'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
'newsprint' => { ui => 1 },
'nl-filter' => { ui => 1 },
'noise-solid' => { ui => 1 },
'oilify' => { ui => 1 },
'photocopy' => { ui => 1 },
'plugin-browser' => { ui => 1 },
......
......@@ -87,7 +87,6 @@ plug-ins/common/max-rgb.c
plug-ins/common/metadata.c
plug-ins/common/newsprint.c
plug-ins/common/nl-filter.c
plug-ins/common/noise-solid.c
plug-ins/common/oilify.c
plug-ins/common/photocopy.c
plug-ins/common/plugin-browser.c
......
......@@ -2697,6 +2697,73 @@ CODE
);
}
sub plug_in_solid_noise {
$blurb = 'Create a random cloud-like texture';
$help = <<'HELP';
Generates 2D textures using Perlin's classic solid noise function.
HELP
&std_pdb_compat('gegl:noise-solid');
$date = '2014';
@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 => 'tilable', type => 'boolean',
desc => 'Create a tilable output' },
{ name => 'turbulent', type => 'boolean',
desc => 'Make a turbulent noise' },
{ name => 'seed', type => 'int32',
desc => 'Random seed' },
{ name => 'detail', type => '0 <= int32 <= 15',
desc => 'Detail level' },
{ name => 'xsize', type => 'float',
desc => 'Horizontal texture size' },
{ name => 'ysize', type => 'float',
desc => 'Vertical texture size' }
);
%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;
gint x, y, width, height;
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
node = gegl_node_new_child (NULL,
"operation", "gegl:noise-solid",
"x-size", xsize,
"y-size", ysize,
"detail", detail,
"tilable", tilable,
"turbulent", turbulent,
"seed", seed,
"width", width,
"height", height,
NULL);
gimp_drawable_apply_operation (drawable, progress,
C_("undo-type", "Solid Noise"),
node);
g_object_unref (node);
}
else
success = FALSE;
}
CODE
);
}
sub plug_in_spread {
$blurb = 'Move pixels around randomly';
......@@ -3231,6 +3298,7 @@ CODE
plug_in_shift
plug_in_sinus
plug_in_sobel
plug_in_solid_noise
plug_in_spread
plug_in_threshold_alpha
plug_in_video
......
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