Commit 0d533abb authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

tools/pdbgen/lib.pl tools/pdbgen/pdb.pl tools/pdbgen/pdb/channel.pdb

2001-01-25  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/lib.pl
	* tools/pdbgen/pdb.pl
	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/tools.pdb: changed these with the help of
	Yosh. PDB functions take GimpRGB as color type now.

	* app/plug_in.c
	* app/pdb/channel_cmds.c
	* app/pdb/internal_procs.c
	* app/pdb/palette_cmds.c
	* app/pdb/procedural_db.[ch]
	* app/pdb/tools_cmds.c
	* libgimp/gimp.[ch]
	* libgimp/gimpchannel.[ch]
	* libgimp/gimpchannel_pdb.[ch]
	* libgimp/gimppalette_pdb.[ch]
	* libgimp/gimpprotocol.[ch]
	* libgimp/gimptools_pdb.[ch]: incremented Gimp protocol version
	and changed color type from array of chars to GimpRGB.

	* libgimp/Makefile.am
	* libgimp/gimppalette.[ch]: removed these files again

	* app/libgimp_glue.[ch]
	* libgimpwidgets/gimpcolorbutton.c
	* plug-ins/Lighting/lighting_main.c
	* plug-ins/Lighting/lighting_preview.c
	* plug-ins/MapObject/mapobject_image.c
	* plug-ins/MapObject/mapobject_main.c
	* plug-ins/MapObject/mapobject_preview.c
	* plug-ins/common/apply_lens.c
	* plug-ins/common/blinds.c
	* plug-ins/common/borderaverage.c
	* plug-ins/common/checkerboard.c
	* plug-ins/common/colorify.c
	* plug-ins/common/colortoalpha.c
	* plug-ins/common/cubism.c
	* plug-ins/common/exchange.c
	* plug-ins/common/film.c
	* plug-ins/common/gif.c
	* plug-ins/common/grid.c
	* plug-ins/common/mapcolor.c
	* plug-ins/common/mblur.c
	* plug-ins/common/nova.c
	* plug-ins/common/papertile.c
	* plug-ins/common/png.c
	* plug-ins/common/polar.c
	* plug-ins/common/psd.c
	* plug-ins/common/semiflatten.c
	* plug-ins/common/sinus.c
	* plug-ins/common/sparkle.c
	* plug-ins/common/tiff.c
	* plug-ins/common/vpropagate.c
	* plug-ins/common/warp.c
	* plug-ins/common/whirlpinch.c
	* plug-ins/gap/gap_filter_iterators.c
	* plug-ins/gap/gap_mov_dialog.c
	* plug-ins/gdyntext/gdyntext.c
	* plug-ins/gfig/gfig.c
	* plug-ins/gfli/gfli.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/maze/handy.c
	* plug-ins/mosaic/mosaic.c
	* plug-ins/pagecurl/pagecurl.c
	* plug-ins/script-fu/script-fu-scripts.c
	* plug-ins/script-fu/script-fu.c
	* plug-ins/xjt/xjt.c: changed accordingly. A few plug-ins need
	to be looked at more closely after this change. I tried to put
	FIXME comments into those.
parent 7a4260da
2001-01-25 Sven Neumann <sven@gimp.org>
* tools/pdbgen/lib.pl
* tools/pdbgen/pdb.pl
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/tools.pdb: changed these with the help of
Yosh. PDB functions take GimpRGB as color type now.
* app/plug_in.c
* app/pdb/channel_cmds.c
* app/pdb/internal_procs.c
* app/pdb/palette_cmds.c
* app/pdb/procedural_db.[ch]
* app/pdb/tools_cmds.c
* libgimp/gimp.[ch]
* libgimp/gimpchannel.[ch]
* libgimp/gimpchannel_pdb.[ch]
* libgimp/gimppalette_pdb.[ch]
* libgimp/gimpprotocol.[ch]
* libgimp/gimptools_pdb.[ch]: incremented Gimp protocol version
and changed color type from array of chars to GimpRGB.
* libgimp/Makefile.am
* libgimp/gimppalette.[ch]: removed these files again
* app/libgimp_glue.[ch]
* libgimpwidgets/gimpcolorbutton.c
* plug-ins/Lighting/lighting_main.c
* plug-ins/Lighting/lighting_preview.c
* plug-ins/MapObject/mapobject_image.c
* plug-ins/MapObject/mapobject_main.c
* plug-ins/MapObject/mapobject_preview.c
* plug-ins/common/apply_lens.c
* plug-ins/common/blinds.c
* plug-ins/common/borderaverage.c
* plug-ins/common/checkerboard.c
* plug-ins/common/colorify.c
* plug-ins/common/colortoalpha.c
* plug-ins/common/cubism.c
* plug-ins/common/exchange.c
* plug-ins/common/film.c
* plug-ins/common/gif.c
* plug-ins/common/grid.c
* plug-ins/common/mapcolor.c
* plug-ins/common/mblur.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/png.c
* plug-ins/common/polar.c
* plug-ins/common/psd.c
* plug-ins/common/semiflatten.c
* plug-ins/common/sinus.c
* plug-ins/common/sparkle.c
* plug-ins/common/tiff.c
* plug-ins/common/vpropagate.c
* plug-ins/common/warp.c
* plug-ins/common/whirlpinch.c
* plug-ins/gap/gap_filter_iterators.c
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gdyntext/gdyntext.c
* plug-ins/gfig/gfig.c
* plug-ins/gfli/gfli.c
* plug-ins/ifscompose/ifscompose.c
* plug-ins/maze/handy.c
* plug-ins/mosaic/mosaic.c
* plug-ins/pagecurl/pagecurl.c
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/script-fu.c
* plug-ins/xjt/xjt.c: changed accordingly. A few plug-ins need
to be looked at more closely after this change. I tried to put
FIXME comments into those.
2001-01-24 Michael Natterer <mitch@gimp.org>
* Makefile.am
......
......@@ -2447,12 +2447,16 @@ plug_in_add_to_db (void)
if (proc_def->image_types)
{
return_vals = procedural_db_execute ("gimp_register_save_handler", args);
return_vals =
procedural_db_execute ("gimp_register_save_handler",
args);
g_free (return_vals);
}
else
{
return_vals = procedural_db_execute ("gimp_register_magic_load_handler", args);
return_vals =
procedural_db_execute ("gimp_register_magic_load_handler",
args);
g_free (return_vals);
}
}
......@@ -2904,9 +2908,8 @@ plug_in_params_to_args (GPParam *params,
{
Argument *args;
gchar **stringarray;
guchar *colorarray;
gint count;
gint i, j;
gint count;
gint i, j;
if (nparams == 0)
return NULL;
......@@ -2942,7 +2945,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint32, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int32array, count * 4);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int32array, count * 4);
}
else
{
......@@ -2954,7 +2958,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint16, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int16array, count * 2);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int16array, count * 2);
}
else
{
......@@ -2966,7 +2971,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint8, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int8array, count);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int8array, count);
}
else
{
......@@ -2978,7 +2984,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gdouble, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_floatarray, count * 8);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_floatarray, count * 8);
}
else
{
......@@ -2988,7 +2995,8 @@ plug_in_params_to_args (GPParam *params,
case PDB_STRINGARRAY:
if (full_copy)
{
args[i].value.pdb_pointer = g_new (gchar*, args[i-1].value.pdb_int);
args[i].value.pdb_pointer = g_new (gchar *,
args[i-1].value.pdb_int);
stringarray = args[i].value.pdb_pointer;
for (j = 0; j < args[i-1].value.pdb_int; j++)
......@@ -3000,11 +3008,7 @@ plug_in_params_to_args (GPParam *params,
}
break;
case PDB_COLOR:
args[i].value.pdb_pointer = g_new (guchar, 3);
colorarray = args[i].value.pdb_pointer;
colorarray[0] = params[i].data.d_color.red;
colorarray[1] = params[i].data.d_color.green;
colorarray[2] = params[i].data.d_color.blue;
args[i].value.pdb_color = params[i].data.d_color;
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......@@ -3038,7 +3042,7 @@ plug_in_params_to_args (GPParam *params,
args[i].value.pdb_pointer =
gimp_parasite_copy ((GimpParasite *) &(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
args[i].value.pdb_pointer = (gpointer) &(params[i].data.d_parasite);
break;
case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status;
......@@ -3058,8 +3062,7 @@ plug_in_args_to_params (Argument *args,
{
GPParam *params;
gchar **stringarray;
guchar *colorarray;
gint i, j;
gint i, j;
if (nargs == 0)
return NULL;
......@@ -3157,19 +3160,7 @@ plug_in_args_to_params (Argument *args,
}
break;
case PDB_COLOR:
colorarray = args[i].value.pdb_pointer;
if( colorarray )
{
params[i].data.d_color.red = colorarray[0];
params[i].data.d_color.green = colorarray[1];
params[i].data.d_color.blue = colorarray[2];
}
else
{
params[i].data.d_color.red = 0;
params[i].data.d_color.green = 0;
params[i].data.d_color.blue = 0;
}
params[i].data.d_color = args[i].value.pdb_color;
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......@@ -3373,7 +3364,6 @@ plug_in_args_destroy (Argument *args,
}
break;
case PDB_COLOR:
g_free (args[i].value.pdb_pointer);
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......
......@@ -2447,12 +2447,16 @@ plug_in_add_to_db (void)
if (proc_def->image_types)
{
return_vals = procedural_db_execute ("gimp_register_save_handler", args);
return_vals =
procedural_db_execute ("gimp_register_save_handler",
args);
g_free (return_vals);
}
else
{
return_vals = procedural_db_execute ("gimp_register_magic_load_handler", args);
return_vals =
procedural_db_execute ("gimp_register_magic_load_handler",
args);
g_free (return_vals);
}
}
......@@ -2904,9 +2908,8 @@ plug_in_params_to_args (GPParam *params,
{
Argument *args;
gchar **stringarray;
guchar *colorarray;
gint count;
gint i, j;
gint count;
gint i, j;
if (nparams == 0)
return NULL;
......@@ -2942,7 +2945,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint32, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int32array, count * 4);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int32array, count * 4);
}
else
{
......@@ -2954,7 +2958,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint16, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int16array, count * 2);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int16array, count * 2);
}
else
{
......@@ -2966,7 +2971,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint8, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int8array, count);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int8array, count);
}
else
{
......@@ -2978,7 +2984,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gdouble, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_floatarray, count * 8);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_floatarray, count * 8);
}
else
{
......@@ -2988,7 +2995,8 @@ plug_in_params_to_args (GPParam *params,
case PDB_STRINGARRAY:
if (full_copy)
{
args[i].value.pdb_pointer = g_new (gchar*, args[i-1].value.pdb_int);
args[i].value.pdb_pointer = g_new (gchar *,
args[i-1].value.pdb_int);
stringarray = args[i].value.pdb_pointer;
for (j = 0; j < args[i-1].value.pdb_int; j++)
......@@ -3000,11 +3008,7 @@ plug_in_params_to_args (GPParam *params,
}
break;
case PDB_COLOR:
args[i].value.pdb_pointer = g_new (guchar, 3);
colorarray = args[i].value.pdb_pointer;
colorarray[0] = params[i].data.d_color.red;
colorarray[1] = params[i].data.d_color.green;
colorarray[2] = params[i].data.d_color.blue;
args[i].value.pdb_color = params[i].data.d_color;
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......@@ -3038,7 +3042,7 @@ plug_in_params_to_args (GPParam *params,
args[i].value.pdb_pointer =
gimp_parasite_copy ((GimpParasite *) &(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
args[i].value.pdb_pointer = (gpointer) &(params[i].data.d_parasite);
break;
case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status;
......@@ -3058,8 +3062,7 @@ plug_in_args_to_params (Argument *args,
{
GPParam *params;
gchar **stringarray;
guchar *colorarray;
gint i, j;
gint i, j;
if (nargs == 0)
return NULL;
......@@ -3157,19 +3160,7 @@ plug_in_args_to_params (Argument *args,
}
break;
case PDB_COLOR:
colorarray = args[i].value.pdb_pointer;
if( colorarray )
{
params[i].data.d_color.red = colorarray[0];
params[i].data.d_color.green = colorarray[1];
params[i].data.d_color.blue = colorarray[2];
}
else
{
params[i].data.d_color.red = 0;
params[i].data.d_color.green = 0;
params[i].data.d_color.blue = 0;
}
params[i].data.d_color = args[i].value.pdb_color;
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......@@ -3373,7 +3364,6 @@ plug_in_args_destroy (Argument *args,
}
break;
case PDB_COLOR:
g_free (args[i].value.pdb_pointer);
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......
......@@ -2447,12 +2447,16 @@ plug_in_add_to_db (void)
if (proc_def->image_types)
{
return_vals = procedural_db_execute ("gimp_register_save_handler", args);
return_vals =
procedural_db_execute ("gimp_register_save_handler",
args);
g_free (return_vals);
}
else
{
return_vals = procedural_db_execute ("gimp_register_magic_load_handler", args);
return_vals =
procedural_db_execute ("gimp_register_magic_load_handler",
args);
g_free (return_vals);
}
}
......@@ -2904,9 +2908,8 @@ plug_in_params_to_args (GPParam *params,
{
Argument *args;
gchar **stringarray;
guchar *colorarray;
gint count;
gint i, j;
gint count;
gint i, j;
if (nparams == 0)
return NULL;
......@@ -2942,7 +2945,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint32, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int32array, count * 4);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int32array, count * 4);
}
else
{
......@@ -2954,7 +2958,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint16, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int16array, count * 2);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int16array, count * 2);
}
else
{
......@@ -2966,7 +2971,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gint8, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_int8array, count);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_int8array, count);
}
else
{
......@@ -2978,7 +2984,8 @@ plug_in_params_to_args (GPParam *params,
{
count = args[i-1].value.pdb_int;
args[i].value.pdb_pointer = g_new (gdouble, count);
memcpy (args[i].value.pdb_pointer, params[i].data.d_floatarray, count * 8);
memcpy (args[i].value.pdb_pointer,
params[i].data.d_floatarray, count * 8);
}
else
{
......@@ -2988,7 +2995,8 @@ plug_in_params_to_args (GPParam *params,
case PDB_STRINGARRAY:
if (full_copy)
{
args[i].value.pdb_pointer = g_new (gchar*, args[i-1].value.pdb_int);
args[i].value.pdb_pointer = g_new (gchar *,
args[i-1].value.pdb_int);
stringarray = args[i].value.pdb_pointer;
for (j = 0; j < args[i-1].value.pdb_int; j++)
......@@ -3000,11 +3008,7 @@ plug_in_params_to_args (GPParam *params,
}
break;
case PDB_COLOR:
args[i].value.pdb_pointer = g_new (guchar, 3);
colorarray = args[i].value.pdb_pointer;
colorarray[0] = params[i].data.d_color.red;
colorarray[1] = params[i].data.d_color.green;
colorarray[2] = params[i].data.d_color.blue;
args[i].value.pdb_color = params[i].data.d_color;
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......@@ -3038,7 +3042,7 @@ plug_in_params_to_args (GPParam *params,
args[i].value.pdb_pointer =
gimp_parasite_copy ((GimpParasite *) &(params[i].data.d_parasite));
else
args[i].value.pdb_pointer = (void *)&(params[i].data.d_parasite);
args[i].value.pdb_pointer = (gpointer) &(params[i].data.d_parasite);
break;
case PDB_STATUS:
args[i].value.pdb_int = params[i].data.d_status;
......@@ -3058,8 +3062,7 @@ plug_in_args_to_params (Argument *args,
{
GPParam *params;
gchar **stringarray;
guchar *colorarray;
gint i, j;
gint i, j;
if (nargs == 0)
return NULL;
......@@ -3157,19 +3160,7 @@ plug_in_args_to_params (Argument *args,
}
break;
case PDB_COLOR:
colorarray = args[i].value.pdb_pointer;
if( colorarray )
{
params[i].data.d_color.red = colorarray[0];
params[i].data.d_color.green = colorarray[1];
params[i].data.d_color.blue = colorarray[2];
}
else
{
params[i].data.d_color.red = 0;
params[i].data.d_color.green = 0;
params[i].data.d_color.blue = 0;
}
params[i].data.d_color = args[i].value.pdb_color;
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......@@ -3373,7 +3364,6 @@ plug_in_args_destroy (Argument *args,
}
break;
case PDB_COLOR:
g_free (args[i].value.pdb_pointer);
break;
case PDB_REGION:
g_message ("the \"region\" arg type is not currently supported");
......
......@@ -29,113 +29,41 @@
gboolean
gimp_palette_set_foreground (guchar r,
guchar g,
guchar b)
gimp_palette_set_foreground (const GimpRGB *rgb)
{
GimpRGB color;
gimp_rgba_set_uchar (&color, r, g, b, 255);
gimp_context_set_foreground (NULL, &color);
return TRUE;
}
gboolean
gimp_palette_get_foreground (guchar *r,
guchar *g,
guchar *b)
{
GimpRGB color;
gimp_context_get_foreground (NULL, &color);
gimp_rgb_get_uchar (&color, r, g, b);
return TRUE;
}
gboolean
gimp_palette_set_foreground_rgb (const GimpRGB *rgb)
{
guchar r, g, b;
g_return_val_if_fail (rgb != NULL, FALSE);
gimp_rgb_get_uchar (rgb, &r, &g, &b);
return gimp_palette_set_foreground (r, g, b);
}
gboolean
gimp_palette_get_foreground_rgb (GimpRGB *rgb)
{
guchar r, g, b;
g_return_val_if_fail (rgb != NULL, FALSE);
if (gimp_palette_get_foreground (&r, &g, &b))
{
gimp_rgb_set_uchar (rgb, r, g, b);
return TRUE;
}
return FALSE;
}
gboolean
gimp_palette_set_background (guchar r,
guchar g,
guchar b)
{
GimpRGB color;
gimp_rgba_set_uchar (&color, r, g, b, 255);
gimp_context_set_background (NULL, &color);
gimp_context_set_foreground (NULL, rgb);
return TRUE;
}
gboolean
gimp_palette_get_background (guchar *r,
guchar *g,
guchar *b)
gimp_palette_get_foreground (GimpRGB *rgb)
{
GimpRGB color;
gimp_context_get_background (NULL, &color);
g_return_val_if_fail (rgb != NULL, FALSE);
gimp_rgb_get_uchar (&color, r, g, b);
gimp_context_get_foreground (NULL, rgb);
return TRUE;
}
gboolean
gimp_palette_set_background_rgb (const GimpRGB *rgb)
gimp_palette_set_background (const GimpRGB *rgb)
{
guchar r, g, b;
g_return_val_if_fail (rgb != NULL, FALSE);
gimp_rgb_get_uchar (rgb, &r, &g, &b);
gimp_context_set_background (NULL, rgb);