renamed the "run_mode" parameters to "unused" and remode the rum_mode

2004-09-29  Michael Natterer  <mitch@gimp.org>

	* libgimp/gimpregioniterator.[ch]: renamed the "run_mode"
	parameters to "unused" and remode the rum_mode member from the
	private GimpRgbIterator struct.

	* plug-ins/common/AlienMap2.c
	* plug-ins/common/autostretch_hsv.c
	* plug-ins/common/c_astretch.c
	* plug-ins/common/color_enhance.c
	* plug-ins/common/colorify.c
	* plug-ins/common/colortoalpha.c
	* plug-ins/common/gradmap.c
	* plug-ins/common/mapcolor.c
	* plug-ins/common/max_rgb.c
	* plug-ins/common/noisify.c
	* plug-ins/common/normalize.c
	* plug-ins/common/sample_colorize.c
	* plug-ins/common/scatter_hsv.c
	* plug-ins/common/semiflatten.c
	* plug-ins/common/threshold_alpha.c
	* plug-ins/common/vinvert.c
	* plug-ins/fp/fp.c: made "run_mode" a private variable of run()
	and pass 0 to gimp_rgn_iterate*(). Minor cleanups.
This commit is contained in:
Michael Natterer 2004-09-28 23:08:17 +00:00 committed by Michael Natterer
parent 02ced0cd67
commit a8f621fe9e
21 changed files with 219 additions and 210 deletions

View File

@ -1,3 +1,28 @@
2004-09-29 Michael Natterer <mitch@gimp.org>
* libgimp/gimpregioniterator.[ch]: renamed the "run_mode"
parameters to "unused" and remode the rum_mode member from the
private GimpRgbIterator struct.
* plug-ins/common/AlienMap2.c
* plug-ins/common/autostretch_hsv.c
* plug-ins/common/c_astretch.c
* plug-ins/common/color_enhance.c
* plug-ins/common/colorify.c
* plug-ins/common/colortoalpha.c
* plug-ins/common/gradmap.c
* plug-ins/common/mapcolor.c
* plug-ins/common/max_rgb.c
* plug-ins/common/noisify.c
* plug-ins/common/normalize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/semiflatten.c
* plug-ins/common/threshold_alpha.c
* plug-ins/common/vinvert.c
* plug-ins/fp/fp.c: made "run_mode" a private variable of run()
and pass 0 to gimp_rgn_iterate*(). Minor cleanups.
2004-09-29 Sven Neumann <sven@gimp.org>
* libgimp/gimp.def

View File

@ -39,7 +39,6 @@ struct _GimpRgnIterator
{
GimpDrawable *drawable;
gint x1, y1, x2, y2;
GimpRunMode run_mode;
};
@ -71,12 +70,12 @@ static void gimp_rgn_render_region (const GimpPixelRgn *srcPR,
**/
GimpRgnIterator *
gimp_rgn_iterator_new (GimpDrawable *drawable,
GimpRunMode run_mode)
GimpRunMode unused)
{
GimpRgnIterator *iter = g_new (GimpRgnIterator, 1);
iter->drawable = drawable;
iter->run_mode = run_mode;
gimp_drawable_mask_bounds (drawable->drawable_id,
&iter->x1, &iter->y1,
&iter->x2, &iter->y2);
@ -196,7 +195,7 @@ gimp_rgn_iterator_dest (GimpRgnIterator *iter,
void
gimp_rgn_iterate1 (GimpDrawable *drawable,
GimpRunMode run_mode,
GimpRunMode unused,
GimpRgnFunc1 func,
gpointer data)
{
@ -247,7 +246,7 @@ gimp_rgn_iterate1 (GimpDrawable *drawable,
void
gimp_rgn_iterate2 (GimpDrawable *drawable,
GimpRunMode run_mode,
GimpRunMode unused,
GimpRgnFunc2 func,
gpointer data)
{

View File

@ -56,29 +56,29 @@ typedef void (* GimpRgnFuncSrcDest) (gint x,
gint bpp,
gpointer data);
GimpRgnIterator * gimp_rgn_iterator_new (GimpDrawable *drawable,
GimpRunMode run_mode);
void gimp_rgn_iterator_free (GimpRgnIterator *iter);
void gimp_rgn_iterator_src (GimpRgnIterator *iter,
GimpRgnFuncSrc func,
gpointer data);
void gimp_rgn_iterator_dest (GimpRgnIterator *iter,
GimpRgnFuncDest func,
gpointer data);
void gimp_rgn_iterator_src_dest (GimpRgnIterator *iter,
GimpRgnFuncSrcDest func,
gpointer data);
GimpRgnIterator * gimp_rgn_iterator_new (GimpDrawable *drawable,
GimpRunMode unused);
void gimp_rgn_iterator_free (GimpRgnIterator *iter);
void gimp_rgn_iterator_src (GimpRgnIterator *iter,
GimpRgnFuncSrc func,
gpointer data);
void gimp_rgn_iterator_dest (GimpRgnIterator *iter,
GimpRgnFuncDest func,
gpointer data);
void gimp_rgn_iterator_src_dest (GimpRgnIterator *iter,
GimpRgnFuncSrcDest func,
gpointer data);
void gimp_rgn_iterate1 (GimpDrawable *drawable,
GimpRunMode run_mode,
GimpRgnFunc1 func,
gpointer data);
void gimp_rgn_iterate1 (GimpDrawable *drawable,
GimpRunMode unused,
GimpRgnFunc1 func,
gpointer data);
void gimp_rgn_iterate2 (GimpDrawable *drawable,
GimpRunMode run_mode,
GimpRgnFunc2 func,
gpointer data);
void gimp_rgn_iterate2 (GimpDrawable *drawable,
GimpRunMode unused,
GimpRgnFunc2 func,
gpointer data);
G_END_DECLS

View File

@ -100,8 +100,6 @@ static void alienmap2_get_label_size (void);
/***** Variables *****/
static GimpRunMode run_mode;
#define PREVIEW_SIZE 128
static GtkWidget *preview;
static gint preview_width, preview_height, preview_bpp;
@ -275,6 +273,7 @@ run (const gchar *name,
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
INIT_I18N ();
@ -391,7 +390,7 @@ alienmap2_func (const guchar *src,
static void
alienmap2 (GimpDrawable *drawable)
{
gimp_rgn_iterate2 (drawable, run_mode, alienmap2_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, alienmap2_func, NULL);
}
static gint

View File

@ -40,7 +40,6 @@ static void run (const gchar *name,
static void autostretch_hsv (GimpDrawable *drawable);
static void indexed_autostretch_hsv (gint32 image_ID);
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
@ -58,8 +57,8 @@ query (void)
{
static GimpParamDef args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
};
@ -98,6 +97,7 @@ run (const gchar *name,
static GimpParam values[1];
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
gint32 image_ID;
@ -149,7 +149,7 @@ typedef struct {
double vlo;
} AutostretchData;
static void
static void
find_max (guchar *src, gint bpp, AutostretchData *data)
{
double h, s, v;
@ -161,8 +161,8 @@ find_max (guchar *src, gint bpp, AutostretchData *data)
if (v < data->vlo) data->vlo = v;
}
static void
autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
static void
autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
AutostretchData *data)
{
double h, s, v;
@ -173,7 +173,7 @@ autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
if (data->vhi != data->vlo)
v = (v - data->vlo) / (data->vhi - data->vlo);
gimp_hsv_to_rgb4(dest, h, s, v);
if (bpp == 4)
dest[3] = src[3];
}
@ -211,9 +211,7 @@ autostretch_hsv (GimpDrawable *drawable)
{
AutostretchData data = {0.0, 1.0, 0.0, 1.0};
gimp_rgn_iterate1 (drawable, run_mode, (GimpRgnFunc1) find_max, &data);
gimp_rgn_iterate2 (drawable, run_mode, (GimpRgnFunc2) autostretch_hsv_func,
gimp_rgn_iterate1 (drawable, 0 /* unused */, (GimpRgnFunc1) find_max, &data);
gimp_rgn_iterate2 (drawable, 0 /* unused */, (GimpRgnFunc2) autostretch_hsv_func,
&data);
}

View File

@ -49,7 +49,6 @@ GimpPlugInInfo PLUG_IN_INFO =
run, /* run_proc */
};
static GimpRunMode run_mode;
MAIN ()
@ -58,8 +57,8 @@ query (void)
{
static GimpParamDef args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
};
@ -96,8 +95,8 @@ run (const gchar *name,
static GimpParam values[1];
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
GimpRunMode run_mode;
gint32 image_ID;
INIT_I18N();
@ -235,7 +234,7 @@ c_astretch (GimpDrawable *drawable)
param.min[0] = param.min[1] = param.min[2] = 255;
param.max[0] = param.max[1] = param.max[2] = 0;
gimp_rgn_iterate1 (drawable, run_mode, find_min_max, &param);
gimp_rgn_iterate1 (drawable, 0 /* unused */, find_min_max, &param);
/* Calculate LUTs with stretched contrast */
for (b = 0; b < param.alpha; b++)
@ -250,6 +249,6 @@ c_astretch (GimpDrawable *drawable)
param.lut[param.min[b]][b] = param.min[b];
}
gimp_rgn_iterate2 (drawable, run_mode, c_astretch_func, &param);
gimp_rgn_iterate2 (drawable, 0 /* unused */, c_astretch_func, &param);
}

View File

@ -28,7 +28,6 @@
#include "libgimp/stdplugins-intl.h"
static GimpRunMode run_mode;
/* Declare local functions.
*/
@ -59,8 +58,8 @@ query (void)
{
static GimpParamDef args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
};
@ -98,8 +97,8 @@ run (const gchar *name,
static GimpParam values[1];
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
GimpRunMode run_mode;
gint32 image_ID;
INIT_I18N();
@ -285,7 +284,6 @@ Color_Enhance (GimpDrawable *drawable)
param.vhi = 0.0;
param.vlo = 1.0;
gimp_rgn_iterate1 (drawable, run_mode, find_vhi_vlo, &param);
gimp_rgn_iterate2 (drawable, run_mode, color_enhance_func, &param);
gimp_rgn_iterate1 (drawable, 0 /* unused */, find_vhi_vlo, &param);
gimp_rgn_iterate2 (drawable, 0 /* unused */, color_enhance_func, &param);
}

View File

@ -66,8 +66,6 @@ static GimpRGB button_color[] =
{ 1.0, 1.0, 1.0, 1.0 },
};
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
NULL,
@ -93,10 +91,10 @@ query (void)
{
static GimpParamDef args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_COLOR, "color", "Color to apply"}
{ GIMP_PDB_COLOR, "color", "Color to apply"}
};
gimp_install_procedure (PLUG_IN_NAME,
@ -126,6 +124,7 @@ run (const gchar *name,
GimpPDBStatusType status;
static GimpParam values[1];
GimpDrawable *drawable;
GimpRunMode run_mode;
INIT_I18N ();
@ -175,9 +174,7 @@ run (const gchar *name,
gimp_set_data (PLUG_IN_NAME, &cvals, sizeof (ColorifyVals));
if (run_mode != GIMP_RUN_NONINTERACTIVE)
{
gimp_displays_flush ();
}
gimp_displays_flush ();
}
gimp_drawable_detach (drawable);
@ -219,7 +216,7 @@ colorify (GimpDrawable *drawable)
final_blue_lookup[i] = i * cvals.color.b;
}
gimp_rgn_iterate2 (drawable, run_mode, colorify_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, colorify_func, NULL);
}
static gboolean

View File

@ -59,8 +59,6 @@ static void toalpha (GimpDrawable *drawable);
static gboolean colortoalpha_dialog (GimpDrawable *drawable);
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
@ -119,6 +117,7 @@ run (const gchar *name,
GimpDrawable *drawable;
gint32 image_ID;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
run_mode = param[0].data.d_int32;
@ -301,7 +300,7 @@ toalpha_func (const guchar *src,
static void
toalpha (GimpDrawable *drawable)
{
gimp_rgn_iterate2 (drawable, run_mode, toalpha_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, toalpha_func, NULL);
}
static gboolean

View File

@ -284,7 +284,6 @@ static FP_Params Current =
};
static GimpDrawable *drawable, *mask;
static GimpRunMode run_mode;
static void query (void);
static void run (const gchar *name,
@ -340,6 +339,7 @@ run (const gchar *name,
{
GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
@ -373,7 +373,8 @@ run (const gchar *name,
values[0].data.d_status = status;
if (status==GIMP_PDB_SUCCESS)
if (status == GIMP_PDB_SUCCESS)
gimp_drawable_detach (drawable);
}
@ -456,7 +457,7 @@ fp_func (const guchar *src,
static void
fp (GimpDrawable *drawable)
{
gimp_rgn_iterate2 (drawable, run_mode, fp_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, fp_func, NULL);
}
/***********************************************************/

View File

@ -32,65 +32,62 @@ static char rcsid[] = "$Id$";
/* Some useful macros */
#define NSAMPLES 256
#define TILE_CACHE_SIZE 32
#define LUMINOSITY(X) (GIMP_RGB_INTENSITY (X[0], X[1], X[2]) + 0.5)
static GimpRunMode run_mode;
#define NSAMPLES 256
#define LUMINOSITY(X) (GIMP_RGB_INTENSITY (X[0], X[1], X[2]) + 0.5)
/* Declare a local function.
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void gradmap (GimpDrawable *drawable);
static guchar * get_samples (GimpDrawable *drawable );
static void gradmap (GimpDrawable *drawable);
static guchar * get_samples (GimpDrawable *drawable);
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
run, /* run_proc */
};
MAIN ()
static void
query()
query (void)
{
static GimpParamDef args[]=
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
};
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
};
gimp_install_procedure ("plug_in_gradmap",
"Map the contents of the specified drawable with "
"active gradient",
" This plug-in maps the contents of the specified "
"drawable with active gradient. It calculates "
"luminosity of each pixel and replaces the pixel "
"by the sample of active gradient at the position "
"proportional to that luminosity. Complete black "
"pixel becomes the leftmost color of the gradient, "
"and complete white becomes the rightmost. Works on "
"both Grayscale and RGB image with/without alpha "
"channel.",
"Eiichi Takamori",
"Eiichi Takamori",
"1997",
N_("_Gradient Map"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
"active gradient",
"This plug-in maps the contents of the specified "
"drawable with active gradient. It calculates "
"luminosity of each pixel and replaces the pixel "
"by the sample of active gradient at the position "
"proportional to that luminosity. Complete black "
"pixel becomes the leftmost color of the gradient, "
"and complete white becomes the rightmost. Works on "
"both Grayscale and RGB image with/without alpha "
"channel.",
"Eiichi Takamori",
"Eiichi Takamori",
"1997",
N_("_Gradient Map"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_gradmap",
N_("<Image>/Filters/Colors/Map"));
@ -106,6 +103,7 @@ run (const gchar *name,
static GimpParam values[1];
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
run_mode = param[0].data.d_int32;
@ -120,17 +118,17 @@ run (const gchar *name,
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Make sure that the drawable is gray or RGB color */
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
gimp_drawable_is_gray (drawable->drawable_id))
{
gimp_progress_init (_("Gradient Map..."));
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
gradmap (drawable);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
gimp_displays_flush ();
}
else
{
@ -143,22 +141,23 @@ run (const gchar *name,
gimp_drawable_detach (drawable);
}
typedef struct {
guchar *samples;
gboolean is_rgb;
gboolean has_alpha;
} GradMapParam_t;
typedef struct
{
guchar *samples;
gboolean is_rgb;
gboolean has_alpha;
} GradMapParam;
static void
gradmap_func (const guchar *src,
guchar *dest,
gint bpp,
gpointer data)
guchar *dest,
gint bpp,
gpointer data)
{
GradMapParam_t *param = (GradMapParam_t*) data;
gint lum;
gint b;
guchar *samp;
GradMapParam *param = data;
gint lum;
gint b;
guchar *samp;
lum = (param->is_rgb) ? LUMINOSITY (src) : src[0];
samp = &param->samples[lum * bpp];
@ -166,26 +165,26 @@ gradmap_func (const guchar *src,
if (param->has_alpha)
{
for (b = 0; b < bpp - 1; b++)
dest[b] = samp[b];
dest[b] = samp[b];
dest[b] = ((guint)samp[b] * (guint)src[b]) / 255;
}
else
{
for (b = 0; b < bpp; b++)
dest[b] = samp[b];
dest[b] = samp[b];
}
}
static void
gradmap (GimpDrawable *drawable)
{
GradMapParam_t param;
GradMapParam param;
param.is_rgb = gimp_drawable_is_rgb (drawable->drawable_id);
param.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
param.samples = get_samples (drawable);
gimp_rgn_iterate2 (drawable, run_mode, gradmap_func, &param);
gimp_rgn_iterate2 (drawable, 0 /* unused */, gradmap_func, &param);
}
/*
@ -195,20 +194,20 @@ gradmap (GimpDrawable *drawable)
static guchar *
get_samples (GimpDrawable *drawable)
{
gdouble *f_samples, *f_samp; /* float samples */
guchar *b_samples, *b_samp; /* byte samples */
gint bpp, color, has_alpha, alpha;
gint i, j;
gdouble *f_samples, *f_samp; /* float samples */
guchar *b_samples, *b_samp; /* byte samples */
gint bpp, color, has_alpha, alpha;
gint i, j;
#ifdef __GNUC__
#warning FIXME: "reverse" hardcoded to FALSE.
#endif
f_samples = gimp_gradients_sample_uniform (NSAMPLES, FALSE);
bpp = gimp_drawable_bpp (drawable->drawable_id);
color = gimp_drawable_is_rgb (drawable->drawable_id);
bpp = gimp_drawable_bpp (drawable->drawable_id);
color = gimp_drawable_is_rgb (drawable->drawable_id);
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
alpha = (has_alpha ? bpp - 1 : bpp);
alpha = (has_alpha ? bpp - 1 : bpp);
b_samples = g_new (guchar, NSAMPLES * bpp);
@ -217,15 +216,16 @@ get_samples (GimpDrawable *drawable)
b_samp = &b_samples[i * bpp];
f_samp = &f_samples[i * 4];
if (color)
for (j = 0; j < 3; j++)
b_samp[j] = f_samp[j] * 255;
for (j = 0; j < 3; j++)
b_samp[j] = f_samp[j] * 255;
else
b_samp[0] = LUMINOSITY (f_samp) * 255;
b_samp[0] = LUMINOSITY (f_samp) * 255;
if (has_alpha)
b_samp[alpha] = f_samp[3] * 255;
b_samp[alpha] = f_samp[3] * 255;
}
g_free (f_samples);
return b_samples;
}

View File

@ -29,6 +29,7 @@
* Fix problem with divide by zero
* V 1.03,neo, 22-May-00: Fixed divide by zero in preview code.
*/
#define VERSIO 1.03
static char dversio[] = "v1.03 22-May-00";
static char ident[] = "@(#) GIMP mapcolor plug-in v1.03 22-May-00";
@ -131,9 +132,6 @@ static void add_color_button (gint csel_index,
static void color_mapping (GimpDrawable *drawable);
/* The run mode */
static GimpRunMode l_run_mode;
static gchar *csel_title[4] =
{
N_("First Source Color"),
@ -216,15 +214,15 @@ img_preview_create_from_drawable (guint maxsize,
gint32 drawable_ID)
{
GimpDrawable *drw;
GimpPixelRgn pixel_rgn;
guint drw_width, drw_height;
guint prv_width, prv_height;
gint src_x, src_y, x, y;
guchar *prv_data, *img_data, *cu_row;
gdouble xfactor, yfactor;
gint tile_height, row_start, row_end;
gint bpp;
IMG_PREVIEW *ip;
GimpPixelRgn pixel_rgn;
guint drw_width, drw_height;
guint prv_width, prv_height;
gint src_x, src_y, x, y;
guchar *prv_data, *img_data, *cu_row;
gdouble xfactor, yfactor;
gint tile_height, row_start, row_end;
gint bpp;
IMG_PREVIEW *ip;
drw_width = gimp_drawable_width (drawable_ID);
drw_height = gimp_drawable_height (drawable_ID);
@ -300,21 +298,21 @@ query (void)
{
static GimpParamDef adjust_args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable to adjust" }
};
static GimpParamDef map_args[] =
{
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable where colors are to map" },
{ GIMP_PDB_COLOR, "srccolor_1", "First source color" },
{ GIMP_PDB_COLOR, "srccolor_2", "Second source color" },
{ GIMP_PDB_COLOR, "dstcolor_1", "First destination color" },
{ GIMP_PDB_COLOR, "dstcolor_2", "Second destination color" },
{ GIMP_PDB_INT32, "map_mode", "Mapping mode (0: linear, others reserved)" }
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable where colors are to map" },
{ GIMP_PDB_COLOR, "srccolor_1", "First source color" },
{ GIMP_PDB_COLOR, "srccolor_2", "Second source color" },
{ GIMP_PDB_COLOR, "dstcolor_1", "First destination color" },
{ GIMP_PDB_COLOR, "dstcolor_2", "Second destination color" },
{ GIMP_PDB_INT32, "map_mode", "Mapping mode (0: linear, others reserved)" }
};
gimp_install_procedure ("plug_in_color_adjust",
@ -368,14 +366,11 @@ run (const gchar *name,
GimpRunMode run_mode;
GimpDrawable *drawable = NULL;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
guchar *c;
gint j;
c = (guchar *) ident;
INIT_I18N ();
l_run_mode = run_mode = param[0].data.d_int32;
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
@ -474,7 +469,9 @@ run (const gchar *name,
if ((status == GIMP_PDB_SUCCESS) && (run_mode != GIMP_RUN_NONINTERACTIVE))
gimp_displays_flush ();
if (drawable != NULL) gimp_drawable_detach (drawable);
if (drawable != NULL)
gimp_drawable_detach (drawable);
values[0].data.d_status = status;
}
@ -484,10 +481,10 @@ update_img_preview (void)
{
IMG_PREVIEW *dst_ip = plinterface.map_preview;
IMG_PREVIEW *src_ip = plinterface.img_preview;
GtkWidget *preview = plinterface.preview;
guchar redmap[256], greenmap[256], bluemap[256];
guchar *src, *dst;
gint j;
GtkWidget *preview = plinterface.preview;
guchar redmap[256], greenmap[256], bluemap[256];
guchar *src, *dst;
gint j;
if ((dst_ip == NULL) || (src_ip == NULL)) return;
@ -716,5 +713,5 @@ color_mapping (GimpDrawable *drawable)
plvals.map_mode,
redmap, greenmap, bluemap);
gimp_rgn_iterate2 (drawable, l_run_mode, mapcolor_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, mapcolor_func, NULL);
}

View File

@ -82,8 +82,6 @@ static ValueType pvals =
MAX_CHANNELS
};
static GimpRunMode run_mode;
#define PREVIEW_SIZE 128
static GtkWidget *preview;
static gint preview_width, preview_height, preview_bpp;
@ -131,6 +129,7 @@ run (const gchar *name,
GimpDrawable *drawable;
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
GimpRunMode run_mode;
run_mode = param[0].data.d_int32;
drawable = gimp_drawable_get (param[2].data.d_drawable);
@ -228,14 +227,15 @@ main_function (GimpDrawable *drawable,
gint i;
guchar *buffer = g_new (guchar,
preview_width * preview_height * preview_bpp);
for (i=0 ; i<preview_width * preview_height ; i++)
{
max_rgb_func (preview_cache + i * preview_bpp,
buffer + i * preview_bpp,
preview_bpp,
&param);
}
for (i = 0; i<preview_width * preview_height; i++)
{
max_rgb_func (preview_cache + i * preview_bpp,
buffer + i * preview_bpp,
preview_bpp,
&param);
}
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
0, 0, preview_width, preview_height,
gimp_drawable_type (drawable->drawable_id),
@ -247,7 +247,7 @@ main_function (GimpDrawable *drawable,
{
gimp_progress_init ( _("Max RGB..."));
gimp_rgn_iterate2 (drawable, run_mode, max_rgb_func, &param);
gimp_rgn_iterate2 (drawable, 0 /* unused */, max_rgb_func, &param);
gimp_drawable_detach (drawable);
}

View File

@ -106,7 +106,6 @@ static NoisifyInterface noise_int =
{ NULL, NULL, NULL, NULL }
};
static GimpRunMode run_mode;
MAIN ()
@ -151,6 +150,7 @@ run (const gchar *name,
static GimpParam values[1];
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
run_mode = param[0].data.d_int32;
@ -217,7 +217,8 @@ run (const gchar *name,
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
/* compute the luminosity which exceeds the luminosity threshold */
gimp_rgn_iterate2 (drawable, run_mode, noisify_func, gr);
gimp_rgn_iterate2 (drawable, 0 /* unused */, noisify_func, gr);
g_rand_free (gr);
if (run_mode != GIMP_RUN_NONINTERACTIVE)

View File

@ -58,8 +58,6 @@ GimpPlugInInfo PLUG_IN_INFO =
run, /* run_proc */
};
static GimpRunMode run_mode;
MAIN ()
@ -107,8 +105,8 @@ run (const gchar *name,
static GimpParam values[1];
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
GimpRunMode run_mode;
gint32 image_ID;
INIT_I18N ();
@ -197,7 +195,7 @@ typedef struct {
gboolean has_alpha;
} NormalizeParam_t;
static void
static void
find_min_max (const guchar *src,
gint bpp,
gpointer data)
@ -217,7 +215,7 @@ find_min_max (const guchar *src,
}
}
static void
static void
normalize_func (const guchar *src,
guchar *dest,
gint bpp,
@ -228,7 +226,7 @@ normalize_func (const guchar *src,
for (b = 0; b < param->alpha; b++)
dest[b] = param->lut[src[b]];
if (param->has_alpha)
dest[param->alpha] = src[param->alpha];
}
@ -245,7 +243,7 @@ normalize (GimpDrawable *drawable)
param.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
param.alpha = (param.has_alpha) ? drawable->bpp - 1 : drawable->bpp;
gimp_rgn_iterate1 (drawable, run_mode, find_min_max, &param);
gimp_rgn_iterate1 (drawable, 0 /* unused */, find_min_max, &param);
/* Calculate LUT */
@ -257,6 +255,6 @@ normalize (GimpDrawable *drawable)
else
param.lut[(gint)param.min] = param.min;
gimp_rgn_iterate2 (drawable, run_mode, normalize_func, &param);
gimp_rgn_iterate2 (drawable, 0 /* unused */, normalize_func, &param);
}

View File

@ -176,7 +176,6 @@ typedef struct
* Some globals
*/
static GimpRunMode run_mode;
static t_samp_interface g_di; /* global dialog interface varables */
static t_values g_values = { -1, -1, 1, 1, 0, 1, 0, 255, 1.0, 0, 255, 5.5 };
static t_samp_table_elem g_lum_tab[256];
@ -315,6 +314,7 @@ run (const gchar *name,
GimpDrawable *dst_drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
const gchar *l_env;
GimpRunMode run_mode;
INIT_I18N ();
@ -2992,7 +2992,7 @@ p_colorize_drawable (gint32 drawable_id)
if (g_show_progress)
gimp_progress_init (_("Remap Colorized..."));
gimp_rgn_iterate2 (drawable, run_mode, colorize_func,
gimp_rgn_iterate2 (drawable, 0 /* unused */, colorize_func,
GINT_TO_POINTER (has_alpha));
if (g_show_progress)

View File

@ -71,7 +71,6 @@ static void scatter_hsv_iscale_update (GtkAdjustment *adjustment,
static gint preview_width = PREVIEW_WIDTH;
static gint preview_height = PREVIEW_HEIGHT;
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
@ -150,6 +149,7 @@ run (const gchar *name,
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
GimpRunMode run_mode;
INIT_I18N ();
@ -231,7 +231,7 @@ scatter_hsv (gint32 drawable_id)
gimp_progress_init (_("Scattering HSV..."));
gimp_rgn_iterate2 (drawable, run_mode, scatter_hsv_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, scatter_hsv_func, NULL);
gimp_drawable_detach (drawable);

View File

@ -44,8 +44,6 @@ static void semiflatten (GimpDrawable *drawable);
static guchar bgred, bggreen, bgblue;
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
@ -100,6 +98,7 @@ run (const gchar *name,
GimpDrawable *drawable;
gint32 image_ID;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
@ -137,7 +136,7 @@ run (const gchar *name,
gimp_drawable_detach (drawable);
}
static void
static void
semiflatten_func (const guchar *src,
guchar *dest,
gint bpp,
@ -157,6 +156,6 @@ semiflatten (GimpDrawable *drawable)
gimp_context_get_background (&background);
gimp_rgb_get_uchar (&background, &bgred, &bggreen, &bgblue);
gimp_rgn_iterate2 (drawable, run_mode, semiflatten_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, semiflatten_func, NULL);
}

View File

@ -54,8 +54,6 @@ static GimpPDBStatusType threshold_alpha (gint32 drawable_id);
static gboolean threshold_alpha_dialog (void);
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
@ -113,6 +111,7 @@ run (const gchar *name,
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
gint drawable_id;
run_mode = param[0].data.d_int32;
@ -204,7 +203,7 @@ threshold_alpha (gint32 drawable_id)
gap = (gimp_drawable_is_rgb (drawable_id)) ? 3 : 1;
gimp_rgn_iterate2 (drawable, run_mode, threshold_alpha_func,
gimp_rgn_iterate2 (drawable, 0 /* unused */, threshold_alpha_func,
GINT_TO_POINTER(gap));
gimp_drawable_detach (drawable);

View File

@ -47,8 +47,6 @@ static void vinvert_render_row (const guchar *src,
gint bpp);
static GimpRunMode run_mode;
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
@ -104,6 +102,7 @@ run (const gchar *name,
GimpDrawable *drawable;
gint32 image_ID;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
run_mode = param[0].data.d_int32;
@ -208,5 +207,5 @@ vinvert_render_row (const guchar *src,
static void
vinvert (GimpDrawable *drawable)
{
gimp_rgn_iterate2 (drawable, run_mode, vinvert_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, vinvert_func, NULL);
}

View File

@ -284,7 +284,6 @@ static FP_Params Current =
};
static GimpDrawable *drawable, *mask;
static GimpRunMode run_mode;
static void query (void);
static void run (const gchar *name,
@ -340,6 +339,7 @@ run (const gchar *name,
{
GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
@ -373,7 +373,8 @@ run (const gchar *name,
values[0].data.d_status = status;
if (status==GIMP_PDB_SUCCESS)
if (status == GIMP_PDB_SUCCESS)
gimp_drawable_detach (drawable);
}
@ -456,7 +457,7 @@ fp_func (const guchar *src,
static void
fp (GimpDrawable *drawable)
{
gimp_rgn_iterate2 (drawable, run_mode, fp_func, NULL);
gimp_rgn_iterate2 (drawable, 0 /* unused */, fp_func, NULL);
}
/***********************************************************/