[gimp] plug-ins, pdb: remove the sinus plug-in and add a PDB compat procedure
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove the sinus plug-in and add a PDB compat procedure
- Date: Fri, 21 Nov 2014 21:11:47 +0000 (UTC)
commit b49e8098d4869e53e672517e9cade1a75b2be6b7
Author: Michael Natterer <mitch gimp org>
Date: Fri Nov 21 22:11:15 2014 +0100
plug-ins, pdb: remove the sinus plug-in and add a PDB compat procedure
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 219 +++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 -
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plugin-defs.pl | 1 -
plug-ins/common/sinus.c | 1060 -----------------------------------
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 107 ++++
9 files changed, 327 insertions(+), 1084 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index c01b1b0..5c67464 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 744 procedures registered total */
+/* 745 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index a64cf05..2b92acf 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -2408,6 +2408,109 @@ plug_in_shift_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_sinus_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble xscale;
+ gdouble yscale;
+ gdouble complex;
+ gint32 seed;
+ gboolean tiling;
+ gboolean perturb;
+ gint32 colors;
+ GimpRGB col1;
+ GimpRGB col2;
+ gdouble alpha1;
+ gdouble alpha2;
+ gint32 blend;
+ gdouble blend_power;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ xscale = g_value_get_double (gimp_value_array_index (args, 3));
+ yscale = g_value_get_double (gimp_value_array_index (args, 4));
+ complex = g_value_get_double (gimp_value_array_index (args, 5));
+ seed = g_value_get_int (gimp_value_array_index (args, 6));
+ tiling = g_value_get_boolean (gimp_value_array_index (args, 7));
+ perturb = g_value_get_boolean (gimp_value_array_index (args, 8));
+ colors = g_value_get_int (gimp_value_array_index (args, 9));
+ gimp_value_get_rgb (gimp_value_array_index (args, 10), &col1);
+ gimp_value_get_rgb (gimp_value_array_index (args, 11), &col2);
+ alpha1 = g_value_get_double (gimp_value_array_index (args, 12));
+ alpha2 = g_value_get_double (gimp_value_array_index (args, 13));
+ blend = g_value_get_int (gimp_value_array_index (args, 14));
+ blend_power = g_value_get_double (gimp_value_array_index (args, 15));
+
+ 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;
+ GeglColor *gegl_color1;
+ GeglColor *gegl_color2;
+ gint x, y, width, height;
+
+ switch (colors)
+ {
+ case 0:
+ gimp_rgb_set (&col1, 0.0, 0.0, 0.0);
+ gimp_rgb_set (&col2, 1.0, 1.0, 1.0);
+ break;
+
+ case 1:
+ gimp_context_get_foreground (context, &col1);
+ gimp_context_get_background (context, &col2);
+ break;
+ }
+
+ gimp_rgb_set_alpha (&col1, alpha1);
+ gimp_rgb_set_alpha (&col2, alpha2);
+
+ gegl_color1 = gimp_gegl_color_new (&col1);
+ gegl_color2 = gimp_gegl_color_new (&col2);
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:sinus",
+ "x_scale", xscale,
+ "y-scale", yscale,
+ "complexity", complex,
+ "seed", seed,
+ "tiling", tiling,
+ "perturbation", perturb,
+ "color1", gegl_color1,
+ "color2", gegl_color2,
+ "blend-mode", blend,
+ "blend-power", blend_power,
+ "width", width,
+ "height", height,
+ NULL);
+
+ g_object_unref (gegl_color1);
+ g_object_unref (gegl_color2);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Sinus"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_sobel_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -5050,6 +5153,122 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-sinus
+ */
+ procedure = gimp_procedure_new (plug_in_sinus_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-sinus");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-sinus",
+ "Generate complex sinusoidal textures",
+ "FIXME: sinus help",
+ "Compatibility procedure. Please see 'gegl:sinus' for credits.",
+ "Compatibility procedure. Please see 'gegl:sinus' 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_double ("xscale",
+ "xscale",
+ "Scale value for x axis",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("yscale",
+ "yscale",
+ "Scale value for y axis",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("complex",
+ "complex",
+ "Complexity factor",
+ 0, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Seed value for random number generator",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("tiling",
+ "tiling",
+ "If set, the pattern generated will tile",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("perturb",
+ "perturb",
+ "If set, the pattern is a little more distorted...",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("colors",
+ "colors",
+ "where to take the colors (0=B&W, 1=fg/bg,
2=col1/col2)",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("col1",
+ "col1",
+ "fist color (sometimes unused)",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_rgb ("col2",
+ "col2",
+ "second color (sometimes unused)",
+ FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("alpha1",
+ "alpha1",
+ "alpha for the first color (used if the drawable has an
alpha chanel)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("alpha2",
+ "alpha2",
+ "alpha for the second color (used if the drawable has an
alpha chanel)",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("blend",
+ "blend",
+ "0=linear, 1=bilinear, 2=sinusoidal",
+ 0, 2, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("blend-power",
+ "blend power",
+ "Power used to strech the blend",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-sobel
*/
procedure = gimp_procedure_new (plug_in_sobel_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 9dd20c1..3cb7858 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -190,8 +190,6 @@
/screenshot.exe
/sharpen
/sharpen.exe
-/sinus
-/sinus.exe
/smooth-palette
/smooth-palette.exe
/softglow
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 8e5ee1f..bf8d258 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -138,7 +138,6 @@ libexec_PROGRAMS = \
sample-colorize \
$(SCREENSHOT) \
sharpen \
- sinus \
smooth-palette \
softglow \
sparkle \
@@ -1844,23 +1843,6 @@ sharpen_LDADD = \
$(INTLLIBS) \
$(sharpen_RC)
-sinus_SOURCES = \
- sinus.c
-
-sinus_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(sinus_RC)
-
smooth_palette_SOURCES = \
smooth-palette.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index b5a01bb..a968247 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -92,7 +92,6 @@ ripple_RC = ripple.rc.o
sample_colorize_RC = sample-colorize.rc.o
screenshot_RC = screenshot.rc.o
sharpen_RC = sharpen.rc.o
-sinus_RC = sinus.rc.o
smooth_palette_RC = smooth-palette.rc.o
softglow_RC = softglow.rc.o
sparkle_RC = sparkle.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 52976e8..e7b460c 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -93,7 +93,6 @@
'sample-colorize' => { ui => 1 },
'screenshot' => { ui => 1, optional => 1, libs => 'SCREENSHOT_LIBS', cflags => 'XFIXES_CFLAGS', gegl =>
1 },
'sharpen' => { ui => 1 },
- 'sinus' => { ui => 1 },
'smooth-palette' => { ui => 1 },
'softglow' => { ui => 1 },
'sparkle' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index f635099..f3c655a 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -97,7 +97,6 @@ plug-ins/common/ripple.c
plug-ins/common/sample-colorize.c
plug-ins/common/screenshot.c
plug-ins/common/sharpen.c
-plug-ins/common/sinus.c
plug-ins/common/smooth-palette.c
plug-ins/common/softglow.c
plug-ins/common/sparkle.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index d614c8e..da7f110 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -2531,6 +2531,112 @@ CODE
);
}
+sub plug_in_sinus {
+ $blurb = 'Generate complex sinusoidal textures';
+ $help = 'FIXME: sinus help',
+
+ &std_pdb_compat('gegl:sinus');
+ $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 => 'xscale', type => '0 <= float',
+ desc => 'Scale value for x axis' },
+ { name => 'yscale', type => '0 <= float',
+ desc => 'Scale value for y axis' },
+ { name => 'complex', type => '0 <= float',
+ desc => 'Complexity factor' },
+ { name => 'seed', type => '0 <= int32',
+ desc => 'Seed value for random number generator' },
+ { name => 'tiling', type => 'boolean',
+ desc => 'If set, the pattern generated will tile' },
+ { name => 'perturb', type => 'boolean',
+ desc => 'If set, the pattern is a little more distorted...' },
+ { name => 'colors', type => '0 <= int32 <=2',
+ desc => 'where to take the colors (0=B&W, 1=fg/bg, 2=col1/col2)' },
+ { name => 'col1', type => 'color',
+ desc => 'fist color (sometimes unused)' },
+ { name => 'col2', type => 'color',
+ desc => 'second color (sometimes unused)' },
+ { name => 'alpha1', type => '0 <= float <= 1',
+ desc => 'alpha for the first color (used if the drawable has an alpha chanel)' },
+ { name => 'alpha2', type => '0 <= float <= 1',
+ desc => 'alpha for the second color (used if the drawable has an alpha chanel)' },
+ { name => 'blend', type => '0 <= int32 <= 2',
+ desc => '0=linear, 1=bilinear, 2=sinusoidal' },
+ { name => 'blend_power', type => 'float',
+ desc => 'Power used to strech the blend' }
+ );
+
+ %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;
+ GeglColor *gegl_color1;
+ GeglColor *gegl_color2;
+ gint x, y, width, height;
+
+ switch (colors)
+ {
+ case 0:
+ gimp_rgb_set (&col1, 0.0, 0.0, 0.0);
+ gimp_rgb_set (&col2, 1.0, 1.0, 1.0);
+ break;
+
+ case 1:
+ gimp_context_get_foreground (context, &col1);
+ gimp_context_get_background (context, &col2);
+ break;
+ }
+
+ gimp_rgb_set_alpha (&col1, alpha1);
+ gimp_rgb_set_alpha (&col2, alpha2);
+
+ gegl_color1 = gimp_gegl_color_new (&col1);
+ gegl_color2 = gimp_gegl_color_new (&col2);
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:sinus",
+ "x_scale", xscale,
+ "y-scale", yscale,
+ "complexity", complex,
+ "seed", seed,
+ "tiling", tiling,
+ "perturbation", perturb,
+ "color1", gegl_color1,
+ "color2", gegl_color2,
+ "blend-mode", blend,
+ "blend-power", blend_power,
+ "width", width,
+ "height", height,
+ NULL);
+
+ g_object_unref (gegl_color1);
+ g_object_unref (gegl_color2);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Sinus"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_sobel {
$blurb = 'Specialized direction-dependent edge detection';
@@ -3123,6 +3229,7 @@ CODE
plug_in_noisify
plug_in_semiflatten
plug_in_shift
+ plug_in_sinus
plug_in_sobel
plug_in_spread
plug_in_threshold_alpha
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]