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

	* app/libgimp_glue.[ch]: cleanup

	* app/pdb/channel_cmds.c
	* app/pdb/palette_cmds.c
	* app/pdb/tools_cmds.c
	* tools/pdbgen/app.pl
	* tools/pdbgen/lib.pl
	* tools/pdbgen/pdb.pl
	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/palette.pdb
	* tools/pdbgen/pdb/tools.pdb: fixed pdbgen code for color type. Seems
	to actually work now.

	* TODO.xml: updated

	* plug-ins/Makefile.am: disabled build of gimp-perl until it has
	catched up with the API changes in libgimp
This commit is contained in:
Sven Neumann 2001-01-25 14:38:10 +00:00 committed by Sven Neumann
parent 2211d09929
commit e8c74bb6e8
17 changed files with 97 additions and 91 deletions

View File

@ -1,3 +1,23 @@
2001-01-25 Sven Neumann <sven@gimp.org>
* app/libgimp_glue.[ch]: cleanup
* app/pdb/channel_cmds.c
* app/pdb/palette_cmds.c
* app/pdb/tools_cmds.c
* tools/pdbgen/app.pl
* tools/pdbgen/lib.pl
* tools/pdbgen/pdb.pl
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/palette.pdb
* tools/pdbgen/pdb/tools.pdb: fixed pdbgen code for color type. Seems
to actually work now.
* TODO.xml: updated
* plug-ins/Makefile.am: disabled build of gimp-perl until it has
catched up with the API changes in libgimp
2001-01-25 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpwidgets.c (gimp_mem_size_entry_new): merged fix
@ -9,8 +29,8 @@
* 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.
* 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

View File

@ -58,7 +58,7 @@
</contact>
</entry>
<entry size="medium" difficulty="medium" status="50%" target="1.4">
<entry size="medium" difficulty="medium" status="80%" target="1.4">
<title>Unify color data types</title>
<description>
<p>
@ -173,7 +173,7 @@
<section>
<title>LibGimp</title>
<entry size="medium" difficulty="medium" status="10%" target="1.4">
<entry size="medium" difficulty="medium" status="40%" target="1.4">
<title>Restructure LibGimp</title>
<description>
<p>

View File

@ -18,7 +18,7 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib.h>
#include "libgimpcolor/gimpcolor.h"
@ -29,41 +29,41 @@
gboolean
gimp_palette_set_foreground (const GimpRGB *rgb)
gimp_palette_set_foreground (const GimpRGB *color)
{
g_return_val_if_fail (rgb != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_set_foreground (NULL, rgb);
gimp_context_set_foreground (NULL, color);
return TRUE;
}
gboolean
gimp_palette_get_foreground (GimpRGB *rgb)
gimp_palette_get_foreground (GimpRGB *color)
{
g_return_val_if_fail (rgb != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_get_foreground (NULL, rgb);
gimp_context_get_foreground (NULL, color);
return TRUE;
}
gboolean
gimp_palette_set_background (const GimpRGB *rgb)
gimp_palette_set_background (const GimpRGB *color)
{
g_return_val_if_fail (rgb != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_set_background (NULL, rgb);
gimp_context_set_background (NULL, color);
return TRUE;
}
gboolean
gimp_palette_get_background (GimpRGB *rgb)
gimp_palette_get_background (GimpRGB *color)
{
g_return_val_if_fail (rgb != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
gimp_context_get_background (NULL, rgb);
gimp_context_get_background (NULL, color);
return TRUE;
}

View File

@ -27,9 +27,9 @@
gboolean gimp_palette_set_foreground (const GimpRGB *color);
gboolean gimp_palette_get_foreground (GimpRGB *rgb);
gboolean gimp_palette_get_foreground (GimpRGB *color);
gboolean gimp_palette_set_background (const GimpRGB *color);
gboolean gimp_palette_get_background (GimpRGB *rgb);
gboolean gimp_palette_get_background (GimpRGB *color);
#endif /* __LIBGIMP_GLUE_H__ */

View File

@ -76,7 +76,7 @@ channel_new_invoker (Argument *args)
gint32 height;
gchar *name;
gdouble opacity;
GimpRGB *color;
GimpRGB color;
Channel *channel = NULL;
gimage = pdb_id_to_image (args[0].value.pdb_int);
@ -99,11 +99,11 @@ channel_new_invoker (Argument *args)
if (opacity < 0.0 || opacity > 100.0)
success = FALSE;
color = (GimpRGB *) args[5].value.pdb_pointer;
color = args[5].value.pdb_color;
if (success)
{
GimpRGB rgb_color = *color;
GimpRGB rgb_color = color;
rgb_color.a = opacity / 100.0;
channel = channel_new (gimage, width, height, name, &rgb_color);
@ -693,7 +693,7 @@ channel_get_color_invoker (Argument *args)
gboolean success = TRUE;
Argument *return_args;
Channel *channel;
GimpRGB *color = NULL;
GimpRGB color;
channel = (GimpChannel *) gimp_drawable_get_by_ID (args[0].value.pdb_int);
if (channel == NULL)
@ -701,14 +701,13 @@ channel_get_color_invoker (Argument *args)
if (success)
{
color = g_new (GimpRGB, 1);
*color = channel->color;
color = channel->color;
}
return_args = procedural_db_return_args (&channel_get_color_proc, success);
if (success)
return_args[1].value.pdb_pointer = color;
return_args[1].value.pdb_color = color;
return return_args;
}

View File

@ -56,13 +56,12 @@ static Argument *
palette_get_foreground_invoker (Argument *args)
{
Argument *return_args;
GimpRGB *color;
GimpRGB color;
color = g_new (GimpRGB, 1);
gimp_context_get_foreground (NULL, color);
gimp_context_get_foreground (NULL, &color);
return_args = procedural_db_return_args (&palette_get_foreground_proc, TRUE);
return_args[1].value.pdb_pointer = color;
return_args[1].value.pdb_color = color;
return return_args;
}
@ -96,13 +95,12 @@ static Argument *
palette_get_background_invoker (Argument *args)
{
Argument *return_args;
GimpRGB *color;
GimpRGB color;
color = g_new (GimpRGB, 1);
gimp_context_get_background (NULL, color);
gimp_context_get_background (NULL, &color);
return_args = procedural_db_return_args (&palette_get_background_proc, TRUE);
return_args[1].value.pdb_pointer = color;
return_args[1].value.pdb_color = color;
return return_args;
}
@ -135,14 +133,12 @@ static ProcRecord palette_get_background_proc =
static Argument *
palette_set_foreground_invoker (Argument *args)
{
GimpRGB *color;
GimpRGB rgb_color;
GimpRGB color;
color = (GimpRGB *) args[0].value.pdb_pointer;
color = args[0].value.pdb_color;
rgb_color = *color;
rgb_color.a = 1.0;
gimp_context_set_foreground (NULL, &rgb_color);
gimp_rgb_set_alpha (&color, 1.0);
gimp_context_set_foreground (NULL, &color);
return procedural_db_return_args (&palette_set_foreground_proc, TRUE);
}
@ -175,14 +171,12 @@ static ProcRecord palette_set_foreground_proc =
static Argument *
palette_set_background_invoker (Argument *args)
{
GimpRGB *color;
GimpRGB rgb_color;
GimpRGB color;
color = (GimpRGB *) args[0].value.pdb_pointer;
color = args[0].value.pdb_color;
rgb_color = *color;
rgb_color.a = 1.0;
gimp_context_set_background (NULL, &rgb_color);
gimp_rgb_set_alpha (&color, 1.0);
gimp_context_set_background (NULL, &color);
return procedural_db_return_args (&palette_set_background_proc, TRUE);
}

View File

@ -537,7 +537,7 @@ by_color_select_invoker (Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
GimpRGB *color;
GimpRGB color;
gint32 threshold;
gint32 operation;
gboolean antialias;
@ -551,7 +551,7 @@ by_color_select_invoker (Argument *args)
if (drawable == NULL)
success = FALSE;
color = (GimpRGB *) args[1].value.pdb_pointer;
color = args[1].value.pdb_color;
threshold = args[2].value.pdb_int;
if (threshold < 0 || threshold > 255)
@ -812,7 +812,7 @@ color_picker_invoker (Argument *args)
gboolean sample_average;
gdouble average_radius;
gboolean save_color;
GimpRGB *color = NULL;
GimpRGB color;
gimage = pdb_id_to_image (args[0].value.pdb_int);
if (gimage == NULL)
@ -846,8 +846,7 @@ color_picker_invoker (Argument *args)
save_color);
if (success)
{
color = g_new (GimpRGB, 1);
gimp_rgba_set_uchar (color,
gimp_rgba_set_uchar (&color,
col_value[RED_PIX],
col_value[GREEN_PIX],
col_value[BLUE_PIX],
@ -858,7 +857,7 @@ color_picker_invoker (Argument *args)
return_args = procedural_db_return_args (&color_picker_proc, success);
if (success)
return_args[1].value.pdb_pointer = color;
return_args[1].value.pdb_color = color;
return return_args;
}

View File

@ -28,6 +28,11 @@ EXTRA_DIST = \
## pygimp=
## endif
## gimp-perl is disabled for the moment
## until it has catched up with the API
## changes in libgimp
GIMP_PERL=
SUBDIRS = \
libgck \
dbbrowser \

View File

@ -139,7 +139,8 @@ sub declare_args {
my $type = exists $_->{no_id_lookup} ? 'gint32 ' : $arg->{type};
$result .= ' ' x 2 . $type . &arg_vname($_);
if (!exists $_->{no_init} && exists $_->{init}) {
if (!exists $_->{no_init} && exists $_->{init} &&
!exists $arg->{struct}) {
for ($arg->{type}) {
/\*$/ && do { $result .= ' = NULL'; last };
/boolean/ && do { $result .= ' = FALSE'; last };

View File

@ -67,6 +67,7 @@ sub generate {
my $rettype = $argtype->{type};
$rettype =~ s/int32/int/ unless exists $arg->{keep_size};
$rettype .= '*' if exists $argtype->{struct};
return $rettype;
}

View File

@ -31,8 +31,10 @@ package Gimp::CodeGen::pdb;
floatarray => { name => 'FLOATARRAY' , type => 'gdouble *', array => 1 },
stringarray => { name => 'STRINGARRAY', type => 'gchar **' , array => 1 },
color => { name => 'COLOR' , type => 'GimpRGB *', struct => 1 },
color => { name => 'COLOR' ,
type => 'GimpRGB ',
headers => [ qw("libgimpcolor/gimpcolor.h") ],
struct => 1 },
display => { name => 'DISPLAY',
type => 'GDisplay *',
headers => [ qw("gdisplay.h") ],
@ -138,6 +140,7 @@ sub arg_ptype {
elsif ($arg->{type} =~ /GimpUnit/) { 'int' }
elsif ($arg->{type} =~ /int/) { 'int' }
elsif ($arg->{type} =~ /double/) { 'float' }
elsif ($arg->{type} =~ /GimpRGB/) { 'color' }
else { 'pointer' }
};
}

View File

@ -51,8 +51,7 @@ sub channel_get_prop_proc {
$invoke{code} = <<'CODE'
{
color = g_new (GimpRGB, 1);
*color = channel->color;
color = channel->color;
}
CODE
}
@ -84,7 +83,7 @@ sub channel_set_prop_proc {
%invoke = (
code => <<'CODE'
{
GimpRGB rgb_color = *color;
GimpRGB rgb_color = color;
rgb_color.a = channel->color.a;
channel_set_color(channel, &rgb_color);
@ -159,7 +158,7 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpRGB rgb_color = *color;
GimpRGB rgb_color = color;
rgb_color.a = opacity / 100.0;
channel = channel_new (gimage, width, height, name, &rgb_color);
@ -244,7 +243,7 @@ HELP
$date = '1998';
CODE
@headers = qw("libgimpcolor/gimpcolor.h" "channel.h");
@headers = qw("channel.h");
unshift @procs, qw(channel_new channel_copy channel_delete);
%exports = (app => [@procs], lib => [@procs]);

View File

@ -283,8 +283,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/by_color_select.h") ],
headers => [ qw("tools/by_color_select.h") ],
vars => [ 'GimpImage *gimage', 'guchar fixme[3]' ],
code => <<'CODE'
{
@ -413,8 +412,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/color_picker.h") ],
headers => [ qw("tools/color_picker.h") ],
code => <<'CODE'
{
if (!sample_merged)
@ -427,8 +425,7 @@ HELP
save_color);
if (success)
{
color = g_new (GimpRGB, 1);
gimp_rgba_set_uchar (color,
gimp_rgba_set_uchar (&color,
col_value[RED_PIX],
col_value[GREEN_PIX],
col_value[BLUE_PIX],

View File

@ -283,8 +283,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/by_color_select.h") ],
headers => [ qw("tools/by_color_select.h") ],
vars => [ 'GimpImage *gimage', 'guchar fixme[3]' ],
code => <<'CODE'
{
@ -413,8 +412,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/color_picker.h") ],
headers => [ qw("tools/color_picker.h") ],
code => <<'CODE'
{
if (!sample_merged)
@ -427,8 +425,7 @@ HELP
save_color);
if (success)
{
color = g_new (GimpRGB, 1);
gimp_rgba_set_uchar (color,
gimp_rgba_set_uchar (&color,
col_value[RED_PIX],
col_value[GREEN_PIX],
col_value[BLUE_PIX],

View File

@ -37,8 +37,7 @@ sub invoke_get {
headers => [ qw("gimpimage.h" "gimpcontext.h") ],
code => <<CODE
{
color = g_new (GimpRGB, 1);
gimp_context_get_@{[shift]}ground (NULL, color);
gimp_context_get_@{[shift]}ground (NULL, &color);
}
CODE
);
@ -47,12 +46,10 @@ CODE
sub invoke_set {
%invoke = (
headers => [ qw("gimpimage.h") ],
vars => [ 'GimpRGB rgb_color' ],
code => <<CODE
{
rgb_color = *color;
rgb_color.a = 1.0;
gimp_context_set_@{[shift]}ground (NULL, &rgb_color);
gimp_rgb_set_alpha (&color, 1.0);
gimp_context_set_@{[shift]}ground (NULL, &color);
}
CODE
);
@ -172,7 +169,7 @@ CODE
);
}
@headers = qw("libgimpcolor/gimpcolor.h" "gimpcontext.h" "palette.h");
@headers = qw("gimpcontext.h" "palette.h");
@procs = qw(palette_get_foreground palette_get_background
palette_set_foreground palette_set_background

View File

@ -283,8 +283,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/by_color_select.h") ],
headers => [ qw("tools/by_color_select.h") ],
vars => [ 'GimpImage *gimage', 'guchar fixme[3]' ],
code => <<'CODE'
{
@ -413,8 +412,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/color_picker.h") ],
headers => [ qw("tools/color_picker.h") ],
code => <<'CODE'
{
if (!sample_merged)
@ -427,8 +425,7 @@ HELP
save_color);
if (success)
{
color = g_new (GimpRGB, 1);
gimp_rgba_set_uchar (color,
gimp_rgba_set_uchar (&color,
col_value[RED_PIX],
col_value[GREEN_PIX],
col_value[BLUE_PIX],

View File

@ -283,8 +283,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/by_color_select.h") ],
headers => [ qw("tools/by_color_select.h") ],
vars => [ 'GimpImage *gimage', 'guchar fixme[3]' ],
code => <<'CODE'
{
@ -413,8 +412,7 @@ HELP
);
%invoke = (
headers => [ qw("libgimpcolor/gimpcolor.h"
"tools/color_picker.h") ],
headers => [ qw("tools/color_picker.h") ],
code => <<'CODE'
{
if (!sample_merged)
@ -427,8 +425,7 @@ HELP
save_color);
if (success)
{
color = g_new (GimpRGB, 1);
gimp_rgba_set_uchar (color,
gimp_rgba_set_uchar (&color,
col_value[RED_PIX],
col_value[GREEN_PIX],
col_value[BLUE_PIX],