plug-ins/helpbrowser/helpbrowser.c plug-ins/ifscompose/ifscompose.c

2000-08-23  Sven Neumann  <sven@gimp.org>

	* plug-ins/helpbrowser/helpbrowser.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/imagemap/imap_main.c
	* plug-ins/imagemap/imap_preview.[ch]
	* plug-ins/maze/handy.c
	* plug-ins/maze/maze.c
	* plug-ins/maze/maze_face.c
	* plug-ins/mosaic/mosaic.c
	* plug-ins/pagecurl/pagecurl.c: removed COMPAT_CRUFT
This commit is contained in:
Sven Neumann 2000-08-23 10:23:19 +00:00 committed by Sven Neumann
parent 84e1b9549f
commit d4cdc5ccf3
12 changed files with 607 additions and 590 deletions

View File

@ -1,3 +1,15 @@
2000-08-23 Sven Neumann <sven@gimp.org>
* plug-ins/helpbrowser/helpbrowser.c
* plug-ins/ifscompose/ifscompose.c
* plug-ins/imagemap/imap_main.c
* plug-ins/imagemap/imap_preview.[ch]
* plug-ins/maze/handy.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze_face.c
* plug-ins/mosaic/mosaic.c
* plug-ins/pagecurl/pagecurl.c: removed COMPAT_CRUFT
2000-08-23 Sven Neumann <sven@gimp.org>
* plug-ins/common/threshold_alpha.c: avoid floating point exception

View File

@ -99,12 +99,12 @@ typedef struct
/* Declare local functions.
*/
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void mosaic (GDrawable *drawable);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void mosaic (GimpDrawable *drawable);
/* user interface functions */
static gint mosaic_dialog (void);
@ -112,14 +112,14 @@ static void mosaic_ok_callback (GtkWidget *widget,
gpointer data);
/* gradient finding machinery */
static void find_gradients (GDrawable *drawable,
gdouble std_dev);
static void find_max_gradient (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn);
static void find_gradients (GimpDrawable *drawable,
gdouble std_dev);
static void find_max_gradient (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn);
/* gaussian & 1st derivative */
static void gaussian_deriv (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn,
static void gaussian_deriv (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn,
gint direction,
gdouble std_dev,
gint * prog,
@ -152,10 +152,10 @@ static void grid_localize (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_render (GDrawable * drawable);
static void split_poly (Polygon * poly,
GDrawable * drawable,
guchar * col,
static void grid_render (GimpDrawable * drawable);
static void split_poly (Polygon * poly,
GimpDrawable * drawable,
guchar * col,
gdouble * dir,
gdouble color_vary);
static void clip_poly (gdouble * vec,
@ -171,11 +171,11 @@ static void clip_point (gdouble * dir,
Polygon * poly);
static void process_poly (Polygon * poly,
gint allow_split,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col,
gint vary);
static void render_poly (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col,
gdouble vary);
static void find_poly_dir (Polygon * poly,
@ -189,7 +189,7 @@ static void find_poly_dir (Polygon * poly,
gint x2,
gint y2);
static void find_poly_color (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col,
double vary);
static void scale_poly (Polygon * poly,
@ -197,10 +197,10 @@ static void scale_poly (Polygon * poly,
gdouble cy,
gdouble scale);
static void fill_poly_color (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col);
static void fill_poly_image (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
gdouble vary);
static void calc_spec_vec (SpecVec * vec,
gint xs,
@ -278,7 +278,7 @@ static MosaicInterface mint =
FALSE, /* run */
};
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
@ -292,24 +292,24 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_FLOAT, "tile_size", "Average diameter of each tile (in pixels)" },
{ PARAM_FLOAT, "tile_height", "Apparent height of each tile (in pixels)" },
{ PARAM_FLOAT, "tile_spacing", "Inter-tile spacing (in pixels)" },
{ PARAM_FLOAT, "tile_neatness", "Deviation from perfectly formed tiles (0.0 - 1.0)" },
{ PARAM_FLOAT, "light_dir", "Direction of light-source (in degrees)" },
{ PARAM_FLOAT, "color_variation", "Magnitude of random color variations (0.0 - 1.0)" },
{ PARAM_INT32, "antialiasing", "Enables smoother tile output at the cost of speed" },
{ PARAM_INT32, "color_averaging", "Tile color based on average of subsumed pixels" },
{ PARAM_INT32, "tile_type", "Tile geometry: { SQUARES (0), HEXAGONS (1), OCTAGONS (2) }" },
{ PARAM_INT32, "tile_surface", "Surface characteristics: { SMOOTH (0), ROUGH (1) }" },
{ PARAM_INT32, "grout_color", "Grout color (black/white or fore/background): { BW (0), FG_BG (1) }" }
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_FLOAT, "tile_size", "Average diameter of each tile (in pixels)" },
{ GIMP_PDB_FLOAT, "tile_height", "Apparent height of each tile (in pixels)" },
{ GIMP_PDB_FLOAT, "tile_spacing", "Inter-tile spacing (in pixels)" },
{ GIMP_PDB_FLOAT, "tile_neatness", "Deviation from perfectly formed tiles (0.0 - 1.0)" },
{ GIMP_PDB_FLOAT, "light_dir", "Direction of light-source (in degrees)" },
{ GIMP_PDB_FLOAT, "color_variation", "Magnitude of random color variations (0.0 - 1.0)" },
{ GIMP_PDB_INT32, "antialiasing", "Enables smoother tile output at the cost of speed" },
{ GIMP_PDB_INT32, "color_averaging", "Tile color based on average of subsumed pixels" },
{ GIMP_PDB_INT32, "tile_type", "Tile geometry: { SQUARES (0), HEXAGONS (1), OCTAGONS (2) }" },
{ GIMP_PDB_INT32, "tile_surface", "Surface characteristics: { SMOOTH (0), ROUGH (1) }" },
{ GIMP_PDB_INT32, "grout_color", "Grout color (black/white or fore/background): { BW (0), FG_BG (1) }" }
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
@ -324,33 +324,33 @@ query (void)
"1996",
N_("<Image>/Filters/Render/Pattern/Mosaic..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
GDrawable *active_drawable;
static GimpParam values[1];
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpDrawable *active_drawable;
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
switch (run_mode)
{
case RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_mosaic", &mvals);
@ -360,12 +360,12 @@ run (gchar *name,
return;
break;
case RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 14)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS)
{
mvals.tile_size = param[3].data.d_float;
mvals.tile_height = param[4].data.d_float;
@ -379,18 +379,18 @@ run (gchar *name,
mvals.tile_surface = param[12].data.d_int32;
mvals.grout_color = param[13].data.d_int32;
}
if (status == STATUS_SUCCESS &&
if (status == GIMP_PDB_SUCCESS &&
(mvals.tile_type < SQUARES || mvals.tile_type > OCTAGONS))
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS &&
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS &&
(mvals.tile_surface < SMOOTH || mvals.tile_surface > ROUGH))
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS &&
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS &&
(mvals.grout_color < BW || mvals.grout_color > FG_BG))
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
gimp_get_data ("plug_in_mosaic", &mvals);
break;
@ -403,7 +403,7 @@ run (gchar *name,
active_drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Create the mosaic */
if ((status == STATUS_SUCCESS) &&
if ((status == GIMP_PDB_SUCCESS) &&
(gimp_drawable_is_rgb (active_drawable->id) ||
gimp_drawable_is_gray (active_drawable->id)))
{
@ -416,17 +416,17 @@ run (gchar *name,
mosaic (active_drawable);
/* If the run mode is interactive, flush the displays */
if (run_mode != RUN_NONINTERACTIVE)
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store mvals data */
if (run_mode == RUN_INTERACTIVE)
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data ("plug_in_mosaic", &mvals, sizeof (MosaicVals));
}
else if (status == STATUS_SUCCESS)
else if (status == GIMP_PDB_SUCCESS)
{
/* gimp_message ("mosaic: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
values[0].data.d_status = status;
@ -435,7 +435,7 @@ run (gchar *name,
}
static void
mosaic (GDrawable *drawable)
mosaic (GimpDrawable *drawable)
{
gint x1, y1, x2, y2;
gint alpha;
@ -731,11 +731,11 @@ mosaic_ok_callback (GtkWidget *widget,
*/
static void
find_gradients (GDrawable *drawable,
gdouble std_dev)
find_gradients (GimpDrawable *drawable,
gdouble std_dev)
{
GPixelRgn src_rgn;
GPixelRgn dest_rgn;
GimpPixelRgn src_rgn;
GimpPixelRgn dest_rgn;
gint bytes;
gint width, height;
gint i, j;
@ -752,9 +752,9 @@ find_gradients (GDrawable *drawable,
bytes = drawable->bpp;
/* allocate the gradient maps */
h_grad = (guchar *) malloc (width * height);
v_grad = (guchar *) malloc (width * height);
m_grad = (guchar *) malloc (width * height);
h_grad = g_new (guchar, width * height);
v_grad = g_new (guchar, width * height);
m_grad = g_new (guchar, width * height);
/* Calculate total number of rows to be processed */
rows = width * 2 + height * 2;
@ -817,8 +817,8 @@ find_gradients (GDrawable *drawable,
static void
find_max_gradient (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn)
find_max_gradient (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn)
{
guchar *s, *d, *s_iter, *s_end;
gpointer pr;
@ -875,13 +875,13 @@ find_max_gradient (GPixelRgn *src_rgn,
static void
gaussian_deriv (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn,
gint type,
gdouble std_dev,
gint *prog,
gint max_prog,
gint ith_prog)
gaussian_deriv (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn,
gint type,
gdouble std_dev,
gint *prog,
gint max_prog,
gint ith_prog)
{
guchar *dest, *dp;
guchar *src, *sp, *s;
@ -907,7 +907,7 @@ gaussian_deriv (GPixelRgn *src_rgn,
/* allocate buffers for get/set pixel region rows/cols */
length = MAX (src_rgn->w, src_rgn->h) * bytes;
data = (guchar *) malloc (length * 2);
data = g_new (guchar, length * 2);
src = data;
dest = data + length;
@ -921,7 +921,7 @@ gaussian_deriv (GPixelRgn *src_rgn,
/* initialize */
curve = curve_array + length;
sum = sum_array + length;
buf = (gint *) malloc (sizeof (gint) * MAX ((x2 - x1), (y2 - y1)) * bytes);
buf = g_new (gint, MAX ((x2 - x1), (y2 - y1)) * bytes);
if (type == VERTICAL)
{
@ -1013,7 +1013,7 @@ gaussian_deriv (GPixelRgn *src_rgn,
gimp_pixel_rgn_set_col (dest_rgn, dest, col, y1, (y2 - y1));
if (! ((*prog)++ % ith_prog))
gimp_progress_update ((double) *prog / (double) max_prog);
gimp_progress_update ((gdouble) *prog / (gdouble) max_prog);
}
if (type == HORIZONTAL)
@ -1106,11 +1106,11 @@ gaussian_deriv (GPixelRgn *src_rgn,
gimp_pixel_rgn_set_row (dest_rgn, dest, x1, row, (x2 - x1));
if (! ((*prog)++ % ith_prog))
gimp_progress_update ((double) *prog / (double) max_prog);
gimp_progress_update ((gdouble) *prog / (gdouble) max_prog);
}
free (buf);
free (data);
g_free (buf);
g_free (data);
#ifndef UNOPTIMIZED_CODE
/* end bad hack */
#undef length
@ -1210,7 +1210,7 @@ grid_create_squares (gint x1,
rows = (height + size - 1) / size;
cols = (width + size - 1) / size;
grid = (Vertex *) malloc (sizeof (Vertex) * (cols + 2) * (rows + 2));
grid = g_new (Vertex, (cols + 2) * (rows + 2));
grid += (cols + 2) + 1;
for (i = -1; i <= rows; i++)
@ -1255,7 +1255,7 @@ grid_create_hexagons (gint x1,
rows = ((height + hex_height - 1) / hex_height);
cols = ((width + hex_width * 2 - 1) / hex_width);
grid = (Vertex *) malloc (sizeof (Vertex) * (cols + 2) * 4 * (rows + 2));
grid = g_new (Vertex, (cols + 2) * 4 * (rows + 2));
grid += (cols + 2) * 4 + 4;
for (i = -1; i <= rows; i++)
@ -1306,7 +1306,7 @@ grid_create_octagons (gint x1,
rows = ((height + oct_size - 1) / oct_size);
cols = ((width + oct_size * 2 - 1) / oct_size);
grid = (Vertex *) malloc (sizeof (Vertex) * (cols + 2) * 8 * (rows + 2));
grid = g_new (Vertex, (cols + 2) * 8 * (rows + 2));
grid += (cols + 2) * 8 + 8;
for (i = -1; i < rows + 1; i++)
@ -1409,9 +1409,9 @@ grid_localize (gint x1,
static void
grid_render (GDrawable *drawable)
grid_render (GimpDrawable *drawable)
{
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
gint i, j, k;
gint x1, y1, x2, y2;
guchar *data;
@ -1595,11 +1595,11 @@ grid_render (GDrawable *drawable)
static void
process_poly (Polygon *poly,
gint allow_split,
GDrawable *drawable,
guchar *col,
gint vary)
process_poly (Polygon *poly,
gint allow_split,
GimpDrawable *drawable,
guchar *col,
gint vary)
{
gdouble dir[2];
gdouble loc[2];
@ -1637,10 +1637,10 @@ process_poly (Polygon *poly,
static void
render_poly (Polygon *poly,
GDrawable *drawable,
guchar *col,
gdouble vary)
render_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble vary)
{
gdouble cx, cy;
@ -1659,11 +1659,11 @@ render_poly (Polygon *poly,
static void
split_poly (Polygon *poly,
GDrawable *drawable,
guchar *col,
gdouble *dir,
gdouble vary)
split_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble *dir,
gdouble vary)
{
Polygon new_poly;
gdouble spacing;
@ -1721,13 +1721,13 @@ split_poly (Polygon *poly,
static void
clip_poly (double *dir,
double *pt,
Polygon *poly,
Polygon *poly_new)
clip_poly (gdouble *dir,
gdouble *pt,
Polygon *poly,
Polygon *poly_new)
{
int i;
double x1, y1, x2, y2;
gint i;
gdouble x1, y1, x2, y2;
for (i = 0; i < poly->npts; i++)
{
@ -1837,15 +1837,15 @@ find_poly_dir (Polygon *poly,
loc[1] = 0.0;
polygon_extents (poly, &dmin_x, &dmin_y, &dmax_x, &dmax_y);
min_x = (int) dmin_x;
min_y = (int) dmin_y;
max_x = (int) dmax_x;
max_y = (int) dmax_y;
min_x = (gint) dmin_x;
min_y = (gint) dmin_y;
max_x = (gint) dmax_x;
max_y = (gint) dmax_y;
size_y = max_y - min_y;
size_x = max_x - min_x;
min_scanlines = (int *) malloc (sizeof (int) * size_y);
max_scanlines = (int *) malloc (sizeof (int) * size_y);
min_scanlines = g_new (gint, size_y);
max_scanlines = g_new (gint, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x;
@ -1854,10 +1854,10 @@ find_poly_dir (Polygon *poly,
for (i = 0; i < poly->npts; i++)
{
xs = (int) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (int) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (int) poly->pts[i].x;
ye = (int) poly->pts[i].y;
xs = (gint) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (gint) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (gint) poly->pts[i].x;
ye = (gint) poly->pts[i].y;
convert_segment (xs, ys, xe, ye, min_y,
min_scanlines, max_scanlines);
@ -1907,18 +1907,18 @@ find_poly_dir (Polygon *poly,
loc[1] = 0.0;
}
free (min_scanlines);
free (max_scanlines);
g_free (min_scanlines);
g_free (max_scanlines);
}
static void
find_poly_color (Polygon *poly,
GDrawable *drawable,
guchar *col,
gdouble color_var)
find_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble color_var)
{
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
gdouble dmin_x, dmin_y;
gdouble dmax_x, dmax_y;
gint xs, ys;
@ -1948,8 +1948,8 @@ find_poly_color (Polygon *poly,
size_y = max_y - min_y;
size_x = max_x - min_x;
min_scanlines = (gint *) malloc (sizeof (gint) * size_y);
max_scanlines = (gint *) malloc (sizeof (gint) * size_y);
min_scanlines = g_new (int, size_y);
max_scanlines = g_new (int, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x;
@ -2002,8 +2002,8 @@ find_poly_color (Polygon *poly,
col[b] = col_sum[b];
}
free (min_scanlines);
free (max_scanlines);
g_free (min_scanlines);
g_free (max_scanlines);
}
@ -2020,11 +2020,11 @@ scale_poly (Polygon *poly,
static void
fill_poly_color (Polygon *poly,
GDrawable *drawable,
guchar *col)
fill_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col)
{
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
gdouble dmin_x, dmin_y;
gdouble dmax_x, dmax_y;
gint xs, ys;
@ -2046,7 +2046,7 @@ fill_poly_color (Polygon *poly,
gint supersample2;
gint x1, y1, x2, y2;
Vertex *pts_tmp;
const int poly_npts = poly->npts;
const gint poly_npts = poly->npts;
/* Determine antialiasing */
if (mvals.antialiasing)
@ -2094,8 +2094,8 @@ fill_poly_color (Polygon *poly,
size_y = (max_y - min_y) * supersample;
size_x = (max_x - min_x) * supersample;
min_scanlines = min_scanlines_iter = (gint *) malloc (sizeof (gint) * size_y);
max_scanlines = max_scanlines_iter = (gint *) malloc (sizeof (gint) * size_y);
min_scanlines = min_scanlines_iter = g_new (gint, size_y);
max_scanlines = max_scanlines_iter = g_new (gint, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x * supersample;
@ -2141,7 +2141,7 @@ fill_poly_color (Polygon *poly,
drawable->width, drawable->height,
TRUE, TRUE);
vals = (gint *) malloc (sizeof (gint) * size_x);
vals = g_new (gint, size_x);
for (i = 0; i < size_y; i++, min_scanlines_iter++, max_scanlines_iter++)
{
if (! (i % supersample))
@ -2193,18 +2193,18 @@ fill_poly_color (Polygon *poly,
}
}
free (vals);
free (min_scanlines);
free (max_scanlines);
g_free (vals);
g_free (min_scanlines);
g_free (max_scanlines);
}
static void
fill_poly_image (Polygon *poly,
GDrawable *drawable,
gdouble vary)
fill_poly_image (Polygon *poly,
GimpDrawable *drawable,
gdouble vary)
{
GPixelRgn src_rgn, dest_rgn;
GimpPixelRgn src_rgn, dest_rgn;
gdouble dmin_x, dmin_y;
gdouble dmax_x, dmax_y;
gint xs, ys;
@ -2258,8 +2258,8 @@ fill_poly_image (Polygon *poly,
size_y = (max_y - min_y) * supersample;
size_x = (max_x - min_x) * supersample;
min_scanlines = (gint *) malloc (sizeof (gint) * size_y);
max_scanlines = (gint *) malloc (sizeof (gint) * size_y);
min_scanlines = g_new (gint, size_y);
max_scanlines = g_new (gint, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x * supersample;
@ -2288,7 +2288,7 @@ fill_poly_image (Polygon *poly,
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0,
drawable->width, drawable->height,
TRUE, TRUE);
vals = (gint *) malloc (sizeof (gint) * size_x);
vals = g_new (gint, size_x);
for (i = 0; i < size_y; i++)
{
if (! (i % supersample))
@ -2351,9 +2351,9 @@ fill_poly_image (Polygon *poly,
}
}
free (vals);
free (min_scanlines);
free (max_scanlines);
g_free (vals);
g_free (min_scanlines);
g_free (max_scanlines);
}

View File

@ -178,13 +178,13 @@ static guint n_help_dnd_targets = (sizeof (help_dnd_target_table) /
/* GIMP plugin stuff */
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
@ -547,10 +547,10 @@ xmhtml_activate (GtkWidget *html,
/* try to call netscape through the web_browser interface */
return_vals = gimp_run_procedure ("extension_web_browser",
&nreturn_vals,
PARAM_INT32, RUN_NONINTERACTIVE,
PARAM_STRING, cbs->href,
PARAM_INT32, FALSE,
PARAM_END);
GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
GIMP_PDB_STRING, cbs->href,
GIMP_PDB_INT32, FALSE,
GIMP_PDB_END);
gimp_destroy_params (return_vals, nreturn_vals);
break;
}
@ -997,14 +997,14 @@ idle_load_page (gpointer data)
}
static void
run_temp_proc (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run_temp_proc (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gchar *help_path;
gchar *locale;
gchar *help_file;
@ -1051,7 +1051,7 @@ run_temp_proc (gchar *name,
*nreturn_vals = 1;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
@ -1074,12 +1074,12 @@ input_callback (GIOChannel *channel,
static void
install_temp_proc (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_STRING, "help_path", "" },
{ PARAM_STRING, "locale", "Langusge to use" },
{ PARAM_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
{ GIMP_PDB_STRING, "help_path", "" },
{ GIMP_PDB_STRING, "locale", "Langusge to use" },
{ GIMP_PDB_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
@ -1092,7 +1092,7 @@ install_temp_proc (void)
"1999",
NULL,
"",
PROC_TEMPORARY,
GIMP_TEMPORARY,
nargs, 0,
args, NULL,
run_temp_proc);
@ -1122,13 +1122,13 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive" },
{ PARAM_STRING, "help_path", "" },
{ PARAM_STRING, "locale", "Language to use" },
{ PARAM_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
{ GIMP_PDB_INT32, "run_mode", "Interactive" },
{ GIMP_PDB_STRING, "help_path", "" },
{ GIMP_PDB_STRING, "locale", "Language to use" },
{ GIMP_PDB_STRING, "help_file", "Path of a local document to open. "
"Can be relative to GIMP_HELP_PATH." }
};
static gint nargs = sizeof (args) / sizeof (args[0]);
@ -1142,28 +1142,28 @@ query (void)
"1999",
NULL,
"",
PROC_EXTENSION,
GIMP_EXTENSION,
nargs, 0,
args, NULL);
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gchar *help_path = NULL;
gchar *locale = NULL;
gchar *help_file = NULL;
run_mode = param[0].data.d_int32;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
*nreturn_vals = 1;
@ -1175,9 +1175,9 @@ run (gchar *name,
{
switch (run_mode)
{
case RUN_INTERACTIVE:
case RUN_NONINTERACTIVE:
case RUN_WITH_LAST_VALS:
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
/* set default values */
help_path = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S,
GIMP_HELP_PREFIX, NULL);
@ -1208,16 +1208,16 @@ run (gchar *name,
break;
default:
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
break;
}
if (status == STATUS_SUCCESS)
if (status == GIMP_PDB_SUCCESS)
{
if (!open_url (help_path, locale, help_file))
values[0].data.d_status = STATUS_EXECUTION_ERROR;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
else
values[0].data.d_status = STATUS_SUCCESS;
values[0].data.d_status = GIMP_PDB_SUCCESS;
g_free (help_path);
g_free (locale);
@ -1227,5 +1227,5 @@ run (gchar *name,
values[0].data.d_status = status;
}
else
values[0].data.d_status = STATUS_CALLING_ERROR;
values[0].data.d_status = GIMP_PDB_CALLING_ERROR;
}

View File

@ -177,7 +177,7 @@ typedef struct
AffElementVals current_vals;
gint auto_preview;
gint in_update; /* true if we're currently in
gboolean in_update; /* true if we're currently in
update_values() - don't do anything
on updates */
} IfsDialog;
@ -190,14 +190,14 @@ typedef struct
/* Declare local functions.
*/
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
/* user interface functions */
static gint ifs_compose_dialog (GDrawable *drawable);
static gint ifs_compose_dialog (GimpDrawable *drawable);
static void ifs_options_dialog (void);
static GtkWidget *ifs_compose_trans_page (void);
static GtkWidget *ifs_compose_color_page (void);
@ -229,42 +229,47 @@ static void undo_exchange (gint el);
static void undo (void);
static void redo (void);
static void recompute_center (int save_undo);
static void recompute_center_cb (GtkWidget *, gpointer);
static void recompute_center (gboolean save_undo);
static void recompute_center_cb (GtkWidget *widget,
gpointer data);
static void ifs_compose (GDrawable *drawable);
static void ifs_compose (GimpDrawable *drawable);
static void color_map_set_preview_color (GtkWidget *preview,
IfsColor *color);
static ColorMap *color_map_create (gchar *name,IfsColor *orig_color,
IfsColor *data, gint fixed_point);
static void color_map_color_changed_cb (GtkWidget *widget,
ColorMap *color_map);
static void color_map_update (ColorMap *color_map);
static void color_map_set_preview_color (GtkWidget *preview,
IfsColor *color);
static ColorMap *color_map_create (gchar *name,
IfsColor *orig_color,
IfsColor *data,
gint fixed_point);
static void color_map_color_changed_cb (GtkWidget *widget,
ColorMap *color_map);
static void color_map_update (ColorMap *color_map);
/* interface functions */
static void simple_color_toggled (GtkWidget *widget,gpointer data);
static void simple_color_set_sensitive (void);
static void val_changed_update (void);
static ValuePair *value_pair_create (gpointer data,
gdouble lower, gdouble upper,
gboolean create_scale, ValuePairType type);
static void value_pair_update (ValuePair *value_pair);
static void value_pair_entry_callback (GtkWidget *w,
ValuePair *value_pair);
static void value_pair_destroy_callback (GtkWidget *widget,
ValuePair *value_pair);
static void value_pair_button_release (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
static void value_pair_scale_callback (GtkAdjustment *adjustment,
ValuePair *value_pair);
static void simple_color_toggled (GtkWidget *widget,gpointer data);
static void simple_color_set_sensitive (void);
static void val_changed_update (void);
static ValuePair *value_pair_create (gpointer data,
gdouble lower,
gdouble upper,
gboolean create_scale,
ValuePairType type);
static void value_pair_update (ValuePair *value_pair);
static void value_pair_entry_callback (GtkWidget *w,
ValuePair *value_pair);
static void value_pair_destroy_callback (GtkWidget *widget,
ValuePair *value_pair);
static void value_pair_button_release (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
static void value_pair_scale_callback (GtkAdjustment *adjustment,
ValuePair *value_pair);
static void auto_preview_callback (GtkWidget *widget, gpointer data);
static void design_op_callback (GtkWidget *widget, gpointer data);
static void design_op_update_callback (GtkWidget *widget, gpointer data);
static void flip_check_button_callback (GtkWidget *widget, gpointer data);
static gint preview_idle_render (void);
static void auto_preview_callback (GtkWidget *widget, gpointer data);
static void design_op_callback (GtkWidget *widget, gpointer data);
static void design_op_update_callback (GtkWidget *widget, gpointer data);
static void flip_check_button_callback (GtkWidget *widget, gpointer data);
static gint preview_idle_render (void);
static void ifs_compose_set_defaults (void);
static void ifs_compose_defaults_callback (GtkWidget *widget,
@ -316,7 +321,7 @@ static IfsComposeInterface ifscint =
FALSE, /* run */
};
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
@ -330,14 +335,14 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
@ -346,40 +351,40 @@ query (void)
gimp_install_procedure ("plug_in_ifs_compose",
"Create an Iterated Function System Fractal",
"Interactively create an Iterated Function System fractal."
"Use the window on the upper left to adjust the component"
"transformations of the fractal. The operation that is performed"
"is selected by the buttons underneath the window, or from a"
"menu popped up by the right mouse button. The fractal will be"
"rendered with a transparent background if the current image has"
"a transparent background.",
"Interactively create an Iterated Function System fractal. "
"Use the window on the upper left to adjust the component "
"transformations of the fractal. The operation that is performed "
"is selected by the buttons underneath the window, or from a "
"menu popped up by the right mouse button. The fractal will be "
"rendered with a transparent background if the current image has "
"a transparent background.",
"Owen Taylor",
"Owen Taylor",
"1997",
N_("<Image>/Filters/Render/Nature/IfsCompose..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GDrawable *active_drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
GimpParasite *parasite = NULL;
gboolean found_parasite;
static GimpParam values[1];
GimpDrawable *active_drawable;
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpParasite *parasite = NULL;
gboolean found_parasite;
run_mode = param[0].data.d_int32;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
*nreturn_vals = 1;
@ -394,7 +399,7 @@ run (gchar *name,
switch (run_mode)
{
case RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE:
/* Possibly retrieve data; first look for a parasite -
* if not found, fall back to global values
*/
@ -429,14 +434,14 @@ run (gchar *name,
return;
break;
case RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
/* gimp_get_data ("plug_in_ifs_compose", &mvals); */
break;
@ -445,7 +450,7 @@ run (gchar *name,
}
/* Render the fractal */
if ((status == STATUS_SUCCESS) &&
if ((status == GIMP_PDB_SUCCESS) &&
(gimp_drawable_is_rgb (active_drawable->id) ||
gimp_drawable_is_gray (active_drawable->id)))
{
@ -457,13 +462,13 @@ run (gchar *name,
ifs_compose (active_drawable);
/* If the run mode is interactive, flush the displays */
if (run_mode != RUN_NONINTERACTIVE)
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store data for next invocation - both globally and
* as a parasite on this layer
*/
if (run_mode == RUN_INTERACTIVE)
if (run_mode == GIMP_RUN_INTERACTIVE)
{
gchar *str = ifsvals_stringify (&ifsvals, elements);
GimpParasite *parasite;
@ -479,9 +484,9 @@ run (gchar *name,
g_free (str);
}
}
else if (status == STATUS_SUCCESS)
else if (status == GIMP_PDB_SUCCESS)
{
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
values[0].data.d_status = status;
@ -611,8 +616,8 @@ ifs_compose_color_page (void)
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
GSList *group = NULL;
IfsColor color;
GSList *group = NULL;
IfsColor color;
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
@ -721,7 +726,7 @@ ifs_compose_color_page (void)
}
static gint
ifs_compose_dialog (GDrawable *drawable)
ifs_compose_dialog (GimpDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *label;
@ -1104,7 +1109,7 @@ design_area_create (GtkWidget *window,
static void
design_op_menu_create (GtkWidget *window)
{
GtkWidget *menu_item;
GtkWidget *menu_item;
GtkAccelGroup *accel_group;
ifsDesign->op_menu = gtk_menu_new();
@ -1316,10 +1321,10 @@ ifs_options_dialog (void)
}
static void
ifs_compose (GDrawable *drawable)
ifs_compose (GimpDrawable *drawable)
{
gint i,j;
GDrawableType type = gimp_drawable_type(drawable->id);
GimpImageType type = gimp_drawable_type (drawable->id);
gchar *buffer;
gint width = drawable->width;
@ -1349,7 +1354,7 @@ ifs_compose (GDrawable *drawable)
guchar *dest;
guchar *destrow;
guchar maskval;
GPixelRgn dest_rgn;
GimpPixelRgn dest_rgn;
gint progress;
gint max_progress;
@ -1430,27 +1435,27 @@ ifs_compose (GDrawable *drawable)
/* and store it */
switch (type)
{
case GRAY_IMAGE:
case GIMP_GRAY_IMAGE:
*dest++ = (mtot*(rtot+btot+gtot)+
(255-mtot)*(rc+gc+bc))/(3*255);
break;
case GRAYA_IMAGE:
case GIMP_GRAYA_IMAGE:
*dest++ = (rtot+btot+gtot)/3;
*dest++ = mtot;
break;
case RGB_IMAGE:
case GIMP_RGB_IMAGE:
*dest++ = (mtot*rtot + (255-mtot)*rc)/255;
*dest++ = (mtot*gtot + (255-mtot)*gc)/255;
*dest++ = (mtot*btot + (255-mtot)*bc)/255;
break;
case RGBA_IMAGE:
case GIMP_RGBA_IMAGE:
*dest++ = rtot;
*dest++ = gtot;
*dest++ = btot;
*dest++ = mtot;
break;
case INDEXED_IMAGE:
case INDEXEDA_IMAGE:
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
g_error("Indexed images not supported by IfsCompose");
break;
}
@ -1576,7 +1581,7 @@ static gint
design_area_configure (GtkWidget *widget,
GdkEventConfigure *event)
{
int i;
gint i;
gdouble width = widget->allocation.width;
gdouble height = widget->allocation.height;
@ -2342,32 +2347,32 @@ design_op_update_callback (GtkWidget *widget,
switch (op)
{
case OP_TRANSLATE:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ifsD->move_button),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ifsD->move_button),
TRUE);
break;
case OP_ROTATE:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ifsD->rotate_button),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ifsD->rotate_button),
TRUE);
break;
case OP_STRETCH:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ifsD->stretch_button),
TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ifsD->stretch_button),
TRUE);
break;
}
}
}
static void
recompute_center_cb (GtkWidget *w,
recompute_center_cb (GtkWidget *widget,
gpointer data)
{
recompute_center(TRUE);
recompute_center (TRUE);
}
static void
recompute_center (int save_undo)
recompute_center (gboolean save_undo)
{
int i;
gint i;
gdouble x,y;
gdouble center_x = 0.0;
gdouble center_y = 0.0;

View File

@ -108,12 +108,12 @@ static gpointer _button_press_param;
static void query (void);
static void run (char *name,
int nparams,
GParam * param,
GimpParam * param,
int *nreturn_vals,
GParam ** return_vals);
static gint dialog(GDrawable *drawable);
GimpParam ** return_vals);
static gint dialog(GimpDrawable *drawable);
GPlugInInfo PLUG_IN_INFO = {
GimpPlugInInfo PLUG_IN_INFO = {
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
@ -127,12 +127,12 @@ MAIN ()
static void query()
{
static GParamDef args[] = {
{PARAM_INT32, "run_mode", "Interactive"},
{PARAM_IMAGE, "image", "Input image (unused)"},
{PARAM_DRAWABLE, "drawable", "Input drawable"},
static GimpParamDef args[] = {
{GIMP_PDB_INT32, "run_mode", "Interactive"},
{GIMP_PDB_IMAGE, "image", "Input image (unused)"},
{GIMP_PDB_DRAWABLE, "drawable", "Input drawable"},
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
@ -144,19 +144,19 @@ static void query()
"1998-1999",
N_("<Image>/Filters/Web/ImageMap..."),
"RGB*, GRAY*, INDEXED*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
}
static void
run(char *name, int n_params, GParam *param, int *nreturn_vals,
GParam **return_vals)
run(char *name, int n_params, GimpParam *param, int *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GDrawable *drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpDrawable *drawable;
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
INIT_I18N_UI();
@ -171,20 +171,20 @@ run(char *name, int n_params, GParam *param, int *nreturn_vals,
_map_info.color = gimp_drawable_is_rgb(drawable->id);
run_mode = (GRunModeType) param[0].data.d_int32;
run_mode = (GimpRunModeType) param[0].data.d_int32;
if (run_mode == RUN_INTERACTIVE) {
if (run_mode == GIMP_RUN_INTERACTIVE) {
if (!dialog(drawable)) {
/* The dialog was closed, or something similarly evil happened. */
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
}
if (status == STATUS_SUCCESS) {
if (status == GIMP_PDB_SUCCESS) {
gimp_drawable_detach(drawable);
}
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
@ -1315,7 +1315,7 @@ factory_move_down(void)
}
static gint
dialog(GDrawable *drawable)
dialog(GimpDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *hbox;

View File

@ -72,7 +72,7 @@ preview_get_height(GtkWidget *preview)
}
static void
render_gray_image(GtkWidget *preview, GPixelRgn *srcrgn)
render_gray_image(GtkWidget *preview, GimpPixelRgn *srcrgn)
{
guchar *src_row, *dest_row, *src, *dest;
gint row, col;
@ -119,7 +119,7 @@ render_gray_image(GtkWidget *preview, GPixelRgn *srcrgn)
}
static void
render_indexed_image(GtkWidget *preview, GPixelRgn *srcrgn)
render_indexed_image(GtkWidget *preview, GimpPixelRgn *srcrgn)
{
guchar *src_row, *dest_row, *src, *dest;
gint row, col;
@ -183,7 +183,7 @@ render_indexed_image(GtkWidget *preview, GPixelRgn *srcrgn)
}
static void
render_rgb_image(GtkWidget *preview, GPixelRgn *srcrgn)
render_rgb_image(GtkWidget *preview, GimpPixelRgn *srcrgn)
{
guchar *src_row, *dest_row, *src, *dest;
gint row, col;
@ -260,19 +260,19 @@ render_rgb_image(GtkWidget *preview, GPixelRgn *srcrgn)
}
static void
render_preview(GtkWidget *preview, GPixelRgn *srcrgn)
render_preview(GtkWidget *preview, GimpPixelRgn *srcrgn)
{
switch (gimp_drawable_type(srcrgn->drawable->id)) {
case RGB_IMAGE:
case RGBA_IMAGE:
case GIMP_RGB_IMAGE:
case GIMP_RGBA_IMAGE:
render_rgb_image(preview, srcrgn);
break;
case GRAY_IMAGE:
case GRAYA_IMAGE:
case GIMP_GRAY_IMAGE:
case GIMP_GRAYA_IMAGE:
render_gray_image(preview, srcrgn);
break;
case INDEXED_IMAGE:
case INDEXEDA_IMAGE:
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
render_indexed_image(preview, srcrgn);
break;
}
@ -388,7 +388,7 @@ handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
}
Preview_t*
make_preview(GDrawable *drawable)
make_preview(GimpDrawable *drawable)
{
Preview_t *data = g_new(Preview_t, 1);
GtkWidget *preview;

View File

@ -28,7 +28,7 @@
#include "gtk/gtk.h"
typedef struct {
GDrawable *drawable;
GimpDrawable *drawable;
GtkWidget *window;
GtkWidget *frame;
GtkWidget *preview;
@ -37,12 +37,12 @@ typedef struct {
gint width;
gint height;
gint exp_id;
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
GdkCursorType cursor;
} Preview_t;
Preview_t *make_preview(GDrawable *drawable);
Preview_t *make_preview(GimpDrawable *drawable);
void preview_redraw(Preview_t *preview);
void add_preview_motion_event(Preview_t *preview, GtkSignalFunc func);

View File

@ -31,13 +31,13 @@
nice little arrays. It works nicely for RGB and grayscale images,
however handling of indexed images is somewhat broken. Patches
appreciated. */
void get_colors (GDrawable * drawable,
void get_colors (GimpDrawable * drawable,
guint8 *fg,
guint8 *bg);
/* drawbox draws a solid colored box in a GPixelRgn, hopefully fairly
/* drawbox draws a solid colored box in a GimpPixelRgn, hopefully fairly
quickly. See comments below. */
void drawbox (GPixelRgn *dest_rgn,
void drawbox (GimpPixelRgn *dest_rgn,
guint x,
guint y,
guint w,
@ -46,20 +46,20 @@ void drawbox (GPixelRgn *dest_rgn,
void
get_colors (GDrawable *drawable,
get_colors (GimpDrawable *drawable,
guint8 *fg,
guint8 *bg)
{
switch ( gimp_drawable_type (drawable->id) )
{
case RGBA_IMAGE: /* ASSUMPTION: Assuming the user wants entire */
case GIMP_RGBA_IMAGE: /* ASSUMPTION: Assuming the user wants entire */
fg[3] = 255; /* area to be fully opaque. */
bg[3] = 255;
case RGB_IMAGE:
case GIMP_RGB_IMAGE:
gimp_palette_get_foreground (&fg[0], &fg[1], &fg[2]);
gimp_palette_get_background (&bg[0], &bg[1], &bg[2]);
break;
case GRAYA_IMAGE: /* and again */
case GIMP_GRAYA_IMAGE: /* and again */
gimp_palette_get_foreground (&fg[0], &fg[1], &fg[2]);
gimp_palette_get_background (&bg[0], &bg[1], &bg[2]);
fg[0] = INTENSITY (fg[0], fg[1], fg[2]);
@ -67,14 +67,14 @@ get_colors (GDrawable *drawable,
fg[1] = 255;
bg[1] = 255;
break;
case GRAY_IMAGE:
case GIMP_GRAY_IMAGE:
gimp_palette_get_foreground (&fg[0], &fg[1], &fg[2]);
gimp_palette_get_background (&bg[0], &bg[1], &bg[2]);
fg[0] = INTENSITY (fg[0], fg[1], fg[2]);
bg[0] = INTENSITY (bg[0], bg[1], bg[2]);
break;
case INDEXEDA_IMAGE:
case INDEXED_IMAGE: /* FIXME: Should use current fg/bg colors. */
case GIMP_INDEXEDA_IMAGE:
case GIMP_INDEXED_IMAGE: /* FIXME: Should use current fg/bg colors. */
g_warning("maze: get_colors: Indexed image. Using colors 15 and 0.\n");
fg[0] = 15; /* As a plugin, I protest. *I* shouldn't be the */
bg[0] = 0; /* one who has to deal with this colormapcrap. */
@ -84,7 +84,7 @@ get_colors (GDrawable *drawable,
}
}
/* Draws a solid color box in a GPixelRgn. */
/* Draws a solid color box in a GimpPixelRgn. */
/* Optimization assumptions:
* (Or, "Why Maze is Faster Than Checkerboard.")
*
@ -114,7 +114,7 @@ get_colors (GDrawable *drawable,
* re-fill it every time... */
void
drawbox( GPixelRgn *dest_rgn,
drawbox( GimpPixelRgn *dest_rgn,
guint x, guint y, guint w, guint h,
guint8 clr[4])
{

View File

@ -61,10 +61,10 @@ extern gint maze_dialog (void);
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
GimpParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void maze (GDrawable * drawable);
GimpParam **return_vals);
static void maze (GimpDrawable * drawable);
static void mask_maze(gint32 selection_ID, guchar *maz, guint mw, guint mh,
gint x1, gint x2, gint y1, gint y2, gint deadx, gint deady);
@ -91,18 +91,18 @@ extern void prim_tileable(guchar *maz,
gint rnd);
/* In handy.c */
extern void get_colors (GDrawable * drawable,
extern void get_colors (GimpDrawable * drawable,
guint8 *fg,
guint8 *bg);
extern void drawbox (GPixelRgn *dest_rgn,
extern void drawbox (GimpPixelRgn *dest_rgn,
guint x,
guint y,
guint w,
guint h,
guint8 clr[4]);
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
@ -131,22 +131,22 @@ MAIN () /*;*/
static void
query ()
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image_ID", "(unused)" },
{ PARAM_DRAWABLE, "drawable_ID", "ID of drawable" },
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image_ID", "(unused)" },
{ GIMP_PDB_DRAWABLE, "drawable_ID", "ID of drawable" },
/* If we did have parameters, these be them: */
{ PARAM_INT16, "width", "Width of the passages" },
{ PARAM_INT16, "height", "Height of the passages"},
{ PARAM_INT8, "tileable", "Tileable maze?"},
{ PARAM_INT8, "algorithm", "Generation algorithm"
{ GIMP_PDB_INT16, "width", "Width of the passages" },
{ GIMP_PDB_INT16, "height", "Height of the passages"},
{ GIMP_PDB_INT8, "tileable", "Tileable maze?"},
{ GIMP_PDB_INT8, "algorithm", "Generation algorithm"
"(0=DEPTH FIRST, 1=PRIM'S ALGORITHM)" },
{ PARAM_INT32, "seed", "Random Seed"},
{ PARAM_INT16, "multiple", "Multiple (use 57)" },
{ PARAM_INT16, "offset", "Offset (use 1)" }
{ GIMP_PDB_INT32, "seed", "Random Seed"},
{ GIMP_PDB_INT16, "multiple", "Multiple (use 57)" },
{ GIMP_PDB_INT16, "offset", "Offset (use 1)" }
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
gchar *help;
@ -160,7 +160,7 @@ query ()
"1997, 1998",
N_("<Image>/Filters/Render/Pattern/Maze..."),
"RGB*, GRAY*, INDEXED*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
g_free (help);
@ -169,14 +169,14 @@ query ()
static void
run (gchar *name,
gint nparams,
GParam *param,
GimpParam *param,
gint *nreturn_vals,
GParam **return_vals)
GimpParam **return_vals)
{
static GParam values[1];
GDrawable *drawable;
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
static GimpParam values[1];
GimpDrawable *drawable;
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint x1, y1, x2, y2;
#ifdef MAZE_DEBUG
@ -189,14 +189,14 @@ run (gchar *name,
INIT_I18N_UI();
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
drawable = gimp_drawable_get (param[2].data.d_drawable);
switch (run_mode)
{
case RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE:
/* Possibly retrieve data */
gimp_get_data ("plug_in_maze", &mvals);
@ -211,12 +211,12 @@ run (gchar *name,
}
break;
case RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
if (nparams != 10)
{
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
}
if (status == STATUS_SUCCESS)
if (status == GIMP_PDB_SUCCESS)
{
mvals.width = (gint16) param[3].data.d_int16;
mvals.height = (gint16) param[4].data.d_int16;
@ -227,7 +227,7 @@ run (gchar *name,
mvals.offset = (gint16) param[9].data.d_int16;
}
break;
case RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
gimp_get_data ("plug_in_maze", &mvals);
break;
@ -241,14 +241,14 @@ run (gchar *name,
maze (drawable);
if (run_mode != RUN_NONINTERACTIVE)
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
if (run_mode == RUN_INTERACTIVE ||
(mvals.timeseed && run_mode == RUN_WITH_LAST_VALS))
if (run_mode == GIMP_RUN_INTERACTIVE ||
(mvals.timeseed && run_mode == GIMP_RUN_WITH_LAST_VALS))
gimp_set_data ("plug_in_maze", &mvals, sizeof (MazeValues));
} else {
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
values[0].data.d_status = status;
@ -285,9 +285,9 @@ maze_dumpX(guchar *maz, gint mw, gint mh)
#endif
static void
maze( GDrawable * drawable)
maze( GimpDrawable * drawable)
{
GPixelRgn dest_rgn;
GimpPixelRgn dest_rgn;
guint mw, mh;
gint deadx, deady;
guint progress, max_progress;
@ -508,7 +508,7 @@ mask_maze(gint32 drawable_ID, guchar *maz, guint mw, guint mh,
gint x1, gint x2, gint y1, gint y2, gint deadx, gint deady)
{
gint32 selection_ID;
GPixelRgn sel_rgn;
GimpPixelRgn sel_rgn;
gint xx0=0, yy0=0, xoff, yoff;
guint xx=0, yy=0;
guint foo=0;

View File

@ -601,10 +601,10 @@ maze_help (GtkWidget *widget,
maze_msg (message);
g_free (message);
gimp_run_procedure ("extension_web_browser", &baz,
PARAM_INT32, RUN_NONINTERACTIVE,
PARAM_STRING, MAZE_URL,
PARAM_INT32, HELP_OPENS_NEW_WINDOW,
PARAM_END);
GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
GIMP_PDB_STRING, MAZE_URL,
GIMP_PDB_INT32, HELP_OPENS_NEW_WINDOW,
GIMP_PDB_END);
}
else
{

View File

@ -99,12 +99,12 @@ typedef struct
/* Declare local functions.
*/
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void mosaic (GDrawable *drawable);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void mosaic (GimpDrawable *drawable);
/* user interface functions */
static gint mosaic_dialog (void);
@ -112,14 +112,14 @@ static void mosaic_ok_callback (GtkWidget *widget,
gpointer data);
/* gradient finding machinery */
static void find_gradients (GDrawable *drawable,
gdouble std_dev);
static void find_max_gradient (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn);
static void find_gradients (GimpDrawable *drawable,
gdouble std_dev);
static void find_max_gradient (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn);
/* gaussian & 1st derivative */
static void gaussian_deriv (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn,
static void gaussian_deriv (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn,
gint direction,
gdouble std_dev,
gint * prog,
@ -152,10 +152,10 @@ static void grid_localize (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_render (GDrawable * drawable);
static void split_poly (Polygon * poly,
GDrawable * drawable,
guchar * col,
static void grid_render (GimpDrawable * drawable);
static void split_poly (Polygon * poly,
GimpDrawable * drawable,
guchar * col,
gdouble * dir,
gdouble color_vary);
static void clip_poly (gdouble * vec,
@ -171,11 +171,11 @@ static void clip_point (gdouble * dir,
Polygon * poly);
static void process_poly (Polygon * poly,
gint allow_split,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col,
gint vary);
static void render_poly (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col,
gdouble vary);
static void find_poly_dir (Polygon * poly,
@ -189,7 +189,7 @@ static void find_poly_dir (Polygon * poly,
gint x2,
gint y2);
static void find_poly_color (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col,
double vary);
static void scale_poly (Polygon * poly,
@ -197,10 +197,10 @@ static void scale_poly (Polygon * poly,
gdouble cy,
gdouble scale);
static void fill_poly_color (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
guchar * col);
static void fill_poly_image (Polygon * poly,
GDrawable * drawable,
GimpDrawable * drawable,
gdouble vary);
static void calc_spec_vec (SpecVec * vec,
gint xs,
@ -278,7 +278,7 @@ static MosaicInterface mint =
FALSE, /* run */
};
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
@ -292,24 +292,24 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_FLOAT, "tile_size", "Average diameter of each tile (in pixels)" },
{ PARAM_FLOAT, "tile_height", "Apparent height of each tile (in pixels)" },
{ PARAM_FLOAT, "tile_spacing", "Inter-tile spacing (in pixels)" },
{ PARAM_FLOAT, "tile_neatness", "Deviation from perfectly formed tiles (0.0 - 1.0)" },
{ PARAM_FLOAT, "light_dir", "Direction of light-source (in degrees)" },
{ PARAM_FLOAT, "color_variation", "Magnitude of random color variations (0.0 - 1.0)" },
{ PARAM_INT32, "antialiasing", "Enables smoother tile output at the cost of speed" },
{ PARAM_INT32, "color_averaging", "Tile color based on average of subsumed pixels" },
{ PARAM_INT32, "tile_type", "Tile geometry: { SQUARES (0), HEXAGONS (1), OCTAGONS (2) }" },
{ PARAM_INT32, "tile_surface", "Surface characteristics: { SMOOTH (0), ROUGH (1) }" },
{ PARAM_INT32, "grout_color", "Grout color (black/white or fore/background): { BW (0), FG_BG (1) }" }
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_FLOAT, "tile_size", "Average diameter of each tile (in pixels)" },
{ GIMP_PDB_FLOAT, "tile_height", "Apparent height of each tile (in pixels)" },
{ GIMP_PDB_FLOAT, "tile_spacing", "Inter-tile spacing (in pixels)" },
{ GIMP_PDB_FLOAT, "tile_neatness", "Deviation from perfectly formed tiles (0.0 - 1.0)" },
{ GIMP_PDB_FLOAT, "light_dir", "Direction of light-source (in degrees)" },
{ GIMP_PDB_FLOAT, "color_variation", "Magnitude of random color variations (0.0 - 1.0)" },
{ GIMP_PDB_INT32, "antialiasing", "Enables smoother tile output at the cost of speed" },
{ GIMP_PDB_INT32, "color_averaging", "Tile color based on average of subsumed pixels" },
{ GIMP_PDB_INT32, "tile_type", "Tile geometry: { SQUARES (0), HEXAGONS (1), OCTAGONS (2) }" },
{ GIMP_PDB_INT32, "tile_surface", "Surface characteristics: { SMOOTH (0), ROUGH (1) }" },
{ GIMP_PDB_INT32, "grout_color", "Grout color (black/white or fore/background): { BW (0), FG_BG (1) }" }
};
static GParamDef *return_vals = NULL;
static GimpParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
@ -324,33 +324,33 @@ query (void)
"1996",
N_("<Image>/Filters/Render/Pattern/Mosaic..."),
"RGB*, GRAY*",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs, nreturn_vals,
args, return_vals);
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[1];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
GDrawable *active_drawable;
static GimpParam values[1];
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpDrawable *active_drawable;
run_mode = param[0].data.d_int32;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
switch (run_mode)
{
case RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE:
INIT_I18N_UI();
/* Possibly retrieve data */
gimp_get_data ("plug_in_mosaic", &mvals);
@ -360,12 +360,12 @@ run (gchar *name,
return;
break;
case RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 14)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS)
{
mvals.tile_size = param[3].data.d_float;
mvals.tile_height = param[4].data.d_float;
@ -379,18 +379,18 @@ run (gchar *name,
mvals.tile_surface = param[12].data.d_int32;
mvals.grout_color = param[13].data.d_int32;
}
if (status == STATUS_SUCCESS &&
if (status == GIMP_PDB_SUCCESS &&
(mvals.tile_type < SQUARES || mvals.tile_type > OCTAGONS))
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS &&
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS &&
(mvals.tile_surface < SMOOTH || mvals.tile_surface > ROUGH))
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS &&
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS &&
(mvals.grout_color < BW || mvals.grout_color > FG_BG))
status = STATUS_CALLING_ERROR;
status = GIMP_PDB_CALLING_ERROR;
break;
case RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS:
/* Possibly retrieve data */
gimp_get_data ("plug_in_mosaic", &mvals);
break;
@ -403,7 +403,7 @@ run (gchar *name,
active_drawable = gimp_drawable_get (param[2].data.d_drawable);
/* Create the mosaic */
if ((status == STATUS_SUCCESS) &&
if ((status == GIMP_PDB_SUCCESS) &&
(gimp_drawable_is_rgb (active_drawable->id) ||
gimp_drawable_is_gray (active_drawable->id)))
{
@ -416,17 +416,17 @@ run (gchar *name,
mosaic (active_drawable);
/* If the run mode is interactive, flush the displays */
if (run_mode != RUN_NONINTERACTIVE)
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
/* Store mvals data */
if (run_mode == RUN_INTERACTIVE)
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data ("plug_in_mosaic", &mvals, sizeof (MosaicVals));
}
else if (status == STATUS_SUCCESS)
else if (status == GIMP_PDB_SUCCESS)
{
/* gimp_message ("mosaic: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
}
values[0].data.d_status = status;
@ -435,7 +435,7 @@ run (gchar *name,
}
static void
mosaic (GDrawable *drawable)
mosaic (GimpDrawable *drawable)
{
gint x1, y1, x2, y2;
gint alpha;
@ -731,11 +731,11 @@ mosaic_ok_callback (GtkWidget *widget,
*/
static void
find_gradients (GDrawable *drawable,
gdouble std_dev)
find_gradients (GimpDrawable *drawable,
gdouble std_dev)
{
GPixelRgn src_rgn;
GPixelRgn dest_rgn;
GimpPixelRgn src_rgn;
GimpPixelRgn dest_rgn;
gint bytes;
gint width, height;
gint i, j;
@ -752,9 +752,9 @@ find_gradients (GDrawable *drawable,
bytes = drawable->bpp;
/* allocate the gradient maps */
h_grad = (guchar *) malloc (width * height);
v_grad = (guchar *) malloc (width * height);
m_grad = (guchar *) malloc (width * height);
h_grad = g_new (guchar, width * height);
v_grad = g_new (guchar, width * height);
m_grad = g_new (guchar, width * height);
/* Calculate total number of rows to be processed */
rows = width * 2 + height * 2;
@ -817,8 +817,8 @@ find_gradients (GDrawable *drawable,
static void
find_max_gradient (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn)
find_max_gradient (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn)
{
guchar *s, *d, *s_iter, *s_end;
gpointer pr;
@ -875,13 +875,13 @@ find_max_gradient (GPixelRgn *src_rgn,
static void
gaussian_deriv (GPixelRgn *src_rgn,
GPixelRgn *dest_rgn,
gint type,
gdouble std_dev,
gint *prog,
gint max_prog,
gint ith_prog)
gaussian_deriv (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn,
gint type,
gdouble std_dev,
gint *prog,
gint max_prog,
gint ith_prog)
{
guchar *dest, *dp;
guchar *src, *sp, *s;
@ -907,7 +907,7 @@ gaussian_deriv (GPixelRgn *src_rgn,
/* allocate buffers for get/set pixel region rows/cols */
length = MAX (src_rgn->w, src_rgn->h) * bytes;
data = (guchar *) malloc (length * 2);
data = g_new (guchar, length * 2);
src = data;
dest = data + length;
@ -921,7 +921,7 @@ gaussian_deriv (GPixelRgn *src_rgn,
/* initialize */
curve = curve_array + length;
sum = sum_array + length;
buf = (gint *) malloc (sizeof (gint) * MAX ((x2 - x1), (y2 - y1)) * bytes);
buf = g_new (gint, MAX ((x2 - x1), (y2 - y1)) * bytes);
if (type == VERTICAL)
{
@ -1013,7 +1013,7 @@ gaussian_deriv (GPixelRgn *src_rgn,
gimp_pixel_rgn_set_col (dest_rgn, dest, col, y1, (y2 - y1));
if (! ((*prog)++ % ith_prog))
gimp_progress_update ((double) *prog / (double) max_prog);
gimp_progress_update ((gdouble) *prog / (gdouble) max_prog);
}
if (type == HORIZONTAL)
@ -1106,11 +1106,11 @@ gaussian_deriv (GPixelRgn *src_rgn,
gimp_pixel_rgn_set_row (dest_rgn, dest, x1, row, (x2 - x1));
if (! ((*prog)++ % ith_prog))
gimp_progress_update ((double) *prog / (double) max_prog);
gimp_progress_update ((gdouble) *prog / (gdouble) max_prog);
}
free (buf);
free (data);
g_free (buf);
g_free (data);
#ifndef UNOPTIMIZED_CODE
/* end bad hack */
#undef length
@ -1210,7 +1210,7 @@ grid_create_squares (gint x1,
rows = (height + size - 1) / size;
cols = (width + size - 1) / size;
grid = (Vertex *) malloc (sizeof (Vertex) * (cols + 2) * (rows + 2));
grid = g_new (Vertex, (cols + 2) * (rows + 2));
grid += (cols + 2) + 1;
for (i = -1; i <= rows; i++)
@ -1255,7 +1255,7 @@ grid_create_hexagons (gint x1,
rows = ((height + hex_height - 1) / hex_height);
cols = ((width + hex_width * 2 - 1) / hex_width);
grid = (Vertex *) malloc (sizeof (Vertex) * (cols + 2) * 4 * (rows + 2));
grid = g_new (Vertex, (cols + 2) * 4 * (rows + 2));
grid += (cols + 2) * 4 + 4;
for (i = -1; i <= rows; i++)
@ -1306,7 +1306,7 @@ grid_create_octagons (gint x1,
rows = ((height + oct_size - 1) / oct_size);
cols = ((width + oct_size * 2 - 1) / oct_size);
grid = (Vertex *) malloc (sizeof (Vertex) * (cols + 2) * 8 * (rows + 2));
grid = g_new (Vertex, (cols + 2) * 8 * (rows + 2));
grid += (cols + 2) * 8 + 8;
for (i = -1; i < rows + 1; i++)
@ -1409,9 +1409,9 @@ grid_localize (gint x1,
static void
grid_render (GDrawable *drawable)
grid_render (GimpDrawable *drawable)
{
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
gint i, j, k;
gint x1, y1, x2, y2;
guchar *data;
@ -1595,11 +1595,11 @@ grid_render (GDrawable *drawable)
static void
process_poly (Polygon *poly,
gint allow_split,
GDrawable *drawable,
guchar *col,
gint vary)
process_poly (Polygon *poly,
gint allow_split,
GimpDrawable *drawable,
guchar *col,
gint vary)
{
gdouble dir[2];
gdouble loc[2];
@ -1637,10 +1637,10 @@ process_poly (Polygon *poly,
static void
render_poly (Polygon *poly,
GDrawable *drawable,
guchar *col,
gdouble vary)
render_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble vary)
{
gdouble cx, cy;
@ -1659,11 +1659,11 @@ render_poly (Polygon *poly,
static void
split_poly (Polygon *poly,
GDrawable *drawable,
guchar *col,
gdouble *dir,
gdouble vary)
split_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble *dir,
gdouble vary)
{
Polygon new_poly;
gdouble spacing;
@ -1721,13 +1721,13 @@ split_poly (Polygon *poly,
static void
clip_poly (double *dir,
double *pt,
Polygon *poly,
Polygon *poly_new)
clip_poly (gdouble *dir,
gdouble *pt,
Polygon *poly,
Polygon *poly_new)
{
int i;
double x1, y1, x2, y2;
gint i;
gdouble x1, y1, x2, y2;
for (i = 0; i < poly->npts; i++)
{
@ -1837,15 +1837,15 @@ find_poly_dir (Polygon *poly,
loc[1] = 0.0;
polygon_extents (poly, &dmin_x, &dmin_y, &dmax_x, &dmax_y);
min_x = (int) dmin_x;
min_y = (int) dmin_y;
max_x = (int) dmax_x;
max_y = (int) dmax_y;
min_x = (gint) dmin_x;
min_y = (gint) dmin_y;
max_x = (gint) dmax_x;
max_y = (gint) dmax_y;
size_y = max_y - min_y;
size_x = max_x - min_x;
min_scanlines = (int *) malloc (sizeof (int) * size_y);
max_scanlines = (int *) malloc (sizeof (int) * size_y);
min_scanlines = g_new (gint, size_y);
max_scanlines = g_new (gint, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x;
@ -1854,10 +1854,10 @@ find_poly_dir (Polygon *poly,
for (i = 0; i < poly->npts; i++)
{
xs = (int) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (int) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (int) poly->pts[i].x;
ye = (int) poly->pts[i].y;
xs = (gint) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (gint) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (gint) poly->pts[i].x;
ye = (gint) poly->pts[i].y;
convert_segment (xs, ys, xe, ye, min_y,
min_scanlines, max_scanlines);
@ -1907,18 +1907,18 @@ find_poly_dir (Polygon *poly,
loc[1] = 0.0;
}
free (min_scanlines);
free (max_scanlines);
g_free (min_scanlines);
g_free (max_scanlines);
}
static void
find_poly_color (Polygon *poly,
GDrawable *drawable,
guchar *col,
gdouble color_var)
find_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble color_var)
{
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
gdouble dmin_x, dmin_y;
gdouble dmax_x, dmax_y;
gint xs, ys;
@ -1948,8 +1948,8 @@ find_poly_color (Polygon *poly,
size_y = max_y - min_y;
size_x = max_x - min_x;
min_scanlines = (gint *) malloc (sizeof (gint) * size_y);
max_scanlines = (gint *) malloc (sizeof (gint) * size_y);
min_scanlines = g_new (int, size_y);
max_scanlines = g_new (int, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x;
@ -2002,8 +2002,8 @@ find_poly_color (Polygon *poly,
col[b] = col_sum[b];
}
free (min_scanlines);
free (max_scanlines);
g_free (min_scanlines);
g_free (max_scanlines);
}
@ -2020,11 +2020,11 @@ scale_poly (Polygon *poly,
static void
fill_poly_color (Polygon *poly,
GDrawable *drawable,
guchar *col)
fill_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col)
{
GPixelRgn src_rgn;
GimpPixelRgn src_rgn;
gdouble dmin_x, dmin_y;
gdouble dmax_x, dmax_y;
gint xs, ys;
@ -2046,7 +2046,7 @@ fill_poly_color (Polygon *poly,
gint supersample2;
gint x1, y1, x2, y2;
Vertex *pts_tmp;
const int poly_npts = poly->npts;
const gint poly_npts = poly->npts;
/* Determine antialiasing */
if (mvals.antialiasing)
@ -2094,8 +2094,8 @@ fill_poly_color (Polygon *poly,
size_y = (max_y - min_y) * supersample;
size_x = (max_x - min_x) * supersample;
min_scanlines = min_scanlines_iter = (gint *) malloc (sizeof (gint) * size_y);
max_scanlines = max_scanlines_iter = (gint *) malloc (sizeof (gint) * size_y);
min_scanlines = min_scanlines_iter = g_new (gint, size_y);
max_scanlines = max_scanlines_iter = g_new (gint, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x * supersample;
@ -2141,7 +2141,7 @@ fill_poly_color (Polygon *poly,
drawable->width, drawable->height,
TRUE, TRUE);
vals = (gint *) malloc (sizeof (gint) * size_x);
vals = g_new (gint, size_x);
for (i = 0; i < size_y; i++, min_scanlines_iter++, max_scanlines_iter++)
{
if (! (i % supersample))
@ -2193,18 +2193,18 @@ fill_poly_color (Polygon *poly,
}
}
free (vals);
free (min_scanlines);
free (max_scanlines);
g_free (vals);
g_free (min_scanlines);
g_free (max_scanlines);
}
static void
fill_poly_image (Polygon *poly,
GDrawable *drawable,
gdouble vary)
fill_poly_image (Polygon *poly,
GimpDrawable *drawable,
gdouble vary)
{
GPixelRgn src_rgn, dest_rgn;
GimpPixelRgn src_rgn, dest_rgn;
gdouble dmin_x, dmin_y;
gdouble dmax_x, dmax_y;
gint xs, ys;
@ -2258,8 +2258,8 @@ fill_poly_image (Polygon *poly,
size_y = (max_y - min_y) * supersample;
size_x = (max_x - min_x) * supersample;
min_scanlines = (gint *) malloc (sizeof (gint) * size_y);
max_scanlines = (gint *) malloc (sizeof (gint) * size_y);
min_scanlines = g_new (gint, size_y);
max_scanlines = g_new (gint, size_y);
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x * supersample;
@ -2288,7 +2288,7 @@ fill_poly_image (Polygon *poly,
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0,
drawable->width, drawable->height,
TRUE, TRUE);
vals = (gint *) malloc (sizeof (gint) * size_x);
vals = g_new (gint, size_x);
for (i = 0; i < size_y; i++)
{
if (! (i % supersample))
@ -2351,9 +2351,9 @@ fill_poly_image (Polygon *poly,
}
}
free (vals);
free (min_scanlines);
free (max_scanlines);
g_free (vals);
g_free (min_scanlines);
g_free (max_scanlines);
}

View File

@ -97,11 +97,11 @@ typedef struct
/***** Prototypes *****/
static void query (void);
static void run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals);
static void run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void set_default_params (void);
@ -125,11 +125,11 @@ static gint inside_circle (gdouble x, gdouble y);
static void do_curl_effect (void);
static void clear_curled_region (void);
static void page_curl (void);
static guchar *get_samples (GDrawable *drawable);
static guchar *get_samples (GimpDrawable *drawable);
/***** Variables *****/
GPlugInInfo PLUG_IN_INFO =
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
@ -142,8 +142,8 @@ static CurlParams curl;
/* Image parameters */
static gint32 image_id;
static GDrawable *curl_layer;
static GDrawable *drawable;
static GimpDrawable *curl_layer;
static GimpDrawable *drawable;
static GdkPixmap *gdk_curl_pixmaps[8];
static GdkBitmap *gdk_curl_masks[8];
@ -187,21 +187,21 @@ MAIN ()
static void
query (void)
{
static GParamDef args[] =
static GimpParamDef args[] =
{
{ PARAM_INT32, "run_mode", "Interactive (0), non-interactive (1)" },
{ PARAM_IMAGE, "image", "Input image" },
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_INT32, "mode", "Pagecurl-mode: Use FG- and BG-Color (0), Use current gradient (1)" },
{ PARAM_INT32, "edge", "Edge to curl (1-4, clockwise, starting in the lower right edge)" },
{ PARAM_INT32, "type", "vertical (0), horizontal (1)" },
{ PARAM_INT32, "shade", "Shade the region under the curl (1) or not (0)" },
{ GIMP_PDB_INT32, "run_mode", "Interactive (0), non-interactive (1)" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_INT32, "mode", "Pagecurl-mode: Use FG- and BG-Color (0), Use current gradient (1)" },
{ GIMP_PDB_INT32, "edge", "Edge to curl (1-4, clockwise, starting in the lower right edge)" },
{ GIMP_PDB_INT32, "type", "vertical (0), horizontal (1)" },
{ GIMP_PDB_INT32, "shade", "Shade the region under the curl (1) or not (0)" },
};
static gint nargs = sizeof (args) / sizeof (args[0]);
static GParamDef return_vals[] =
static GimpParamDef return_vals[] =
{
{ PARAM_LAYER, "Curl Layer", "The new layer with the curl." }
{ GIMP_PDB_LAYER, "Curl Layer", "The new layer with the curl." }
};
static gint nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
@ -215,7 +215,7 @@ query (void)
PLUG_IN_VERSION,
N_("<Image>/Filters/Distorts/Pagecurl..."),
"RGBA, GRAYA",
PROC_PLUG_IN,
GIMP_PLUGIN,
nargs,
nreturn_vals,
args,
@ -223,15 +223,15 @@ query (void)
}
static void
run (gchar *name,
gint nparams,
GParam *param,
gint *nreturn_vals,
GParam **return_vals)
run (gchar *name,
gint nparams,
GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GParam values[2];
GRunModeType run_mode;
GStatusType status = STATUS_SUCCESS;
static GimpParam values[2];
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
run_mode = param[0].data.d_int32;
@ -243,9 +243,9 @@ run (gchar *name,
*nreturn_vals = 2;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
values[1].type = PARAM_LAYER;
values[1].type = GIMP_PDB_LAYER;
values[1].data.d_layer = -1;
/* Get the specified drawable */
@ -258,19 +258,19 @@ run (gchar *name,
{
switch (run_mode)
{
case RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE:
INIT_I18N_UI();
/* First acquire information with a dialog */
if (!do_dialog ())
return;
break;
case RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE:
INIT_I18N();
/* Make sure all the arguments are there! */
if (nparams != 7)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS)
{
curl.do_curl_shade = (param[3].data.d_int32 == 0) ? 1 : 0;
curl.do_curl_gradient = 1 - curl.do_curl_shade;
@ -309,7 +309,7 @@ run (gchar *name,
}
break;
case RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS:
INIT_I18N();
break;
@ -317,19 +317,19 @@ run (gchar *name,
break;
}
if (status == STATUS_SUCCESS)
if (status == GIMP_PDB_SUCCESS)
{
page_curl ();
values[1].data.d_layer = curl_layer_ID;
if (run_mode != RUN_NONINTERACTIVE)
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
if (run_mode == RUN_INTERACTIVE)
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data (PLUG_IN_NAME, &curl, sizeof (CurlParams));
}
}
else
/* Sorry - no indexed/noalpha images */
status = STATUS_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR;
values[0].data.d_status = status;
}
@ -813,7 +813,7 @@ do_curl_effect (void)
gdouble dl_mag, dr_mag, angle, factor;
guchar *pp, *dest, fore_grayval, back_grayval;
guchar *gradsamp;
GPixelRgn dest_rgn;
GimpPixelRgn dest_rgn;
gpointer pr;
guchar *grad_samples = NULL;
@ -823,8 +823,8 @@ do_curl_effect (void)
_("Curl Layer"),
true_sel_width,
true_sel_height,
color_image ? RGBA_IMAGE : GRAYA_IMAGE,
100, NORMAL_MODE));
color_image ? GIMP_RGBA_IMAGE : GIMP_GRAYA_IMAGE,
100, GIMP_NORMAL_MODE));
gimp_image_add_layer (image_id, curl_layer->id, drawable_position);
curl_layer_ID = curl_layer->id;
@ -994,7 +994,7 @@ do_curl_effect (void)
static void
clear_curled_region (void)
{
GPixelRgn src_rgn, dest_rgn;
GimpPixelRgn src_rgn, dest_rgn;
gpointer pr;
gint x, y;
guint x1, y1, i;
@ -1083,7 +1083,7 @@ page_curl (void)
"ripped" from gradmap.c.
*/
static guchar *
get_samples (GDrawable *drawable)
get_samples (GimpDrawable *drawable)
{
gdouble *f_samples, *f_samp; /* float samples */
guchar *b_samples, *b_samp; /* byte samples */