extended gauss_blur functionality and a few other minor hacks

--Sven
This commit is contained in:
Sven Neumann 2000-01-18 21:01:45 +00:00
parent 31ee951523
commit cc58abd365
9 changed files with 804 additions and 188 deletions

View file

@ -1,3 +1,23 @@
Tue Jan 18 21:46:25 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/common/gauss_iir.c
* plug-ins/common/gauss_rle.c: The blur radius can now be specified
indepently in each direction. For backward compatibility I left the
original PDB functions unchanged and added new ones. The actual
blurring is done in the same function for both interfaces.
* plug-ins/gap/Makefile.am
* plug-ins/gap/gap_filter_iterators.c
* plug-ins/gap/iter_ALT/gen/plug_in_gauss_iir2_iter_ALT.inc
* plug-ins/gap/iter_ALT/gen/plug_in_gauss_rle2_iter_ALT.inc: added
iteraror functions for the new gauss_blur functions.
* plug-ins/common/grid.c: small changes to the way the size_entrys are
set up
* plug-ins/common/noisify.c:
applied (modified) patch from Julian Kinraid <jkinraid@clear.net.nz>
2000-01-18 Tor Lillqvist <tml@iki.fi>
* README.win32: Some clarifications.

View file

@ -28,8 +28,6 @@
#include "libgimp/stdplugins-intl.h"
#define ENTRY_WIDTH 100
typedef struct
{
gdouble radius;
@ -37,6 +35,12 @@ typedef struct
gint vertical;
} BlurValues;
typedef struct
{
gdouble horizontal;
gdouble vertical;
} Blur2Values;
typedef struct
{
gint run;
@ -53,14 +57,15 @@ static void run (gchar *name,
GParam **return_vals);
static void gauss_iir (GDrawable *drawable,
gint horizontal,
gint vertical,
gdouble std_dev);
gdouble horizontal,
gdouble vertical);
/*
* Gaussian blur interface
*/
static gint gauss_iir_dialog (void);
static gint gauss_iir_dialog (void);
static gint gauss_iir2_dialog (gint32 image_ID,
GDrawable *drawable);
/*
* Gaussian blur helper functions
@ -97,6 +102,12 @@ static BlurValues bvals =
TRUE /* vertical blur */
};
static Blur2Values b2vals =
{
5.0, /* x radius */
5.0 /* y radius */
};
static BlurInterface bint =
{
FALSE /* run */
@ -117,8 +128,19 @@ query (void)
{ PARAM_INT32, "horizontal", "Blur in horizontal direction" },
{ PARAM_INT32, "vertical", "Blur in vertical direction" },
};
static GParamDef *return_vals = NULL;
static gint nargs = sizeof (args) / sizeof (args[0]);
static GParamDef args2[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_FLOAT, "horizontal", "Horizontal radius of gaussian blur (in pixels)" },
{ PARAM_FLOAT, "vertical", "Vertical radius of gaussian blur (in pixels)" }
};
static gint nargs2 = sizeof (args2) / sizeof (args2[0]);
static GParamDef *return_vals = NULL;
static gint nreturn_vals = 0;
INIT_I18N();
@ -129,11 +151,23 @@ query (void)
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
N_("<Image>/Filters/Blur/Gaussian Blur (IIR)..."),
NULL,
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
gimp_install_procedure ("plug_in_gauss_iir2",
_("Applies a gaussian blur to the specified drawable."),
_("Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. This radius can be specified indepently on for the horizontal and the vertical direction. The IIR gaussian blurring works best for large radius values and for images which are not computer-generated. Values for radii less than 1.0 would generate spurious results. Therefore they are interpreted as 0.0, which means that the computation for this orientation is skipped."),
"Spencer Kimball, Peter Mattis & Sven Neumann",
"Spencer Kimball, Peter Mattis & Sven Neumann",
"1995-2000",
N_("<Image>/Filters/Blur/Gaussian Blur (IIR)..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs2, nreturn_vals,
args2, return_vals);
}
static void
@ -144,10 +178,10 @@ run (gchar *name,
GParam **return_vals)
{
static GParam values[1];
gint32 image_ID;
GDrawable *drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
gdouble radius, std_dev;
run_mode = param[0].data.d_int32;
@ -157,76 +191,128 @@ run (gchar *name,
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
switch (run_mode)
/* Get the specified image and drawable */
image_ID = param[1].data.d_image;
drawable = gimp_drawable_get (param[2].data.d_drawable);
if (strcmp (name, "plug_in_gauss_iir") == 0) /* the old-fashioned way of calling it */
{
case RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_iir", &bvals);
/* First acquire information with a dialog */
if (! gauss_iir_dialog ())
return;
break;
case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
if (nparams != 6)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
switch (run_mode)
{
bvals.radius = param[3].data.d_float;
bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
case RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_iir", &bvals);
/* First acquire information with a dialog */
if (! gauss_iir_dialog ())
return;
break;
case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
if (nparams != 6)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
bvals.radius = param[3].data.d_float;
bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
}
if (status == STATUS_SUCCESS && (bvals.radius < 1.0))
status = STATUS_CALLING_ERROR;
INIT_I18N();
break;
case RUN_WITH_LAST_VALS:
INIT_I18N();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_iir", &bvals);
break;
default:
break;
}
if (status == STATUS_SUCCESS && (bvals.radius < 1.0))
status = STATUS_CALLING_ERROR;
INIT_I18N();
break;
case RUN_WITH_LAST_VALS:
INIT_I18N();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_iir", &bvals);
break;
default:
break;
if (!(bvals.horizontal || bvals.vertical))
{
gimp_message ( _("gauss_iir: you must specify either horizontal or vertical (or both)"));
status = STATUS_CALLING_ERROR;
}
}
if (!(bvals.horizontal || bvals.vertical))
else if (strcmp (name, "plug_in_gauss_iir2") == 0)
{
gimp_message ( _("gauss_iir: you must specify either horizontal or vertical (or both)"));
status = STATUS_CALLING_ERROR;
switch (run_mode)
{
case RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_iir2", &b2vals);
/* First acquire information with a dialog */
if (! gauss_iir2_dialog (image_ID, drawable))
return;
break;
case RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 5)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
b2vals.horizontal = param[3].data.d_float;
b2vals.vertical = param[4].data.d_float;
}
if (status == STATUS_SUCCESS && (b2vals.horizontal < 1.0 && b2vals.vertical < 1.0))
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
INIT_I18N();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_iir2", &b2vals);
break;
default:
break;
}
}
else
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_is_rgb (drawable->id) ||
gimp_drawable_is_gray (drawable->id))
{
gimp_progress_init ( _("IIR Gaussian Blur"));
gimp_drawable_is_gray (drawable->id))
{
gimp_progress_init ( _("IIR Gaussian Blur"));
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_iir (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (strcmp (name, "plug_in_gauss_iir") == 0)
{
gauss_iir (drawable, (bvals.horizontal ? bvals.radius : 0.0),
(bvals.vertical ? bvals.radius : 0.0));
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir", &bvals, sizeof (BlurValues));
}
else
{
gauss_iir (drawable, b2vals.horizontal, b2vals.vertical);
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir2", &b2vals, sizeof (Blur2Values));
}
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_iir", &bvals, sizeof (BlurValues));
}
else
{
@ -246,7 +332,7 @@ gauss_iir_dialog (void)
GtkWidget *dlg;
GtkWidget *label;
GtkWidget *spinbutton;
GtkWidget *adj;
GtkObject *adj;
GtkWidget *toggle;
GtkWidget *frame;
GtkWidget *vbox;
@ -330,6 +416,115 @@ gauss_iir_dialog (void)
return bint.run;
}
static gint
gauss_iir2_dialog (gint32 image_ID,
GDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *spinbutton;
GtkObject *adj;
GtkWidget *frame;
GtkWidget *size;
GtkWidget *chain;
GUnit unit;
gdouble xres;
gdouble yres;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("gauss_iir2");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
dlg = gimp_dialog_new (_("IIR Gaussian Blur"), "gauss_iir",
gimp_plugin_help_func, "filters/gauss_iir.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("OK"), gauss_ok_callback,
NULL, NULL, NULL, TRUE, FALSE,
_("Cancel"), gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
NULL);
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
/* parameter settings */
frame = gtk_frame_new (_("Blur Radius"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
/* Get the image resolution and unit */
gimp_image_get_resolution (image_ID, &xres, &yres);
unit = gimp_image_get_unit (image_ID);
adj = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 2);
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
size = gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (size), 0, 4);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size), GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (size), spinbutton, 1, 2, 0, 1);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size), UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size), 1, yres, TRUE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size), 0,
0.0, (gdouble)(MAX (drawable->width, drawable->height)));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size), 1,
0.0, (gdouble)(MAX (drawable->width, drawable->height)));
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (size), 0, 1);
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (size), 1, 1);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size), 0, b2vals.horizontal);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size), 1, b2vals.vertical);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("Horizontal:"), 0, 0, 1.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("Vertical:"), 1, 0, 1.0);
/* put a chain_button to the right */
chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
if (b2vals.horizontal == b2vals.vertical)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), TRUE);
gtk_table_attach_defaults (GTK_TABLE (size), chain, 2, 3, 0, 2);
gtk_widget_show (chain);
gtk_signal_connect (GTK_OBJECT (size), "value_changed",
(GtkSignalFunc) gauss_entry_callback, chain);
gtk_signal_connect (GTK_OBJECT (size), "unit_changed",
(GtkSignalFunc) gauss_entry_callback, chain);
gtk_container_set_border_width (GTK_CONTAINER (size), 4);
gtk_container_add (GTK_CONTAINER (frame), size);
gtk_widget_show (spinbutton);
gtk_widget_show (size);
gtk_widget_show (frame);
gtk_widget_show (dlg);
gtk_object_set_data (GTK_OBJECT (dlg), "size", size);
gtk_main ();
gdk_flush ();
return bint.run;
}
/* Convert from separated to premultiplied alpha, on a single scan line. */
static void
multiply_alpha (guchar *buf, gint width, gint bytes)
@ -372,9 +567,8 @@ separate_alpha (guchar *buf, gint width, gint bytes)
static void
gauss_iir (GDrawable *drawable,
gint horz,
gint vert,
gdouble std_dev)
gdouble horz,
gdouble vert)
{
GPixelRgn src_rgn, dest_rgn;
gint width, height;
@ -395,33 +589,40 @@ gauss_iir (GDrawable *drawable,
gint initial_m[4];
guchar *guc_tmp1, *guc_tmp2;
gint *gi_tmp1, *gi_tmp2;
gdouble std_dev;
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
if (horz < 1.0 && vert < 1.0)
return;
width = (x2 - x1);
height = (y2 - y1);
bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha(drawable->id);
val_p = (gdouble *) g_malloc (MAX (width, height) * bytes * sizeof (gdouble));
val_m = (gdouble *) g_malloc (MAX (width, height) * bytes * sizeof (gdouble));
val_p = g_new (gdouble, MAX (width, height) * bytes);
val_m = g_new (gdouble, MAX (width, height) * bytes);
src = (guchar *) g_malloc (MAX (width, height) * bytes);
dest = (guchar *) g_malloc (MAX (width, height) * bytes);
/* derive the constants for calculating the gaussian from the std dev */
find_constants (n_p, n_m, d_p, d_m, bd_p, bd_m, std_dev);
progress = 0;
max_progress = (horz) ? width * height : 0;
max_progress += (vert) ? width * height : 0;
src = g_new (guchar, MAX (width, height) * bytes);
dest = g_new (guchar, MAX (width, height) * bytes);
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0, drawable->width, drawable->height, TRUE, TRUE);
if (vert)
progress = 0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
/* First the vertical pass */
if (vert >= 1.0)
{
/* First the vertical pass */
vert = fabs (vert) + 1.0;
std_dev = sqrt (-(vert * vert) / (2 * log (1.0 / 255.0)));
/* derive the constants for calculating the gaussian from the std dev */
find_constants (n_p, n_m, d_p, d_m, bd_p, bd_m, std_dev);
for (col = 0; col < width; col++)
{
memset(val_p, 0, height * bytes * sizeof (gdouble));
@ -489,19 +690,28 @@ gauss_iir (GDrawable *drawable,
gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1));
progress += height;
progress += height * vert;
if ((col % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
}
/* prepare for the horizontal pass */
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, TRUE);
}
if (horz)
/* Now the horizontal pass */
if (horz >= 1.0)
{
/* prepare for the horizontal pass */
if (vert)
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, TRUE);
/* Now the horizontal pass */
horz = fabs (horz) + 1.0;
if (horz != vert)
{
std_dev = sqrt (-(horz * horz) / (2 * log (1.0 / 255.0)));
/* derive the constants for calculating the gaussian from the std dev */
find_constants (n_p, n_m, d_p, d_m, bd_p, bd_m, std_dev);
}
for (row = 0; row < height; row++)
{
memset(val_p, 0, width * bytes * sizeof (gdouble));
@ -569,7 +779,7 @@ gauss_iir (GDrawable *drawable,
gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1));
progress += width;
progress += width * horz;
if ((row % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
}
@ -711,16 +921,50 @@ static void
gauss_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *size;
bint.run = TRUE;
size = gtk_object_get_data (GTK_OBJECT (data), "size");
if (size)
{
b2vals.horizontal = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 0);
b2vals.vertical = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 1);
}
gtk_widget_destroy (GTK_WIDGET (data));
}
static void
gauss_entry_callback (GtkWidget *widget,
gauss_entry_callback (GtkWidget *widget,
gpointer data)
{
bvals.radius = atof (gtk_entry_get_text (GTK_ENTRY (widget)));
if (bvals.radius < 1.0)
bvals.radius = 1.0;
static gdouble x = -1.0;
static gdouble y = -1.0;
gdouble new_x;
gdouble new_y;
new_x = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_y = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
{
if (new_x != x)
{
y = new_y = x = new_x;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, y);
}
if (new_y != y)
{
x = new_x = y = new_y;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, x);
}
}
else
{
if (new_x != x)
x = new_x;
if (new_y != y)
y = new_y;
}
}

View file

@ -29,8 +29,6 @@
#include "libgimp/stdplugins-intl.h"
#define ENTRY_WIDTH 100
typedef struct
{
gdouble radius;
@ -38,6 +36,12 @@ typedef struct
gint vertical;
} BlurValues;
typedef struct
{
gdouble horizontal;
gdouble vertical;
} Blur2Values;
typedef struct
{
gint run;
@ -54,14 +58,15 @@ static void run (gchar *name,
GParam **return_vals);
static void gauss_rle (GDrawable *drawable,
gint horizontal,
gint vertical,
gdouble std_dev);
gdouble horizontal,
gdouble vertical);
/*
* Gaussian blur interface
*/
static gint gauss_rle_dialog (void);
static gint gauss_rle_dialog (void);
static gint gauss_rle2_dialog (gint32 image_ID,
GDrawable *drawable);
/*
* Gaussian blur helper functions
@ -75,6 +80,8 @@ static void run_length_encode (guchar * src,
static void gauss_ok_callback (GtkWidget *widget,
gpointer data);
static void gauss_entry_callback (GtkWidget *widget,
gpointer data);
GPlugInInfo PLUG_IN_INFO =
{
@ -91,6 +98,12 @@ static BlurValues bvals =
TRUE /* vertical blur */
};
static Blur2Values b2vals =
{
5.0, /* x radius */
5.0 /* y radius */
};
static BlurInterface bint =
{
FALSE /* run */
@ -111,23 +124,46 @@ query (void)
{ PARAM_INT32, "horizontal", "Blur in horizontal direction" },
{ PARAM_INT32, "vertical", "Blur in vertical direction" },
};
static GParamDef *return_vals = NULL;
static gint nargs = sizeof (args) / sizeof (args[0]);
static GParamDef args2[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_FLOAT, "horizontal", "Horizontal radius of gaussian blur (in pixels)" },
{ PARAM_FLOAT, "vertical", "Vertical radius of gaussian blur (in pixels)" }
};
static gint nargs2 = sizeof (args2) / sizeof (args2[0]);
static GParamDef *return_vals = NULL;
static gint nreturn_vals = 0;
INIT_I18N();
gimp_install_procedure ("plug_in_gauss_rle",
_("Applies a gaussian blur to the specified drawable."),
_("Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run. The RLE gaussian blurring performs most efficiently on computer-generated images or images with large areas of constant intensity. Values for radii less than 1.0 are invalid as they will generate spurious results."),
_("Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. Horizontal and vertical blurring can be independently invoked by specifying only one to run. The RLE gaussian blurring performs most efficiently on computer-generated images or images with large areas of constant intensity. Values for radii less than 1.0 are invalid as they would generate spurious results."),
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
N_("<Image>/Filters/Blur/Gaussian Blur (RLE)..."),
NULL,
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
gimp_install_procedure ("plug_in_gauss_rle2",
_("Applies a gaussian blur to the specified drawable."),
_("Applies a gaussian blur to the drawable, with specified radius of affect. The standard deviation of the normal distribution used to modify pixel values is calculated based on the supplied radius. This radius can be specified indepently on for the horizontal and the vertical direction. The RLE gaussian blurring performs most efficiently on computer-generated images or images with large areas of constant intensity. Values for radii less than 1.0 would generate spurious results. Therefore they are interpreted as 0.0, which means that the computation for this orientation is skipped."),
"Spencer Kimball, Peter Mattis & Sven Neumann",
"Spencer Kimball, Peter Mattis & Sven Neumann",
"1995-2000",
N_("<Image>/Filters/Blur/Gaussian Blur (RLE)..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs2, nreturn_vals,
args2, return_vals);
}
static void
@ -138,10 +174,10 @@ run (gchar *name,
GParam **return_vals)
{
static GParam values[1];
gint32 image_ID;
GDrawable *drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
gdouble radius, std_dev;
run_mode = param[0].data.d_int32;
@ -151,55 +187,97 @@ run (gchar *name,
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
switch (run_mode)
/* Get the specified image and drawable */
image_ID = param[1].data.d_image;
drawable = gimp_drawable_get (param[2].data.d_drawable);
if (strcmp (name, "plug_in_gauss_rle") == 0) /* the old-fashioned way of calling it */
{
case RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_rle", &bvals);
switch (run_mode)
{
case RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_rle", &bvals);
/* First acquire information with a dialog */
if (! gauss_rle_dialog ())
return;
break;
case RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 6)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
bvals.radius = param[3].data.d_float;
bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
/* First acquire information with a dialog */
if (! gauss_rle_dialog ())
return;
break;
case RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 6)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
bvals.radius = param[3].data.d_float;
bvals.horizontal = (param[4].data.d_int32) ? TRUE : FALSE;
bvals.vertical = (param[5].data.d_int32) ? TRUE : FALSE;
}
if (status == STATUS_SUCCESS && (bvals.radius < 1.0))
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
INIT_I18N();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_rle", &bvals);
break;
default:
break;
}
if (!(bvals.horizontal || bvals.vertical))
{
gimp_message ( _("gauss_rle: you must specify either horizontal or vertical (or both)"));
status = STATUS_CALLING_ERROR;
}
if (status == STATUS_SUCCESS &&
(bvals.radius < 1.0))
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
INIT_I18N();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_rle", &bvals);
break;
default:
break;
}
if (!(bvals.horizontal || bvals.vertical))
}
else if (strcmp (name, "plug_in_gauss_rle2") == 0)
{
gimp_message ( _("gauss_rle: you must specify either horizontal or vertical (or both)"));
status = STATUS_CALLING_ERROR;
}
switch (run_mode)
{
case RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_rle2", &b2vals);
/* First acquire information with a dialog */
if (! gauss_rle2_dialog (image_ID, drawable))
return;
break;
case RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 5)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
b2vals.horizontal = param[3].data.d_float;
b2vals.vertical = param[4].data.d_float;
}
if (status == STATUS_SUCCESS && (b2vals.horizontal < 1.0 && b2vals.vertical < 1.0))
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
INIT_I18N();
/* Possibly retrieve data */
gimp_get_data ("plug_in_gauss_rle2", &b2vals);
break;
default:
break;
}
}
else
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_is_rgb (drawable->id) ||
gimp_drawable_is_gray (drawable->id))
@ -210,18 +288,27 @@ run (gchar *name,
gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) /
gimp_tile_width () + 1));
radius = fabs (bvals.radius) + 1.0;
std_dev = sqrt (-(radius * radius) / (2 * log (1.0 / 255.0)));
/* run the gaussian blur */
gauss_rle (drawable, bvals.horizontal, bvals.vertical, std_dev);
if (strcmp (name, "plug_in_gauss_rle") == 0)
{
gauss_rle (drawable, (bvals.horizontal ? bvals.radius : 0.0),
(bvals.vertical ? bvals.radius : 0.0));
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle", &bvals, sizeof (BlurValues));
}
else
{
gauss_rle (drawable, b2vals.horizontal, b2vals.vertical);
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle2", &b2vals, sizeof (Blur2Values));
}
if (run_mode != RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_gauss_rle", &bvals, sizeof (BlurValues));
}
else
{
@ -325,6 +412,115 @@ gauss_rle_dialog (void)
return bint.run;
}
static gint
gauss_rle2_dialog (gint32 image_ID,
GDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *spinbutton;
GtkObject *adj;
GtkWidget *frame;
GtkWidget *size;
GtkWidget *chain;
GUnit unit;
gdouble xres;
gdouble yres;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
argv[0] = g_strdup ("gauss_rle2");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
dlg = gimp_dialog_new (_("RLE Gaussian Blur"), "gauss_rle",
gimp_plugin_help_func, "filters/gauss_rle.html",
GTK_WIN_POS_MOUSE,
TRUE, FALSE, TRUE,
_("OK"), gauss_ok_callback,
NULL, NULL, NULL, TRUE, FALSE,
_("Cancel"), gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
NULL);
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
/* parameter settings */
frame = gtk_frame_new (_("Blur Radius"));
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
/* Get the image resolution and unit */
gimp_image_get_resolution (image_ID, &xres, &yres);
unit = gimp_image_get_unit (image_ID);
adj = gtk_adjustment_new (1, 0, 1, 1, 10, 1);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 2);
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
GTK_SHADOW_NONE);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
size = gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (size), 0, 4);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size), GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (size), spinbutton, 1, 2, 0, 1);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size), UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size), 1, yres, TRUE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size), 0,
0.0, (gdouble)(MAX (drawable->width, drawable->height)));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size), 1,
0.0, (gdouble)(MAX (drawable->width, drawable->height)));
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (size), 0, 1);
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (size), 1, 1);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size), 0, b2vals.horizontal);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size), 1, b2vals.vertical);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("Horizontal:"), 0, 0, 1.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("Vertical:"), 1, 0, 1.0);
/* put a chain_button to the right */
chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
if (b2vals.horizontal == b2vals.vertical)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), TRUE);
gtk_table_attach_defaults (GTK_TABLE (size), chain, 2, 3, 0, 2);
gtk_widget_show (chain);
gtk_signal_connect (GTK_OBJECT (size), "value_changed",
(GtkSignalFunc) gauss_entry_callback, chain);
gtk_signal_connect (GTK_OBJECT (size), "unit_changed",
(GtkSignalFunc) gauss_entry_callback, chain);
gtk_container_set_border_width (GTK_CONTAINER (size), 4);
gtk_container_add (GTK_CONTAINER (frame), size);
gtk_widget_show (spinbutton);
gtk_widget_show (size);
gtk_widget_show (frame);
gtk_widget_show (dlg);
gtk_object_set_data (GTK_OBJECT (dlg), "size", size);
gtk_main ();
gdk_flush ();
return bint.run;
}
/* Convert from separated to premultiplied alpha, on a single scan line. */
static void
multiply_alpha (guchar *buf,
@ -371,9 +567,8 @@ separate_alpha (guchar *buf,
static void
gauss_rle (GDrawable *drawable,
gint horz,
gint vert,
gdouble std_dev)
gdouble horz,
gdouble vert)
{
GPixelRgn src_rgn, dest_rgn;
gint width, height;
@ -383,25 +578,20 @@ gauss_rle (GDrawable *drawable,
guchar *src, *sp;
gint *buf, *bb;
gint pixels;
gint total;
gint total = 1;
gint x1, y1, x2, y2;
gint i, row, col, b;
gint start, end;
gint progress, max_progress;
gint *curve;
gint *sum;
gint *sum = NULL;
gint val;
gint length;
gint initial_p, initial_m;
gdouble std_dev;
curve = make_curve (std_dev, &length);
sum = malloc (sizeof (gint) * (2 * length + 1));
sum[0] = 0;
for (i = 1; i <= length*2; i++)
sum[i] = curve[i-length-1] + sum[i-1];
sum += length;
if (horz < 1.0 && vert < 1.0)
return;
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
@ -410,24 +600,37 @@ gauss_rle (GDrawable *drawable,
bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha(drawable->id);
buf = (gint *) malloc (sizeof (gint) * MAX (width, height) * 2);
total = sum[length] - sum[-length];
buf = g_new (gint, MAX (width, height) * 2);
/* allocate buffers for source and destination pixels */
src = (guchar *) malloc (MAX (width, height) * bytes);
dest = (guchar *) malloc (MAX (width, height) * bytes);
src = g_new (guchar, MAX (width, height) * bytes);
dest = g_new (guchar, MAX (width, height) * bytes);
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0, drawable->width, drawable->height, TRUE, TRUE);
progress = 0;
max_progress = (horz) ? width * height : 0;
max_progress += (vert) ? width * height : 0;
max_progress = (horz < 1.0 ) ? 0 : width * height * horz;
max_progress += (vert < 1.0 ) ? 0 : width * height * vert;
if (vert)
/* First the vertical pass */
if (vert >= 1.0)
{
for (col = 0; col < width; col++)
vert = fabs (vert) + 1.0;
std_dev = sqrt (-(vert * vert) / (2 * log (1.0 / 255.0)));
curve = make_curve (std_dev, &length);
sum = g_new (gint, 2 * length + 1);
sum[0] = 0;
for (i = 1; i <= length*2; i++)
sum[i] = curve[i-length-1] + sum[i-1];
sum += length;
total = sum[length] - sum[-length];
for (col = 0; col < width; col++)
{
gimp_pixel_rgn_get_col (&src_rgn, src, col + x1, y1, (y2 - y1));
@ -479,7 +682,7 @@ gauss_rle (GDrawable *drawable,
separate_alpha (dest, height, bytes);
gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1));
progress += height;
progress += height * vert;
if ((col % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
}
@ -488,13 +691,32 @@ gauss_rle (GDrawable *drawable,
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, TRUE);
}
if (horz)
/* Now the horizontal pass */
if (horz >= 1.0)
{
horz = fabs (horz) + 1.0;
if (horz != vert)
{
std_dev = sqrt (-(horz * horz) / (2 * log (1.0 / 255.0)));
curve = make_curve (std_dev, &length);
sum = g_new (gint, 2 * length + 1);
sum[0] = 0;
for (i = 1; i <= length*2; i++)
sum[i] = curve[i-length-1] + sum[i-1];
sum += length;
total = sum[length] - sum[-length];
}
for (row = 0; row < height; row++)
{
gimp_pixel_rgn_get_row (&src_rgn, src, x1, row + y1, (x2 - x1));
if (has_alpha && !vert)
if (has_alpha && vert < 1.0)
multiply_alpha (src, height, bytes);
sp = src;
@ -542,7 +764,7 @@ gauss_rle (GDrawable *drawable,
separate_alpha (dest, width, bytes);
gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1));
progress += width;
progress += width * horz;
if ((row % 5) == 0)
gimp_progress_update ((double) progress / (double) max_progress);
}
@ -554,9 +776,9 @@ gauss_rle (GDrawable *drawable,
gimp_drawable_update (drawable->id, x1, y1, (x2 - x1), (y2 - y1));
/* free buffers */
free (buf);
free (src);
free (dest);
g_free (buf);
g_free (src);
g_free (dest);
}
/*
@ -581,7 +803,7 @@ make_curve (gdouble sigma,
if ((n % 2) == 0)
n += 1;
curve = malloc (sizeof (gint) * n);
curve = g_new (gint, n);
*length = n / 2;
curve += *length;
@ -640,7 +862,51 @@ static void
gauss_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *size;
bint.run = TRUE;
size = gtk_object_get_data (GTK_OBJECT (data), "size");
if (size)
{
b2vals.horizontal = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 0);
b2vals.vertical = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size), 1);
}
gtk_widget_destroy (GTK_WIDGET (data));
}
static void
gauss_entry_callback (GtkWidget *widget,
gpointer data)
{
static gdouble x = -1.0;
static gdouble y = -1.0;
gdouble new_x;
gdouble new_y;
new_x = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
new_y = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
{
if (new_x != x)
{
y = new_y = x = new_x;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, y);
}
if (new_y != y)
{
x = new_x = y = new_y;
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, x);
}
}
else
{
if (new_x != x)
x = new_x;
if (new_y != y)
y = new_y;
}
}

View file

@ -492,7 +492,7 @@ dialog (gint32 image_ID,
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 4);
width = gimp_size_entry_new (3, /* number_of_fields */
UNIT_PIXEL, /* FIXME - use unit */
unit, /* unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
@ -500,6 +500,9 @@ dialog (gint32 image_ID,
SPIN_BUTTON_WIDTH, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
/* set the unit back to pixels, since most times we will want pixels */
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (width), UNIT_PIXEL);
/* set the resolution to the image resolution */
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 1, yres, TRUE);
@ -552,7 +555,7 @@ dialog (gint32 image_ID,
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 4);
space = gimp_size_entry_new (3, /* number_of_fields */
UNIT_PIXEL, /* FIXME - use unit */
unit, /* unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
@ -560,6 +563,8 @@ dialog (gint32 image_ID,
SPIN_BUTTON_WIDTH, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (space), UNIT_PIXEL);
/* set the resolution to the image resolution */
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 1, yres, TRUE);
@ -609,7 +614,7 @@ dialog (gint32 image_ID,
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 4);
offset = gimp_size_entry_new (3, /* number_of_fields */
UNIT_PIXEL, /* FIXME - use unit */
unit, /* unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
@ -617,6 +622,8 @@ dialog (gint32 image_ID,
SPIN_BUTTON_WIDTH, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (offset), UNIT_PIXEL);
/* set the resolution to the image resolution */
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 1, yres, TRUE);

View file

@ -267,15 +267,18 @@ noisify (GDrawable *drawable)
if (nvals.independent == TRUE)
noise = (gint) (nvals.noise[b] * gauss() * 127);
p = src[b] + noise;
if (p < 0)
p = 0;
else if (p > 255)
p = 255;
if (nvals.noise[b] != 0)
dest[b] = p;
if (nvals.noise[b] > 0.0)
{
p = src[b] + noise;
if (p < 0)
p = 0;
else if (p > 255)
p = 255;
dest[b] = p;
}
else
dest[b] = src[b];
}
src += src_rgn.bpp;
dest += dest_rgn.bpp;

View file

@ -28,7 +28,9 @@ EXTRA_DIST = \
iter_ALT/gen/plug_in_flarefx_iter_ALT.inc \
iter_ALT/gen/plug_in_fractal_trace_iter_ALT.inc \
iter_ALT/gen/plug_in_gauss_iir_iter_ALT.inc \
iter_ALT/gen/plug_in_gauss_iir2_iter_ALT.inc \
iter_ALT/gen/plug_in_gauss_rle_iter_ALT.inc \
iter_ALT/gen/plug_in_gauss_rle2_iter_ALT.inc \
iter_ALT/gen/plug_in_gfig_iter_ALT.inc \
iter_ALT/gen/plug_in_glasstile_iter_ALT.inc \
iter_ALT/gen/plug_in_grid_iter_ALT.inc \

View file

@ -454,7 +454,9 @@ static void p_delta_LightSettings(t_LightSettings *val, t_LightSettings *val_fro
#include "iter_ALT/gen/plug_in_flarefx_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_fractal_trace_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_gauss_iir_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_gauss_iir2_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_gauss_rle_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_gauss_rle2_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_gfig_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_glasstile_iter_ALT.inc"
#include "iter_ALT/gen/plug_in_grid_iter_ALT.inc"
@ -546,7 +548,9 @@ static t_iter_ALT_tab g_iter_ALT_tab[] =
, { "plug_in_flarefx", p_plug_in_flarefx_iter_ALT }
, { "plug_in_fractal_trace", p_plug_in_fractal_trace_iter_ALT }
, { "plug_in_gauss_iir", p_plug_in_gauss_iir_iter_ALT }
, { "plug_in_gauss_iir2", p_plug_in_gauss_iir2_iter_ALT }
, { "plug_in_gauss_rle", p_plug_in_gauss_rle_iter_ALT }
, { "plug_in_gauss_rle2", p_plug_in_gauss_rle2_iter_ALT }
, { "plug_in_gfig", p_plug_in_gfig_iter_ALT }
, { "plug_in_gflare", p_plug_in_gflare_iter_ALT }
, { "plug_in_glasstile", p_plug_in_glasstile_iter_ALT }

View file

@ -0,0 +1,35 @@
/* ----------------------------------------------------------------------
* p_plug_in_gauss_iir2_iter_ALT
* ----------------------------------------------------------------------
*/
gint p_plug_in_gauss_iir2_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdouble current_step, gint32 len_struct)
{
typedef struct t_plug_in_gauss_iir2_Vals
{
gdouble horizontal;
gdouble vertical;
} t_plug_in_gauss_iir2_Vals;
t_plug_in_gauss_iir2_Vals buf, *buf_from, *buf_to;
if(len_struct != sizeof(t_plug_in_gauss_iir2_Vals))
{
fprintf(stderr, "ERROR: p_plug_in_gauss_iir2_iter_ALT stored Data missmatch in size %d != %d\n",
(int)len_struct, sizeof(t_plug_in_gauss_iir2_Vals) );
return -1; /* ERROR */
}
gimp_get_data("plug_in_gauss_iir2_ITER_FROM", g_plugin_data_from);
gimp_get_data("plug_in_gauss_iir2_ITER_TO", g_plugin_data_to);
buf_from = (t_plug_in_gauss_iir2_Vals *)&g_plugin_data_from[0];
buf_to = (t_plug_in_gauss_iir2_Vals *)&g_plugin_data_to[0];
memcpy(&buf, buf_from, sizeof(buf));
p_delta_gdouble(&buf.horizontal, buf_from->horizontal, buf_to->horizontal, total_steps, current_step);
p_delta_gdouble(&buf.vertical, buf_from->vertical, buf_to->vertical, total_steps, current_step);
gimp_set_data("plug_in_gauss_iir2", &buf, sizeof(buf));
return 0; /* OK */
}

View file

@ -0,0 +1,35 @@
/* ----------------------------------------------------------------------
* p_plug_in_gauss_rle2_iter_ALT
* ----------------------------------------------------------------------
*/
gint p_plug_in_gauss_rle2_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdouble current_step, gint32 len_struct)
{
typedef struct t_plug_in_gauss_rle2_Vals
{
gdouble horizontal;
gdouble vertical;
} t_plug_in_gauss_rle2_Vals;
t_plug_in_gauss_rle2_Vals buf, *buf_from, *buf_to;
if(len_struct != sizeof(t_plug_in_gauss_rle2_Vals))
{
fprintf(stderr, "ERROR: p_plug_in_gauss_rle2_iter_ALT stored Data missmatch in size %d != %d\n",
(int)len_struct, sizeof(t_plug_in_gauss_rle2_Vals) );
return -1; /* ERROR */
}
gimp_get_data("plug_in_gauss_rle2_ITER_FROM", g_plugin_data_from);
gimp_get_data("plug_in_gauss_rle2_ITER_TO", g_plugin_data_to);
buf_from = (t_plug_in_gauss_rle2_Vals *)&g_plugin_data_from[0];
buf_to = (t_plug_in_gauss_rle2_Vals *)&g_plugin_data_to[0];
memcpy(&buf, buf_from, sizeof(buf));
p_delta_gdouble(&buf.horizontal, buf_from->horizontal, buf_to->horizontal, total_steps, current_step);
p_delta_gdouble(&buf.vertical, buf_from->vertical, buf_to->vertical, total_steps, current_step);
gimp_set_data("plug_in_gauss_rle2", &buf, sizeof(buf));
return 0; /* OK */
}