mirror of https://github.com/GNOME/gimp.git
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:
parent
02ced0cd67
commit
a8f621fe9e
25
ChangeLog
25
ChangeLog
|
@ -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>
|
2004-09-29 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* libgimp/gimp.def
|
* libgimp/gimp.def
|
||||||
|
|
|
@ -39,7 +39,6 @@ struct _GimpRgnIterator
|
||||||
{
|
{
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
gint x1, y1, x2, y2;
|
gint x1, y1, x2, y2;
|
||||||
GimpRunMode run_mode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,12 +70,12 @@ static void gimp_rgn_render_region (const GimpPixelRgn *srcPR,
|
||||||
**/
|
**/
|
||||||
GimpRgnIterator *
|
GimpRgnIterator *
|
||||||
gimp_rgn_iterator_new (GimpDrawable *drawable,
|
gimp_rgn_iterator_new (GimpDrawable *drawable,
|
||||||
GimpRunMode run_mode)
|
GimpRunMode unused)
|
||||||
{
|
{
|
||||||
GimpRgnIterator *iter = g_new (GimpRgnIterator, 1);
|
GimpRgnIterator *iter = g_new (GimpRgnIterator, 1);
|
||||||
|
|
||||||
iter->drawable = drawable;
|
iter->drawable = drawable;
|
||||||
iter->run_mode = run_mode;
|
|
||||||
gimp_drawable_mask_bounds (drawable->drawable_id,
|
gimp_drawable_mask_bounds (drawable->drawable_id,
|
||||||
&iter->x1, &iter->y1,
|
&iter->x1, &iter->y1,
|
||||||
&iter->x2, &iter->y2);
|
&iter->x2, &iter->y2);
|
||||||
|
@ -196,7 +195,7 @@ gimp_rgn_iterator_dest (GimpRgnIterator *iter,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_rgn_iterate1 (GimpDrawable *drawable,
|
gimp_rgn_iterate1 (GimpDrawable *drawable,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode unused,
|
||||||
GimpRgnFunc1 func,
|
GimpRgnFunc1 func,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +246,7 @@ gimp_rgn_iterate1 (GimpDrawable *drawable,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_rgn_iterate2 (GimpDrawable *drawable,
|
gimp_rgn_iterate2 (GimpDrawable *drawable,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode unused,
|
||||||
GimpRgnFunc2 func,
|
GimpRgnFunc2 func,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,29 +56,29 @@ typedef void (* GimpRgnFuncSrcDest) (gint x,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
GimpRgnIterator * gimp_rgn_iterator_new (GimpDrawable *drawable,
|
GimpRgnIterator * gimp_rgn_iterator_new (GimpDrawable *drawable,
|
||||||
GimpRunMode run_mode);
|
GimpRunMode unused);
|
||||||
void gimp_rgn_iterator_free (GimpRgnIterator *iter);
|
void gimp_rgn_iterator_free (GimpRgnIterator *iter);
|
||||||
void gimp_rgn_iterator_src (GimpRgnIterator *iter,
|
void gimp_rgn_iterator_src (GimpRgnIterator *iter,
|
||||||
GimpRgnFuncSrc func,
|
GimpRgnFuncSrc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void gimp_rgn_iterator_dest (GimpRgnIterator *iter,
|
void gimp_rgn_iterator_dest (GimpRgnIterator *iter,
|
||||||
GimpRgnFuncDest func,
|
GimpRgnFuncDest func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void gimp_rgn_iterator_src_dest (GimpRgnIterator *iter,
|
void gimp_rgn_iterator_src_dest (GimpRgnIterator *iter,
|
||||||
GimpRgnFuncSrcDest func,
|
GimpRgnFuncSrcDest func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
void gimp_rgn_iterate1 (GimpDrawable *drawable,
|
void gimp_rgn_iterate1 (GimpDrawable *drawable,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode unused,
|
||||||
GimpRgnFunc1 func,
|
GimpRgnFunc1 func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
void gimp_rgn_iterate2 (GimpDrawable *drawable,
|
void gimp_rgn_iterate2 (GimpDrawable *drawable,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode unused,
|
||||||
GimpRgnFunc2 func,
|
GimpRgnFunc2 func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,6 @@ static void alienmap2_get_label_size (void);
|
||||||
|
|
||||||
/***** Variables *****/
|
/***** Variables *****/
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
#define PREVIEW_SIZE 128
|
#define PREVIEW_SIZE 128
|
||||||
static GtkWidget *preview;
|
static GtkWidget *preview;
|
||||||
static gint preview_width, preview_height, preview_bpp;
|
static gint preview_width, preview_height, preview_bpp;
|
||||||
|
@ -275,6 +273,7 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
|
@ -391,7 +390,7 @@ alienmap2_func (const guchar *src,
|
||||||
static void
|
static void
|
||||||
alienmap2 (GimpDrawable *drawable)
|
alienmap2 (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, alienmap2_func, NULL);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, alienmap2_func, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
|
|
@ -40,7 +40,6 @@ static void run (const gchar *name,
|
||||||
static void autostretch_hsv (GimpDrawable *drawable);
|
static void autostretch_hsv (GimpDrawable *drawable);
|
||||||
static void indexed_autostretch_hsv (gint32 image_ID);
|
static void indexed_autostretch_hsv (gint32 image_ID);
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -58,8 +57,8 @@ query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef args[] =
|
static GimpParamDef args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,6 +97,7 @@ run (const gchar *name,
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ typedef struct {
|
||||||
double vlo;
|
double vlo;
|
||||||
} AutostretchData;
|
} AutostretchData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_max (guchar *src, gint bpp, AutostretchData *data)
|
find_max (guchar *src, gint bpp, AutostretchData *data)
|
||||||
{
|
{
|
||||||
double h, s, v;
|
double h, s, v;
|
||||||
|
@ -161,8 +161,8 @@ find_max (guchar *src, gint bpp, AutostretchData *data)
|
||||||
if (v < data->vlo) data->vlo = v;
|
if (v < data->vlo) data->vlo = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
|
autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
|
||||||
AutostretchData *data)
|
AutostretchData *data)
|
||||||
{
|
{
|
||||||
double h, s, v;
|
double h, s, v;
|
||||||
|
@ -173,7 +173,7 @@ autostretch_hsv_func (guchar *src, guchar *dest, gint bpp,
|
||||||
if (data->vhi != data->vlo)
|
if (data->vhi != data->vlo)
|
||||||
v = (v - data->vlo) / (data->vhi - data->vlo);
|
v = (v - data->vlo) / (data->vhi - data->vlo);
|
||||||
gimp_hsv_to_rgb4(dest, h, s, v);
|
gimp_hsv_to_rgb4(dest, h, s, v);
|
||||||
|
|
||||||
if (bpp == 4)
|
if (bpp == 4)
|
||||||
dest[3] = src[3];
|
dest[3] = src[3];
|
||||||
}
|
}
|
||||||
|
@ -211,9 +211,7 @@ autostretch_hsv (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
AutostretchData data = {0.0, 1.0, 0.0, 1.0};
|
AutostretchData data = {0.0, 1.0, 0.0, 1.0};
|
||||||
|
|
||||||
gimp_rgn_iterate1 (drawable, run_mode, (GimpRgnFunc1) find_max, &data);
|
gimp_rgn_iterate1 (drawable, 0 /* unused */, (GimpRgnFunc1) find_max, &data);
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, (GimpRgnFunc2) autostretch_hsv_func,
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, (GimpRgnFunc2) autostretch_hsv_func,
|
||||||
&data);
|
&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ GimpPlugInInfo PLUG_IN_INFO =
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
|
@ -58,8 +57,8 @@ query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef args[] =
|
static GimpParamDef args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,8 +95,8 @@ run (const gchar *name,
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
|
||||||
INIT_I18N();
|
INIT_I18N();
|
||||||
|
|
||||||
|
@ -235,7 +234,7 @@ c_astretch (GimpDrawable *drawable)
|
||||||
param.min[0] = param.min[1] = param.min[2] = 255;
|
param.min[0] = param.min[1] = param.min[2] = 255;
|
||||||
param.max[0] = param.max[1] = param.max[2] = 0;
|
param.max[0] = param.max[1] = param.max[2] = 0;
|
||||||
|
|
||||||
gimp_rgn_iterate1 (drawable, run_mode, find_min_max, ¶m);
|
gimp_rgn_iterate1 (drawable, 0 /* unused */, find_min_max, ¶m);
|
||||||
|
|
||||||
/* Calculate LUTs with stretched contrast */
|
/* Calculate LUTs with stretched contrast */
|
||||||
for (b = 0; b < param.alpha; b++)
|
for (b = 0; b < param.alpha; b++)
|
||||||
|
@ -250,6 +249,6 @@ c_astretch (GimpDrawable *drawable)
|
||||||
param.lut[param.min[b]][b] = param.min[b];
|
param.lut[param.min[b]][b] = param.min[b];
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, c_astretch_func, ¶m);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, c_astretch_func, ¶m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
/* Declare local functions.
|
/* Declare local functions.
|
||||||
*/
|
*/
|
||||||
|
@ -59,8 +58,8 @@ query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef args[] =
|
static GimpParamDef args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,8 +97,8 @@ run (const gchar *name,
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
|
||||||
INIT_I18N();
|
INIT_I18N();
|
||||||
|
|
||||||
|
@ -285,7 +284,6 @@ Color_Enhance (GimpDrawable *drawable)
|
||||||
param.vhi = 0.0;
|
param.vhi = 0.0;
|
||||||
param.vlo = 1.0;
|
param.vlo = 1.0;
|
||||||
|
|
||||||
gimp_rgn_iterate1 (drawable, run_mode, find_vhi_vlo, ¶m);
|
gimp_rgn_iterate1 (drawable, 0 /* unused */, find_vhi_vlo, ¶m);
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, color_enhance_func, ¶m);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, color_enhance_func, ¶m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,6 @@ static GimpRGB button_color[] =
|
||||||
{ 1.0, 1.0, 1.0, 1.0 },
|
{ 1.0, 1.0, 1.0, 1.0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -93,10 +91,10 @@ query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef args[] =
|
static GimpParamDef args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
{ 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,
|
gimp_install_procedure (PLUG_IN_NAME,
|
||||||
|
@ -126,6 +124,7 @@ run (const gchar *name,
|
||||||
GimpPDBStatusType status;
|
GimpPDBStatusType status;
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
|
@ -175,9 +174,7 @@ run (const gchar *name,
|
||||||
gimp_set_data (PLUG_IN_NAME, &cvals, sizeof (ColorifyVals));
|
gimp_set_data (PLUG_IN_NAME, &cvals, sizeof (ColorifyVals));
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
{
|
gimp_displays_flush ();
|
||||||
gimp_displays_flush ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
|
@ -219,7 +216,7 @@ colorify (GimpDrawable *drawable)
|
||||||
final_blue_lookup[i] = i * cvals.color.b;
|
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
|
static gboolean
|
||||||
|
|
|
@ -59,8 +59,6 @@ static void toalpha (GimpDrawable *drawable);
|
||||||
static gboolean colortoalpha_dialog (GimpDrawable *drawable);
|
static gboolean colortoalpha_dialog (GimpDrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
|
@ -119,6 +117,7 @@ run (const gchar *name,
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
|
@ -301,7 +300,7 @@ toalpha_func (const guchar *src,
|
||||||
static void
|
static void
|
||||||
toalpha (GimpDrawable *drawable)
|
toalpha (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, toalpha_func, NULL);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, toalpha_func, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -284,7 +284,6 @@ static FP_Params Current =
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpDrawable *drawable, *mask;
|
static GimpDrawable *drawable, *mask;
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
|
@ -340,6 +339,7 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
GimpParam values[1];
|
GimpParam values[1];
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
*nreturn_vals = 1;
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
@ -373,7 +373,8 @@ run (const gchar *name,
|
||||||
|
|
||||||
|
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
if (status==GIMP_PDB_SUCCESS)
|
|
||||||
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +457,7 @@ fp_func (const guchar *src,
|
||||||
static void
|
static void
|
||||||
fp (GimpDrawable *drawable)
|
fp (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, fp_func, NULL);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, fp_func, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
|
@ -32,65 +32,62 @@ static char rcsid[] = "$Id$";
|
||||||
|
|
||||||
/* Some useful macros */
|
/* Some useful macros */
|
||||||
|
|
||||||
#define NSAMPLES 256
|
#define NSAMPLES 256
|
||||||
#define TILE_CACHE_SIZE 32
|
#define LUMINOSITY(X) (GIMP_RGB_INTENSITY (X[0], X[1], X[2]) + 0.5)
|
||||||
#define LUMINOSITY(X) (GIMP_RGB_INTENSITY (X[0], X[1], X[2]) + 0.5)
|
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
/* Declare a local function.
|
/* Declare a local function.
|
||||||
*/
|
*/
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static void gradmap (GimpDrawable *drawable);
|
static void gradmap (GimpDrawable *drawable);
|
||||||
static guchar * get_samples (GimpDrawable *drawable );
|
static guchar * get_samples (GimpDrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
NULL, /* quit_proc */
|
NULL, /* quit_proc */
|
||||||
query, /* query_proc */
|
query, /* query_proc */
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query()
|
query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef args[]=
|
static GimpParamDef args[]=
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_gradmap",
|
gimp_install_procedure ("plug_in_gradmap",
|
||||||
"Map the contents of the specified drawable with "
|
"Map the contents of the specified drawable with "
|
||||||
"active gradient",
|
"active gradient",
|
||||||
" This plug-in maps the contents of the specified "
|
"This plug-in maps the contents of the specified "
|
||||||
"drawable with active gradient. It calculates "
|
"drawable with active gradient. It calculates "
|
||||||
"luminosity of each pixel and replaces the pixel "
|
"luminosity of each pixel and replaces the pixel "
|
||||||
"by the sample of active gradient at the position "
|
"by the sample of active gradient at the position "
|
||||||
"proportional to that luminosity. Complete black "
|
"proportional to that luminosity. Complete black "
|
||||||
"pixel becomes the leftmost color of the gradient, "
|
"pixel becomes the leftmost color of the gradient, "
|
||||||
"and complete white becomes the rightmost. Works on "
|
"and complete white becomes the rightmost. Works on "
|
||||||
"both Grayscale and RGB image with/without alpha "
|
"both Grayscale and RGB image with/without alpha "
|
||||||
"channel.",
|
"channel.",
|
||||||
"Eiichi Takamori",
|
"Eiichi Takamori",
|
||||||
"Eiichi Takamori",
|
"Eiichi Takamori",
|
||||||
"1997",
|
"1997",
|
||||||
N_("_Gradient Map"),
|
N_("_Gradient Map"),
|
||||||
"RGB*, GRAY*",
|
"RGB*, GRAY*",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (args), 0,
|
G_N_ELEMENTS (args), 0,
|
||||||
args, NULL);
|
args, NULL);
|
||||||
|
|
||||||
gimp_plugin_menu_register ("plug_in_gradmap",
|
gimp_plugin_menu_register ("plug_in_gradmap",
|
||||||
N_("<Image>/Filters/Colors/Map"));
|
N_("<Image>/Filters/Colors/Map"));
|
||||||
|
@ -106,6 +103,7 @@ run (const gchar *name,
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
|
@ -120,17 +118,17 @@ run (const gchar *name,
|
||||||
/* Get the specified drawable */
|
/* Get the specified drawable */
|
||||||
drawable = gimp_drawable_get (param[2].data.d_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) ||
|
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||||
gimp_drawable_is_gray (drawable->drawable_id))
|
gimp_drawable_is_gray (drawable->drawable_id))
|
||||||
{
|
{
|
||||||
gimp_progress_init (_("Gradient Map..."));
|
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);
|
gradmap (drawable);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -143,22 +141,23 @@ run (const gchar *name,
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
guchar *samples;
|
{
|
||||||
gboolean is_rgb;
|
guchar *samples;
|
||||||
gboolean has_alpha;
|
gboolean is_rgb;
|
||||||
} GradMapParam_t;
|
gboolean has_alpha;
|
||||||
|
} GradMapParam;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gradmap_func (const guchar *src,
|
gradmap_func (const guchar *src,
|
||||||
guchar *dest,
|
guchar *dest,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GradMapParam_t *param = (GradMapParam_t*) data;
|
GradMapParam *param = data;
|
||||||
gint lum;
|
gint lum;
|
||||||
gint b;
|
gint b;
|
||||||
guchar *samp;
|
guchar *samp;
|
||||||
|
|
||||||
lum = (param->is_rgb) ? LUMINOSITY (src) : src[0];
|
lum = (param->is_rgb) ? LUMINOSITY (src) : src[0];
|
||||||
samp = ¶m->samples[lum * bpp];
|
samp = ¶m->samples[lum * bpp];
|
||||||
|
@ -166,26 +165,26 @@ gradmap_func (const guchar *src,
|
||||||
if (param->has_alpha)
|
if (param->has_alpha)
|
||||||
{
|
{
|
||||||
for (b = 0; b < bpp - 1; b++)
|
for (b = 0; b < bpp - 1; b++)
|
||||||
dest[b] = samp[b];
|
dest[b] = samp[b];
|
||||||
dest[b] = ((guint)samp[b] * (guint)src[b]) / 255;
|
dest[b] = ((guint)samp[b] * (guint)src[b]) / 255;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (b = 0; b < bpp; b++)
|
for (b = 0; b < bpp; b++)
|
||||||
dest[b] = samp[b];
|
dest[b] = samp[b];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gradmap (GimpDrawable *drawable)
|
gradmap (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
GradMapParam_t param;
|
GradMapParam param;
|
||||||
|
|
||||||
param.is_rgb = gimp_drawable_is_rgb (drawable->drawable_id);
|
param.is_rgb = gimp_drawable_is_rgb (drawable->drawable_id);
|
||||||
param.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
param.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
||||||
param.samples = get_samples (drawable);
|
param.samples = get_samples (drawable);
|
||||||
|
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, gradmap_func, ¶m);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, gradmap_func, ¶m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -195,20 +194,20 @@ gradmap (GimpDrawable *drawable)
|
||||||
static guchar *
|
static guchar *
|
||||||
get_samples (GimpDrawable *drawable)
|
get_samples (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gdouble *f_samples, *f_samp; /* float samples */
|
gdouble *f_samples, *f_samp; /* float samples */
|
||||||
guchar *b_samples, *b_samp; /* byte samples */
|
guchar *b_samples, *b_samp; /* byte samples */
|
||||||
gint bpp, color, has_alpha, alpha;
|
gint bpp, color, has_alpha, alpha;
|
||||||
gint i, j;
|
gint i, j;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#warning FIXME: "reverse" hardcoded to FALSE.
|
#warning FIXME: "reverse" hardcoded to FALSE.
|
||||||
#endif
|
#endif
|
||||||
f_samples = gimp_gradients_sample_uniform (NSAMPLES, FALSE);
|
f_samples = gimp_gradients_sample_uniform (NSAMPLES, FALSE);
|
||||||
|
|
||||||
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
||||||
color = gimp_drawable_is_rgb (drawable->drawable_id);
|
color = gimp_drawable_is_rgb (drawable->drawable_id);
|
||||||
has_alpha = gimp_drawable_has_alpha (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);
|
b_samples = g_new (guchar, NSAMPLES * bpp);
|
||||||
|
|
||||||
|
@ -217,15 +216,16 @@ get_samples (GimpDrawable *drawable)
|
||||||
b_samp = &b_samples[i * bpp];
|
b_samp = &b_samples[i * bpp];
|
||||||
f_samp = &f_samples[i * 4];
|
f_samp = &f_samples[i * 4];
|
||||||
if (color)
|
if (color)
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
b_samp[j] = f_samp[j] * 255;
|
b_samp[j] = f_samp[j] * 255;
|
||||||
else
|
else
|
||||||
b_samp[0] = LUMINOSITY (f_samp) * 255;
|
b_samp[0] = LUMINOSITY (f_samp) * 255;
|
||||||
|
|
||||||
if (has_alpha)
|
if (has_alpha)
|
||||||
b_samp[alpha] = f_samp[3] * 255;
|
b_samp[alpha] = f_samp[3] * 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (f_samples);
|
g_free (f_samples);
|
||||||
|
|
||||||
return b_samples;
|
return b_samples;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
* Fix problem with divide by zero
|
* Fix problem with divide by zero
|
||||||
* V 1.03,neo, 22-May-00: Fixed divide by zero in preview code.
|
* V 1.03,neo, 22-May-00: Fixed divide by zero in preview code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VERSIO 1.03
|
#define VERSIO 1.03
|
||||||
static char dversio[] = "v1.03 22-May-00";
|
static char dversio[] = "v1.03 22-May-00";
|
||||||
static char ident[] = "@(#) GIMP mapcolor plug-in 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);
|
static void color_mapping (GimpDrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
/* The run mode */
|
|
||||||
static GimpRunMode l_run_mode;
|
|
||||||
|
|
||||||
static gchar *csel_title[4] =
|
static gchar *csel_title[4] =
|
||||||
{
|
{
|
||||||
N_("First Source Color"),
|
N_("First Source Color"),
|
||||||
|
@ -216,15 +214,15 @@ img_preview_create_from_drawable (guint maxsize,
|
||||||
gint32 drawable_ID)
|
gint32 drawable_ID)
|
||||||
{
|
{
|
||||||
GimpDrawable *drw;
|
GimpDrawable *drw;
|
||||||
GimpPixelRgn pixel_rgn;
|
GimpPixelRgn pixel_rgn;
|
||||||
guint drw_width, drw_height;
|
guint drw_width, drw_height;
|
||||||
guint prv_width, prv_height;
|
guint prv_width, prv_height;
|
||||||
gint src_x, src_y, x, y;
|
gint src_x, src_y, x, y;
|
||||||
guchar *prv_data, *img_data, *cu_row;
|
guchar *prv_data, *img_data, *cu_row;
|
||||||
gdouble xfactor, yfactor;
|
gdouble xfactor, yfactor;
|
||||||
gint tile_height, row_start, row_end;
|
gint tile_height, row_start, row_end;
|
||||||
gint bpp;
|
gint bpp;
|
||||||
IMG_PREVIEW *ip;
|
IMG_PREVIEW *ip;
|
||||||
|
|
||||||
drw_width = gimp_drawable_width (drawable_ID);
|
drw_width = gimp_drawable_width (drawable_ID);
|
||||||
drw_height = gimp_drawable_height (drawable_ID);
|
drw_height = gimp_drawable_height (drawable_ID);
|
||||||
|
@ -300,21 +298,21 @@ query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef adjust_args[] =
|
static GimpParamDef adjust_args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
|
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable to adjust" }
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable to adjust" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpParamDef map_args[] =
|
static GimpParamDef map_args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
|
{ GIMP_PDB_IMAGE, "image", "Input image (not used)" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable where colors are to map" },
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable where colors are to map" },
|
||||||
{ GIMP_PDB_COLOR, "srccolor_1", "First source color" },
|
{ GIMP_PDB_COLOR, "srccolor_1", "First source color" },
|
||||||
{ GIMP_PDB_COLOR, "srccolor_2", "Second source color" },
|
{ GIMP_PDB_COLOR, "srccolor_2", "Second source color" },
|
||||||
{ GIMP_PDB_COLOR, "dstcolor_1", "First destination color" },
|
{ GIMP_PDB_COLOR, "dstcolor_1", "First destination color" },
|
||||||
{ GIMP_PDB_COLOR, "dstcolor_2", "Second destination color" },
|
{ GIMP_PDB_COLOR, "dstcolor_2", "Second destination color" },
|
||||||
{ GIMP_PDB_INT32, "map_mode", "Mapping mode (0: linear, others reserved)" }
|
{ GIMP_PDB_INT32, "map_mode", "Mapping mode (0: linear, others reserved)" }
|
||||||
};
|
};
|
||||||
|
|
||||||
gimp_install_procedure ("plug_in_color_adjust",
|
gimp_install_procedure ("plug_in_color_adjust",
|
||||||
|
@ -368,14 +366,11 @@ run (const gchar *name,
|
||||||
GimpRunMode run_mode;
|
GimpRunMode run_mode;
|
||||||
GimpDrawable *drawable = NULL;
|
GimpDrawable *drawable = NULL;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
guchar *c;
|
|
||||||
gint j;
|
gint j;
|
||||||
|
|
||||||
c = (guchar *) ident;
|
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
l_run_mode = run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
*nreturn_vals = 1;
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
@ -474,7 +469,9 @@ run (const gchar *name,
|
||||||
if ((status == GIMP_PDB_SUCCESS) && (run_mode != GIMP_RUN_NONINTERACTIVE))
|
if ((status == GIMP_PDB_SUCCESS) && (run_mode != GIMP_RUN_NONINTERACTIVE))
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
|
|
||||||
if (drawable != NULL) gimp_drawable_detach (drawable);
|
if (drawable != NULL)
|
||||||
|
gimp_drawable_detach (drawable);
|
||||||
|
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,10 +481,10 @@ update_img_preview (void)
|
||||||
{
|
{
|
||||||
IMG_PREVIEW *dst_ip = plinterface.map_preview;
|
IMG_PREVIEW *dst_ip = plinterface.map_preview;
|
||||||
IMG_PREVIEW *src_ip = plinterface.img_preview;
|
IMG_PREVIEW *src_ip = plinterface.img_preview;
|
||||||
GtkWidget *preview = plinterface.preview;
|
GtkWidget *preview = plinterface.preview;
|
||||||
guchar redmap[256], greenmap[256], bluemap[256];
|
guchar redmap[256], greenmap[256], bluemap[256];
|
||||||
guchar *src, *dst;
|
guchar *src, *dst;
|
||||||
gint j;
|
gint j;
|
||||||
|
|
||||||
if ((dst_ip == NULL) || (src_ip == NULL)) return;
|
if ((dst_ip == NULL) || (src_ip == NULL)) return;
|
||||||
|
|
||||||
|
@ -716,5 +713,5 @@ color_mapping (GimpDrawable *drawable)
|
||||||
plvals.map_mode,
|
plvals.map_mode,
|
||||||
redmap, greenmap, bluemap);
|
redmap, greenmap, bluemap);
|
||||||
|
|
||||||
gimp_rgn_iterate2 (drawable, l_run_mode, mapcolor_func, NULL);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, mapcolor_func, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,6 @@ static ValueType pvals =
|
||||||
MAX_CHANNELS
|
MAX_CHANNELS
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
#define PREVIEW_SIZE 128
|
#define PREVIEW_SIZE 128
|
||||||
static GtkWidget *preview;
|
static GtkWidget *preview;
|
||||||
static gint preview_width, preview_height, preview_bpp;
|
static gint preview_width, preview_height, preview_bpp;
|
||||||
|
@ -131,6 +129,7 @@ run (const gchar *name,
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||||
|
@ -228,14 +227,15 @@ main_function (GimpDrawable *drawable,
|
||||||
gint i;
|
gint i;
|
||||||
guchar *buffer = g_new (guchar,
|
guchar *buffer = g_new (guchar,
|
||||||
preview_width * preview_height * preview_bpp);
|
preview_width * preview_height * preview_bpp);
|
||||||
for (i=0 ; i<preview_width * preview_height ; i++)
|
|
||||||
{
|
for (i = 0; i<preview_width * preview_height; i++)
|
||||||
max_rgb_func (preview_cache + i * preview_bpp,
|
{
|
||||||
buffer + i * preview_bpp,
|
max_rgb_func (preview_cache + i * preview_bpp,
|
||||||
preview_bpp,
|
buffer + i * preview_bpp,
|
||||||
¶m);
|
preview_bpp,
|
||||||
|
¶m);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
|
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
|
||||||
0, 0, preview_width, preview_height,
|
0, 0, preview_width, preview_height,
|
||||||
gimp_drawable_type (drawable->drawable_id),
|
gimp_drawable_type (drawable->drawable_id),
|
||||||
|
@ -247,7 +247,7 @@ main_function (GimpDrawable *drawable,
|
||||||
{
|
{
|
||||||
gimp_progress_init ( _("Max RGB..."));
|
gimp_progress_init ( _("Max RGB..."));
|
||||||
|
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, max_rgb_func, ¶m);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, max_rgb_func, ¶m);
|
||||||
|
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,6 @@ static NoisifyInterface noise_int =
|
||||||
{ NULL, NULL, NULL, NULL }
|
{ NULL, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
|
@ -151,6 +150,7 @@ run (const gchar *name,
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
|
@ -217,7 +217,8 @@ run (const gchar *name,
|
||||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||||
|
|
||||||
/* compute the luminosity which exceeds the luminosity threshold */
|
/* 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);
|
g_rand_free (gr);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
|
|
|
@ -58,8 +58,6 @@ GimpPlugInInfo PLUG_IN_INFO =
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
|
@ -107,8 +105,8 @@ run (const gchar *name,
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
|
@ -197,7 +195,7 @@ typedef struct {
|
||||||
gboolean has_alpha;
|
gboolean has_alpha;
|
||||||
} NormalizeParam_t;
|
} NormalizeParam_t;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_min_max (const guchar *src,
|
find_min_max (const guchar *src,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -217,7 +215,7 @@ find_min_max (const guchar *src,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
normalize_func (const guchar *src,
|
normalize_func (const guchar *src,
|
||||||
guchar *dest,
|
guchar *dest,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
|
@ -228,7 +226,7 @@ normalize_func (const guchar *src,
|
||||||
|
|
||||||
for (b = 0; b < param->alpha; b++)
|
for (b = 0; b < param->alpha; b++)
|
||||||
dest[b] = param->lut[src[b]];
|
dest[b] = param->lut[src[b]];
|
||||||
|
|
||||||
if (param->has_alpha)
|
if (param->has_alpha)
|
||||||
dest[param->alpha] = src[param->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.has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
|
||||||
param.alpha = (param.has_alpha) ? drawable->bpp - 1 : drawable->bpp;
|
param.alpha = (param.has_alpha) ? drawable->bpp - 1 : drawable->bpp;
|
||||||
|
|
||||||
gimp_rgn_iterate1 (drawable, run_mode, find_min_max, ¶m);
|
gimp_rgn_iterate1 (drawable, 0 /* unused */, find_min_max, ¶m);
|
||||||
|
|
||||||
/* Calculate LUT */
|
/* Calculate LUT */
|
||||||
|
|
||||||
|
@ -257,6 +255,6 @@ normalize (GimpDrawable *drawable)
|
||||||
else
|
else
|
||||||
param.lut[(gint)param.min] = param.min;
|
param.lut[(gint)param.min] = param.min;
|
||||||
|
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, normalize_func, ¶m);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, normalize_func, ¶m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,6 @@ typedef struct
|
||||||
* Some globals
|
* Some globals
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
static t_samp_interface g_di; /* global dialog interface varables */
|
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_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];
|
static t_samp_table_elem g_lum_tab[256];
|
||||||
|
@ -315,6 +314,7 @@ run (const gchar *name,
|
||||||
GimpDrawable *dst_drawable;
|
GimpDrawable *dst_drawable;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
const gchar *l_env;
|
const gchar *l_env;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
|
@ -2992,7 +2992,7 @@ p_colorize_drawable (gint32 drawable_id)
|
||||||
if (g_show_progress)
|
if (g_show_progress)
|
||||||
gimp_progress_init (_("Remap Colorized..."));
|
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));
|
GINT_TO_POINTER (has_alpha));
|
||||||
|
|
||||||
if (g_show_progress)
|
if (g_show_progress)
|
||||||
|
|
|
@ -71,7 +71,6 @@ static void scatter_hsv_iscale_update (GtkAdjustment *adjustment,
|
||||||
static gint preview_width = PREVIEW_WIDTH;
|
static gint preview_width = PREVIEW_WIDTH;
|
||||||
static gint preview_height = PREVIEW_HEIGHT;
|
static gint preview_height = PREVIEW_HEIGHT;
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -150,6 +149,7 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ scatter_hsv (gint32 drawable_id)
|
||||||
|
|
||||||
gimp_progress_init (_("Scattering HSV..."));
|
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);
|
gimp_drawable_detach (drawable);
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,6 @@ static void semiflatten (GimpDrawable *drawable);
|
||||||
|
|
||||||
static guchar bgred, bggreen, bgblue;
|
static guchar bgred, bggreen, bgblue;
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
|
@ -100,6 +98,7 @@ run (const gchar *name,
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
*nreturn_vals = 1;
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
@ -137,7 +136,7 @@ run (const gchar *name,
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
semiflatten_func (const guchar *src,
|
semiflatten_func (const guchar *src,
|
||||||
guchar *dest,
|
guchar *dest,
|
||||||
gint bpp,
|
gint bpp,
|
||||||
|
@ -157,6 +156,6 @@ semiflatten (GimpDrawable *drawable)
|
||||||
gimp_context_get_background (&background);
|
gimp_context_get_background (&background);
|
||||||
gimp_rgb_get_uchar (&background, &bgred, &bggreen, &bgblue);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ static GimpPDBStatusType threshold_alpha (gint32 drawable_id);
|
||||||
static gboolean threshold_alpha_dialog (void);
|
static gboolean threshold_alpha_dialog (void);
|
||||||
|
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
|
@ -113,6 +111,7 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
static GimpParam values[1];
|
static GimpParam values[1];
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
gint drawable_id;
|
gint drawable_id;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
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;
|
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));
|
GINT_TO_POINTER(gap));
|
||||||
|
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
|
|
|
@ -47,8 +47,6 @@ static void vinvert_render_row (const guchar *src,
|
||||||
gint bpp);
|
gint bpp);
|
||||||
|
|
||||||
|
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
GimpPlugInInfo PLUG_IN_INFO =
|
GimpPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
|
@ -104,6 +102,7 @@ run (const gchar *name,
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
gint32 image_ID;
|
gint32 image_ID;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
|
@ -208,5 +207,5 @@ vinvert_render_row (const guchar *src,
|
||||||
static void
|
static void
|
||||||
vinvert (GimpDrawable *drawable)
|
vinvert (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, vinvert_func, NULL);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, vinvert_func, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,6 @@ static FP_Params Current =
|
||||||
};
|
};
|
||||||
|
|
||||||
static GimpDrawable *drawable, *mask;
|
static GimpDrawable *drawable, *mask;
|
||||||
static GimpRunMode run_mode;
|
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (const gchar *name,
|
static void run (const gchar *name,
|
||||||
|
@ -340,6 +339,7 @@ run (const gchar *name,
|
||||||
{
|
{
|
||||||
GimpParam values[1];
|
GimpParam values[1];
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
|
GimpRunMode run_mode;
|
||||||
|
|
||||||
*nreturn_vals = 1;
|
*nreturn_vals = 1;
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
@ -373,7 +373,8 @@ run (const gchar *name,
|
||||||
|
|
||||||
|
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
if (status==GIMP_PDB_SUCCESS)
|
|
||||||
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +457,7 @@ fp_func (const guchar *src,
|
||||||
static void
|
static void
|
||||||
fp (GimpDrawable *drawable)
|
fp (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gimp_rgn_iterate2 (drawable, run_mode, fp_func, NULL);
|
gimp_rgn_iterate2 (drawable, 0 /* unused */, fp_func, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
Loading…
Reference in New Issue