use g* types and name the parameters in the header.

2000-02-05  Michael Natterer  <mitch@gimp.org>

	* libgimp/gimpcolorspace.[ch]: use g* types and name the
	parameters in the header.

	* plug-ins/common/CML_explorer.c
	* plug-ins/common/blur.c
	* plug-ins/common/newsprint.c
	* plug-ins/common/nova.c
	* plug-ins/common/pixelize.c
	* plug-ins/common/plasma.c
	* plug-ins/common/randomize.c
	* plug-ins/common/unsharp.c
	* plug-ins/gflare/gflare.c
	* plug-ins/sinus/sinus.c
	* plug-ins/struc/struc.c: soem more consistency stuff.
This commit is contained in:
Michael Natterer 2000-02-04 22:18:50 +00:00 committed by Michael Natterer
parent 75ed6661ca
commit bce26fb34a
19 changed files with 1437 additions and 1375 deletions

View File

@ -1,8 +1,25 @@
2000-02-05 Michael Natterer <mitch@gimp.org>
* libgimp/gimpcolorspace.[ch]: use g* types and name the
parameters in the header.
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/newsprint.c
* plug-ins/common/nova.c
* plug-ins/common/pixelize.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/unsharp.c
* plug-ins/gflare/gflare.c
* plug-ins/sinus/sinus.c
* plug-ins/struc/struc.c: soem more consistency stuff.
2000-02-05 Asbjorn Pettersen <asbjornP@dualog.no>
* plug-ins/FractalExplorer/FractalExplorer.c (fractalexplorer_load):
* plug-ins/FractalExplorer/Dialogs.c (explorer_load): Use "rt","wt" with fopen() for
OS/2, Win portability.
* plug-ins/FractalExplorer/Dialogs.c (explorer_load): Use
"rt", "wt" with fopen() for OS/2, Win portability.
Sat Feb 5 17:49:43 CET 2000 Sven Neumann <sven@gimp.org>

View File

@ -1,3 +1,13 @@
2000-02-05 Michael Natterer <mitch@gimp.org>
* devel-docs/libgimp/Makefile.am: correctly quote shell commands.
* libgimp/libgimp-docs.sgml: added two new chapters:
"GIMP Constants and Limits" and "GIMP Module Headers".
* libgimp/libgimp-decl.txt
* libgimp/tmpl/gimpcolorspace.sgml: updated from the c-source.
Sat Feb 5 17:48:41 CET 2000 Sven Neumann <sven@gimp.org>
* libgimp/libgimp-decl.txt

View File

@ -78,7 +78,8 @@ sgml/libgimp-doc.bottom: $(tmpl_sources)
scan:
-(cd $(srcdir) \
&& env CFLAGS="$(CFLAGS) libgimp-include.c" LDFLAGS=$(LDFLAGS) \
&& env CFLAGS="$(CFLAGS) libgimp-include.c" CPPFLAGS="$(CPPFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
gtkdoc-scanobj --module=$(DOC_MODULE) \
&& gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) \
--ignore-headers="gimpintl.h libgimp-intl.h stdplugins-intl.h" )

File diff suppressed because it is too large Load Diff

View File

@ -36,28 +36,28 @@
<title>GIMP Library Reference Manual</title>
</bookinfo>
<chapter id="gimpdefinitions">
<title>GIMP Constants and Limits</title>
&libgimp-gimpenums;
&libgimp-gimpfeatures;
&libgimp-gimplimits;
&libgimp-gimpmath;
</chapter>
<chapter id="libgimp">
<title>GIMP Library</title>
&libgimp-gimp;
&libgimp-gimpprotocol;
&libgimp-gimpcolorspace;
&libgimp-gimpenums;
&libgimp-gimpwire;
&libgimp-gimpmatrix;
&libgimp-parasite;
&libgimp-parasiteF;
&libgimp-parasiteP;
&libgimp-gserialize;
&libgimp-color-selector;
&libgimp-gimpmodule;
&libgimp-gimpmath;
&libgimp-color-display;
&libgimp-gimpenv;
&libgimp-gimplimits;
&libgimp-gimpexport;
&libgimp-parasiteio;
&libgimp-gimpcompat;
&libgimp-gimpfeatures;
</chapter>
<chapter id="libgimpui">
@ -69,11 +69,19 @@
&GimpSizeEntry;
&GimpUnitMenu;
&libgimp-gimpdialog;
&libgimp-gimpexport;
&libgimp-gimphelpui;
&libgimp-gimpmenu;
&libgimp-gimpunit;
&libgimp-gimpwidgets;
</chapter>
<chapter id="gimpmodule">
<title>GIMP Module Header Files</title>
&libgimp-gimpmodule;
&libgimp-color-display;
&libgimp-color-selector;
</chapter>
</book>

View File

@ -19,6 +19,10 @@ gimpcolorspace
</para>
@red:
@green:
@blue:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -29,6 +33,10 @@ gimpcolorspace
</para>
@hue:
@saturation:
@value:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -39,6 +47,10 @@ gimpcolorspace
</para>
@red:
@green:
@blue:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -49,10 +61,14 @@ gimpcolorspace
</para>
@Varargs:
@Varargs:
@Varargs:
@red:
@green:
@blue:
@Returns:
<!-- # Unused Parameters # -->
@Varargs:
@Varargs:
@Varargs:
<!-- ##### FUNCTION gimp_hls_to_rgb ##### -->
@ -60,6 +76,10 @@ gimpcolorspace
</para>
@hue:
@lightness:
@saturation:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -70,6 +90,10 @@ gimpcolorspace
</para>
@red:
@green:
@blue:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -80,6 +104,10 @@ gimpcolorspace
</para>
@hue:
@saturation:
@value:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -90,6 +118,11 @@ gimpcolorspace
</para>
@hsv:
@red:
@green:
@blue:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:
@ -101,6 +134,11 @@ gimpcolorspace
</para>
@rgb:
@hue:
@saturation:
@value:
<!-- # Unused Parameters # -->
@Param1:
@Param2:
@Param3:

View File

@ -26,50 +26,36 @@
*********************************/
void
gimp_rgb_to_hsv (int *r,
int *g,
int *b)
gimp_rgb_to_hsv (gint *r,
gint *g,
gint *b)
{
int red, green, blue;
float h, s, v;
int min, max;
int delta;
gint red, green, blue;
gdouble h, s, v;
gint min, max;
gint delta;
h = 0.0;
red = *r;
red = *r;
green = *g;
blue = *b;
blue = *b;
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
max = MAX (red, blue);
min = MIN (green, blue);
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
max = MAX (green, blue);
min = MIN (red, blue);
}
v = max;
if (max != 0)
s = ((max - min) * 255) / (float) max;
s = ((max - min) * 255) / (gdouble) max;
else
s = 0;
@ -79,11 +65,11 @@ gimp_rgb_to_hsv (int *r,
{
delta = max - min;
if (red == max)
h = (green - blue) / (float) delta;
h = (green - blue) / (gdouble) delta;
else if (green == max)
h = 2 + (blue - red) / (float) delta;
h = 2 + (blue - red) / (gdouble) delta;
else if (blue == max)
h = 4 + (red - green) / (float) delta;
h = 4 + (red - green) / (gdouble) delta;
h *= 42.5;
if (h < 0)
@ -98,12 +84,12 @@ gimp_rgb_to_hsv (int *r,
}
void
gimp_hsv_to_rgb (int *h,
int *s,
int *v)
gimp_hsv_to_rgb (gint *h,
gint *s,
gint *v)
{
float hue, saturation, value;
float f, p, q, t;
gdouble hue, saturation, value;
gdouble f, p, q, t;
if (*s == 0)
{
@ -126,75 +112,66 @@ gimp_hsv_to_rgb (int *h,
{
case 0:
*h = value * 255;
*s = t * 255;
*v = p * 255;
*s = t * 255;
*v = p * 255;
break;
case 1:
*h = q * 255;
*h = q * 255;
*s = value * 255;
*v = p * 255;
*v = p * 255;
break;
case 2:
*h = p * 255;
*h = p * 255;
*s = value * 255;
*v = t * 255;
*v = t * 255;
break;
case 3:
*h = p * 255;
*s = q * 255;
*h = p * 255;
*s = q * 255;
*v = value * 255;
break;
case 4:
*h = t * 255;
*s = p * 255;
*h = t * 255;
*s = p * 255;
*v = value * 255;
break;
case 5:
*h = value * 255;
*s = p * 255;
*v = q * 255;
*s = p * 255;
*v = q * 255;
break;
}
}
}
void
gimp_rgb_to_hls (int *r,
int *g,
int *b)
gimp_rgb_to_hls (gint *r,
gint *g,
gint *b)
{
int red, green, blue;
float h, l, s;
int min, max;
int delta;
gint red, green, blue;
gdouble h, l, s;
gint min, max;
gint delta;
red = *r;
red = *r;
green = *g;
blue = *b;
blue = *b;
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
max = MAX (red, blue);
min = MIN (green, blue);
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
max = MAX (green, blue);
min = MIN (red, blue);
}
l = (max + min) / 2.0;
@ -209,16 +186,16 @@ gimp_rgb_to_hls (int *r,
delta = (max - min);
if (l < 128)
s = 255 * (float) delta / (float) (max + min);
s = 255 * (gdouble) delta / (gdouble) (max + min);
else
s = 255 * (float) delta / (float) (511 - max - min);
s = 255 * (gdouble) delta / (gdouble) (511 - max - min);
if (red == max)
h = (green - blue) / (float) delta;
h = (green - blue) / (gdouble) delta;
else if (green == max)
h = 2 + (blue - red) / (float) delta;
h = 2 + (blue - red) / (gdouble) delta;
else
h = 4 + (red - green) / (float) delta;
h = 4 + (red - green) / (gdouble) delta;
h = h * 42.5;
@ -233,47 +210,33 @@ gimp_rgb_to_hls (int *r,
*b = s;
}
int
gimp_rgb_to_l (int red,
int green,
int blue)
gint
gimp_rgb_to_l (gint red,
gint green,
gint blue)
{
int min, max;
gint min, max;
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
max = MAX (red, blue);
min = MIN (green, blue);
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
max = MAX (green, blue);
min = MIN (red, blue);
}
return (max + min) / 2.0;
}
int
gimp_hls_value (float n1,
float n2,
float hue)
static gint
gimp_hls_value (gdouble n1,
gdouble n2,
gdouble hue)
{
float value;
gdouble value;
if (hue > 255)
hue -= 255;
@ -288,19 +251,19 @@ gimp_hls_value (float n1,
else
value = n1;
return (int) (value * 255);
return (gint) (value * 255);
}
void
gimp_hls_to_rgb (int *h,
int *l,
int *s)
gimp_hls_to_rgb (gint *h,
gint *l,
gint *s)
{
float hue, lightness, saturation;
float m1, m2;
gdouble hue, lightness, saturation;
gdouble m1, m2;
hue = *h;
lightness = *l;
hue = *h;
lightness = *l;
saturation = *s;
if (saturation == 0)
@ -327,14 +290,14 @@ gimp_hls_to_rgb (int *h,
}
void
gimp_rgb_to_hsv_double (double *r,
double *g,
double *b)
gimp_rgb_to_hsv_double (gdouble *r,
gdouble *g,
gdouble *b)
{
double red, green, blue;
double h, s, v;
double min, max;
double delta;
gdouble red, green, blue;
gdouble h, s, v;
gdouble min, max;
gdouble delta;
red = *r;
green = *g;
@ -344,27 +307,13 @@ gimp_rgb_to_hsv_double (double *r,
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
max = MAX (red, blue);
min = MIN (green, blue);
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
max = MAX (green, blue);
min = MIN (red, blue);
}
v = max;
@ -403,12 +352,12 @@ gimp_rgb_to_hsv_double (double *r,
}
void
gimp_hsv_to_rgb_double (double *h,
double *s,
double *v)
gimp_hsv_to_rgb_double (gdouble *h,
gdouble *s,
gdouble *v)
{
double hue, saturation, value;
double f, p, q, t;
gdouble hue, saturation, value;
gdouble f, p, q, t;
if (*s == 0.0)
{
@ -425,12 +374,12 @@ gimp_hsv_to_rgb_double (double *h,
if (hue == 6.0)
hue = 0.0;
f = hue - (int) hue;
f = hue - (gint) hue;
p = value * (1.0 - saturation);
q = value * (1.0 - saturation * f);
t = value * (1.0 - saturation * (1.0 - f));
switch ((int) hue)
switch ((gint) hue)
{
case 0:
*h = value;
@ -472,15 +421,15 @@ gimp_hsv_to_rgb_double (double *h,
}
void
gimp_rgb_to_hsv4 (guchar *rgb,
double *hue,
double *sat,
double *val)
gimp_rgb_to_hsv4 (guchar *rgb,
gdouble *hue,
gdouble *sat,
gdouble *val)
{
double red, green, blue;
double h, s, v;
double min, max;
double delta;
gdouble red, green, blue;
gdouble h, s, v;
gdouble min, max;
gdouble delta;
red = rgb[0] / 255.0;
green = rgb[1] / 255.0;
@ -547,13 +496,13 @@ gimp_rgb_to_hsv4 (guchar *rgb,
}
void
gimp_hsv_to_rgb4 (guchar *rgb,
double h,
double s,
double v)
gimp_hsv_to_rgb4 (guchar *rgb,
gdouble h,
gdouble s,
gdouble v)
{
double hue, saturation, value;
double f, p, q, t;
gdouble hue, saturation, value;
gdouble f, p, q, t;
if (s == 0.0)
{

View File

@ -22,15 +22,38 @@
/* Color conversion routines */
void gimp_rgb_to_hsv (int *, int *, int *);
void gimp_hsv_to_rgb (int *, int *, int *);
void gimp_rgb_to_hls (int *, int *, int *);
int gimp_rgb_to_l (int, int, int);
void gimp_hls_to_rgb (int *, int *, int *);
void gimp_rgb_to_hsv_double (double *, double *, double *);
void gimp_hsv_to_rgb_double (double *, double *, double *);
void gimp_rgb_to_hsv4 (guchar *, double *, double *, double *);
void gimp_hsv_to_rgb4 (guchar *, double, double, double);
void gimp_rgb_to_hsv (gint *red /* returns hue */,
gint *green /* returns saturation */,
gint *blue /* returns value */);
void gimp_hsv_to_rgb (gint *hue /* returns red */,
gint *saturation /* returns green */,
gint *value /* returns blue */);
void gimp_rgb_to_hls (gint *red /* returns hue */,
gint *green /* returns lightness */,
gint *blue /* returns saturation */);
gint gimp_rgb_to_l (gint red,
gint green,
gint blue);
void gimp_hls_to_rgb (gint *hue /* returns red */,
gint *lightness /* returns green */,
gint *saturation /* returns blue */);
void gimp_rgb_to_hsv_double (gdouble *red /* returns hue */,
gdouble *green /* returns saturation */,
gdouble *blue /* returns value */);
void gimp_hsv_to_rgb_double (gdouble *hue /* returns red */,
gdouble *saturation, /* returns green */
gdouble *value /* returns blue */);
void gimp_rgb_to_hsv4 (guchar *hsv,
gdouble *red,
gdouble *green,
gdouble *blue);
void gimp_hsv_to_rgb4 (guchar *rgb,
gdouble hue,
gdouble saturation,
gdouble value);
/* Map RGB to intensity */
@ -41,4 +64,5 @@ void gimp_hsv_to_rgb4 (guchar *, double, double, double);
#define INTENSITY(r,g,b) ((r) * INTENSITY_RED + \
(g) * INTENSITY_GREEN + \
(b) * INTENSITY_BLUE + 0.001)
#endif
#endif /* __GIMPCOLORSPACE_H__ */

View File

@ -420,7 +420,7 @@ typedef struct
#define RANDOM_SENSITIVES_NUM 5
CML_sensitive_widget_table random_sensitives[RANDOM_SENSITIVES_NUM] =
static CML_sensitive_widget_table random_sensitives[RANDOM_SENSITIVES_NUM] =
{
{ NULL, 0 },
{ NULL, 0 },

View File

@ -134,10 +134,10 @@ static void run (gchar *name,
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
static void blur (GDrawable *drawable);
@ -187,9 +187,6 @@ query (void)
};
static gint nargs = sizeof(args) / sizeof (args[0]);
static GParamDef *return_vals = NULL;
static gint nreturn_vals = 0;
const gchar *blurb = "Apply a 3x3 blurring convolution kernel to the specified drawable.";
const gchar *help = "This plug-in randomly blurs the specified drawable, using a 3x3 blur. You control the percentage of the pixels that are blurred and the number of times blurring is applied. Indexed images are not supported.";
const gchar *author = "Miles O'Neal <meo@rru.com> http://www.rru.com/~meo/";
@ -207,8 +204,8 @@ query (void)
N_("<Image>/Filters/Blur/Blur..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
nargs, 0,
args, NULL);
gimp_install_procedure (PLUG_IN_NAME,
(gchar *) blurb,
@ -219,8 +216,8 @@ query (void)
NULL,
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs_ni, nreturn_vals,
args_ni, return_vals);
nargs_ni, 0,
args_ni, NULL);
}
/*********************************
@ -294,7 +291,6 @@ run (gchar *name,
pivals.seed_type = (gint) MIN (SEED_USER, param[5].data.d_int32);
pivals.seed_type = (gint) MAX (SEED_TIME, param[5].data.d_int32);
pivals.blur_seed = (gint) param[6].data.d_int32;
status = STATUS_SUCCESS;
}
else if ((strcmp (name, PLUG_IN_NAME) == 0) &&
(nparams == 3))
@ -303,7 +299,6 @@ run (gchar *name,
pivals.blur_rcount = (gdouble) 1.0;
pivals.seed_type = SEED_TIME;
pivals.blur_seed = 0;
status = STATUS_SUCCESS;
}
else
{
@ -324,6 +319,7 @@ run (gchar *name,
default:
break;
}
if (status == STATUS_SUCCESS)
{
/*
@ -457,16 +453,16 @@ blur (GDrawable *drawable)
* allocate row buffers
*/
prev_row = g_new (guchar, (x2 - x1 + 2) * bytes);
cur_row = g_new (guchar, (x2 - x1 + 2) * bytes);
cur_row = g_new (guchar, (x2 - x1 + 2) * bytes);
next_row = g_new (guchar, (x2 - x1 + 2) * bytes);
dest = g_new (guchar, (x2 - x1) * bytes);
dest = g_new (guchar, (x2 - x1) * bytes);
/*
* initialize the pixel regions
*/
gimp_pixel_rgn_init(&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init(&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
gimp_pixel_rgn_init(&destPR2, drawable, 0, 0, width, height, TRUE, TRUE);
gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
gimp_pixel_rgn_init (&destPR2, drawable, 0, 0, width, height, TRUE, TRUE);
sp = &srcPR;
dp = &destPR;
tp = NULL;

View File

@ -1267,21 +1267,23 @@ newsprint_dialog (GDrawable *drawable)
}
#endif
st.input_spi = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Input SPI:"), SCALE_WIDTH, 0,
pvals_ui.input_spi,
1.0, 1200.0, 1.0, 10.0, 0,
TRUE, 0, 0,
NULL, NULL);
st.input_spi =
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Input SPI:"), SCALE_WIDTH, 0,
pvals_ui.input_spi,
1.0, 1200.0, 1.0, 10.0, 0,
FALSE, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (st.input_spi), "value_changed",
GTK_SIGNAL_FUNC (spi_callback),
&st);
st.output_lpi = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Output LPI:"), SCALE_WIDTH, 0,
pvals_ui.output_lpi,
1.0, 1200.0, 1.0, 10.0, 1,
TRUE, 0, 0,
st.output_lpi =
gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Output LPI:"), SCALE_WIDTH, 0,
pvals_ui.output_lpi,
1.0, 1200.0, 1.0, 10.0, 1,
FALSE, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (st.output_lpi), "value_changed",
GTK_SIGNAL_FUNC (lpi_callback),
@ -1291,7 +1293,7 @@ newsprint_dialog (GDrawable *drawable)
_("Cell Size:"), SCALE_WIDTH, 0,
pvals.cell_width,
3.0, 100.0, 1.0, 5.0, 0,
TRUE, 0, 0,
FALSE, 3.0, GIMP_MAX_IMAGE_SIZE,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (st.cellsize), "value_changed",
GTK_SIGNAL_FUNC (cellsize_callback),

View File

@ -398,7 +398,7 @@ nova_dialog (GDrawable *drawable)
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
_("Radius:"), SCALE_WIDTH, 0,
pvals.radius, 1, 100, 1, 10, 0,
TRUE, 0, 0,
FALSE, 1, GIMP_MAX_IMAGE_SIZE,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),

View File

@ -312,7 +312,7 @@ pixelize_dialog (void)
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Pixel Width:"), SCALE_WIDTH, ENTRY_WIDTH,
pvals.pixelwidth, 1, 64, 1, 8, 0,
TRUE, 0, 0,
FALSE, 0, GIMP_MAX_IMAGE_SIZE,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),

View File

@ -327,8 +327,8 @@ plasma_dialog (void)
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Turbulence:"), SCALE_WIDTH, 0,
pvals.turbulence,
TRUE, 0, 0,
0.1, 7.0, 0.1, 1.0, 1,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),

View File

@ -338,29 +338,29 @@ run (gchar *name,
{
status = STATUS_CALLING_ERROR;
}
if (status == STATUS_SUCCESS)
else
{
pivals.rndm_pct = (gdouble) param[3].data.d_float;
pivals.rndm_rcount = (gdouble) param[4].data.d_float;
pivals.seed_type = (gint) param[5].data.d_int32;
pivals.rndm_seed = (gint) param[6].data.d_int32;
}
if (status == STATUS_SUCCESS &&
((rndm_type != RNDM_PICK &&
rndm_type != RNDM_SLUR &&
rndm_type != RNDM_HURL) ||
(pivals.rndm_pct < 1.0 || pivals.rndm_pct > 100.0) ||
(pivals.rndm_rcount < 1.0 || pivals.rndm_rcount > 100.0)))
{
status = STATUS_CALLING_ERROR;
if ((rndm_type != RNDM_PICK &&
rndm_type != RNDM_SLUR &&
rndm_type != RNDM_HURL) ||
(pivals.rndm_pct < 1.0 || pivals.rndm_pct > 100.0) ||
(pivals.rndm_rcount < 1.0 || pivals.rndm_rcount > 100.0))
{
status = STATUS_CALLING_ERROR;
}
}
break;
/*
* If we're running with the last set of values, get those values.
*/
case RUN_WITH_LAST_VALS:
INIT_I18N();
gimp_get_data(PLUG_IN_NAME[rndm_type - 1], &pivals);
INIT_I18N ();
gimp_get_data (PLUG_IN_NAME[rndm_type - 1], &pivals);
break;
/*
* Hopefully we never get here!
@ -751,7 +751,7 @@ randomize_dialog (void)
* Randomization percentage label & scale (1 to 100)
*/
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Randomization %:"), SCALE_WIDTH, 0,
_("Randomization (%):"), SCALE_WIDTH, 0,
pivals.rndm_pct, 1.0, 100.0, 1.0, 10.0, 0,
TRUE, 0, 0,
_("Percentage of pixels to be filtered"), NULL);

View File

@ -117,15 +117,15 @@ static void preview_exit (void);
static void preview_update (void);
static GtkWidget* preview;
static int preview_width; /* Width of preview widget */
static int preview_height; /* Height of preview widget */
static int preview_x1; /* Upper-left X of preview */
static int preview_y1; /* Upper-left Y of preview */
static int preview_x2; /* Lower-right X of preview */
static int preview_y2; /* Lower-right Y of preview */
static gint preview_width; /* Width of preview widget */
static gint preview_height; /* Height of preview widget */
static gint preview_x1; /* Upper-left X of preview */
static gint preview_y1; /* Upper-left Y of preview */
static gint preview_x2; /* Lower-right X of preview */
static gint preview_y2; /* Lower-right Y of preview */
static int sel_width; /* Selection width */
static int sel_height; /* Selection height */
static gint sel_width; /* Selection width */
static gint sel_height; /* Selection height */
static GtkObject *hscroll_data; /* Horizontal scrollbar data */
static GtkObject *vscroll_data; /* Vertical scrollbar data */
@ -167,7 +167,7 @@ query (void)
{ PARAM_FLOAT, "amount", "Strength of effect" },
{ PARAM_FLOAT, "threshold", "Threshold" }
};
static gint nargs = sizeof(args) / sizeof(args[0]);
static gint nargs = sizeof (args) / sizeof (args[0]);
INIT_I18N();

View File

@ -3601,28 +3601,29 @@ ed_make_page_general (GFlareEditor *ed,
{
GFlare *gflare = ed->gflare;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *option_menu;
GtkWidget *sep;
GtkObject *adj;
gint row;
vbox = gtk_vbox_new (FALSE, 0);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
/*
* Scales
*/
/* Glow */
table = gtk_table_new (8, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
frame = gtk_frame_new (_("Glow Paint Options"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
table = gtk_table_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
row = 0;
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Glow Opacity (%):"), SCALE_WIDTH, 0,
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Opacity:"), SCALE_WIDTH, 0,
gflare->glow_opacity, 0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0, 0,
NULL, NULL);
@ -3634,17 +3635,25 @@ ed_make_page_general (GFlareEditor *ed,
NULL);
option_menu = ed_mode_menu_new (&gflare->glow_mode);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Glow Mode:"), 1.0, 0.5,
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Paint Mode:"), 1.0, 0.5,
option_menu, 1, TRUE);
sep = gtk_hseparator_new ();
gtk_table_attach_defaults (GTK_TABLE (table), sep, 0, 4, row, row + 1);
gtk_widget_show (sep);
row++;
/* Rays */
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Rays Opacity (%):"), SCALE_WIDTH, 0,
frame = gtk_frame_new (_("Rays Paint Options"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
table = gtk_table_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Opacity:"), SCALE_WIDTH, 0,
gflare->rays_opacity, 0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0, 0,
NULL, NULL);
@ -3656,17 +3665,25 @@ ed_make_page_general (GFlareEditor *ed,
NULL);
option_menu = ed_mode_menu_new (&gflare->rays_mode);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Rays Mode:"), 1.0, 0.5,
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Paint Mode:"), 1.0, 0.5,
option_menu, 1, TRUE);
sep = gtk_hseparator_new ();
gtk_table_attach_defaults (GTK_TABLE (table), sep, 0, 4, row, row + 1);
gtk_widget_show (sep);
row++;
/* Rays */
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Second Flares Opacity (%):"), SCALE_WIDTH, 0,
frame = gtk_frame_new (_("Second Flares Paint Options"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
table = gtk_table_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
adj = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Opacity:"), SCALE_WIDTH, 0,
gflare->sflare_opacity, 0.0, 100.0, 1.0, 10.0, 1,
TRUE, 0, 0,
NULL, NULL);
@ -3678,12 +3695,10 @@ ed_make_page_general (GFlareEditor *ed,
NULL);
option_menu = ed_mode_menu_new (&gflare->sflare_mode);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Second Flares Mode:"), 1.0, 0.5,
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Paint Mode:"), 1.0, 0.5,
option_menu, 1, TRUE);
gtk_widget_show (table);
/*
* Create Page
*/

View File

@ -153,10 +153,10 @@ static inline void compute_block_1 (guchar *dest_row, guint rowstride,
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
MAIN ()
@ -184,10 +184,7 @@ query (void)
{ PARAM_INT32, "blend", "0= linear, 1= bilinear, 2= sinusoidal" },
{ PARAM_FLOAT, "blend_power", "Power used to strech the blend" }
};
static GParamDef *return_vals = NULL;
static gint nargs = sizeof (args) / sizeof (args[0]);
static gint nreturn_vals = 0;
INIT_I18N ();
@ -200,8 +197,8 @@ query (void)
N_("<Image>/Filters/Render/Sinus..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
nargs, 0,
args, NULL);
}
static void
@ -247,8 +244,10 @@ run (gchar *name,
case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
if (nparams != 16)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
status = STATUS_CALLING_ERROR;
}
else
{
svals.scalex = param[3].data.d_float;
svals.scaley = param[4].data.d_float;
@ -287,7 +286,7 @@ run (gchar *name,
(gimp_drawable_is_rgb (drawable->id) ||
gimp_drawable_is_gray (drawable->id)))
{
gimp_progress_init ("Calculating picture...");
gimp_progress_init (_("Sinus: rendering..."));
gimp_tile_cache_ntiles (1);
sinus ();
@ -1212,4 +1211,3 @@ mw_preview_new (GtkWidget *parent,
return preview;
}

View File

@ -88,14 +88,16 @@ GPlugInInfo PLUG_IN_INFO =
query, /* query_proc */
run, /* run_proc */
};
static StrucValues svals =
{
0, /* direction*/
4 /* depth */
0, /* direction */
4 /* depth */
};
static StructInterface s_int =
{
FALSE /* run */
FALSE /* run */
};
@ -114,9 +116,7 @@ query (void)
{ PARAM_INT32, "direction", "Light direction (0 - 3)" },
{ PARAM_INT32, "depth", "Texture depth (1 - 50)" },
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
static gint nargs = sizeof (args) / sizeof (args[0]);
INIT_I18N();
@ -129,8 +129,8 @@ query (void)
N_("<Image>/Filters/Artistic/Apply Canvas..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
nargs, nreturn_vals,
args, return_vals);
nargs, 0,
args, NULL);
}
static void
@ -182,16 +182,19 @@ run (gchar *name,
case RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
if (nparams != 5)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
status = STATUS_CALLING_ERROR;
}
else
{
svals.direction = (gint) param[3].data.d_int32;
svals.depth = (gint) param[4].data.d_int32;
svals.depth = (gint) param[4].data.d_int32;
if (svals.direction < 0 || svals.direction > 4)
status = STATUS_CALLING_ERROR;
if (svals.depth < 1 || svals.depth > 50)
status = STATUS_CALLING_ERROR;
}
if(svals.direction<0 || svals.direction>4)
status = STATUS_CALLING_ERROR;
if(svals.depth<1 || svals.depth>50)
status = STATUS_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
@ -206,9 +209,10 @@ run (gchar *name,
if (status == STATUS_SUCCESS)
{
/* Make sure that the drawable is gray or RGB color */
if (gimp_drawable_is_rgb (drawable->id) || gimp_drawable_is_gray (drawable->id))
if (gimp_drawable_is_rgb (drawable->id) ||
gimp_drawable_is_gray (drawable->id))
{
gimp_progress_init ("struc");
gimp_progress_init (_("Applying Canvas..."));
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
strucpi (drawable);
@ -352,40 +356,40 @@ strucpi (GDrawable *drawable)
bytes = drawable->bpp;
/* allocate row buffers */
cur_row = (guchar *) malloc ((x2 - x1) * bytes);
dest = (guchar *) malloc ((x2 - x1) * bytes);
cur_row = g_new (guchar, (x2 - x1) * bytes);
dest = g_new (guchar, (x2 - x1) * bytes);
/* initialize the pixel regions */
gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
mult=(gfloat)svals.depth*0.25;
mult = (gfloat) svals.depth * 0.25;
switch(svals.direction)
{
case 0:
xm=1;
ym=128;
offs=0;
xm = 1;
ym = 128;
offs = 0;
break;
case 1:
xm=-1;
ym=128;
offs=127;
xm = -1;
ym = 128;
offs = 127;
break;
case 2:
xm=128;
ym=1;
offs=0;
xm = 128;
ym = 1;
offs = 0;
break;
case 3:
xm=128;
ym=-1;
offs=128;
xm = 128;
ym = -1;
offs = 128;
break;
default:
xm=1;
ym=128;
offs=0;
xm = 1;
ym = 128;
offs = 0;
break;
}
@ -416,18 +420,18 @@ strucpi (GDrawable *drawable)
case 4: /* RGB alpha */
for (col = 0; col < (x2 - x1) * bytes; col+=bytes)
{
varde = cur_row[col] + mult*sdata[rcol*xm+rrow*ym+offs];
varde = cur_row[col] + mult * sdata[rcol*xm+rrow*ym+offs];
if (varde > 255 ) varde = 255;
if (varde < 0) varde = 0;
*d++ = (guchar)varde;
varde = cur_row[col+1] + mult*sdata[rcol*xm+rrow*ym+offs];
*d++ = (guchar) varde;
varde = cur_row[col+1] + mult * sdata[rcol*xm+rrow*ym+offs];
if (varde > 255 ) varde = 255;
if (varde < 0) varde = 0;
*d++ = (guchar)varde;
varde = cur_row[col+2] + mult*sdata[rcol*xm+rrow*ym+offs];
*d++ = (guchar) varde;
varde = cur_row[col+2] + mult * sdata[rcol*xm+rrow*ym+offs];
if (varde > 255 ) varde = 255;
if (varde < 0) varde = 0;
*d++ = (guchar)varde;
*d++ = (guchar) varde;
if (bytes == 4)
*d++ = cur_row[col+3];
rcol++;
@ -442,7 +446,7 @@ strucpi (GDrawable *drawable)
if (rrow == 128) rrow = 0;
if ((row % 5) == 0)
gimp_progress_update ((double) row / (double) (y2 - y1));
gimp_progress_update ((gdouble) row / (gdouble) (y2 - y1));
}
/* update the textured region */