Commit db71b6e0 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Sven Neumann <sven@gimp.org> Simon Budig <Simon.Budig@unix-ag.org> Garry

2000-06-01  Michael Natterer  <mitch@gimp.org>
	    Sven Neumann  <sven@gimp.org>
	    Simon Budig  <Simon.Budig@unix-ag.org>
	    Garry R. Osgood  <gosgood@idt.net>
	    Seth Burgess <sjburges@gimp.org>
	    Tuomas Kuosmanen <tigert@gimp.org>
	    Tor Lillqvist <tml@iki.fi>
	    Andy Thomas <alt@gimp.org>
	    Andreas Bogk <andreas@andreas.org>
	    Vincent Kolwitz <vincent@andreas.org>

	The remaining bits ...

	* tools/pdbgen/Makefile.am
	* tools/pdbgen/groups.pl
	* tools/pdbgen/pdb/gradient.pdb  -> gradients.pdb

	* app/Makefile.am
	* app/gradient_cmds.c  -> gradients_cmds.c

	* libgimp/gimpbrushes_pdb.[ch]
	* libgimp/gimpfileops_pdb.[ch]
	* libgimp/gimpguides_pdb.[ch]
	* libgimp/gimphelp_pdb.[ch]
	* libgimp/gimpmessage_pdb.[ch]
	* libgimp/gimpparasite_pdb.[ch]
	* libgimp/gimppatterns_pdb.[ch]
	* libgimp/gimpplugin_pdb.[ch]: replaced with code based on
	files generated using pdbgen

	* libgimp/gimpbrushmenu.c
	* libgimp/gimppatternmenu.c:
	reflect changes in gimp[brushes|patterns]_pdb.[ch]

	* tools/pdbgen/pdb/gradient.pdb  -> gradients.pdb

	* tools/pdbgen/pdb/plug_in.pdb: made it create libgimp code
parent 5f7e2a8d
......@@ -3,6 +3,45 @@
Simon Budig <Simon.Budig@unix-ag.org>
Garry R. Osgood <gosgood@idt.net>
Seth Burgess <sjburges@gimp.org>
Tuomas Kuosmanen <tigert@gimp.org>
Tor Lillqvist <tml@iki.fi>
Andy Thomas <alt@gimp.org>
Andreas Bogk <andreas@andreas.org>
Vincent Kolwitz <vincent@andreas.org>
The remaining bits ...
* tools/pdbgen/Makefile.am
* tools/pdbgen/groups.pl
* tools/pdbgen/pdb/gradient.pdb -> gradients.pdb
* app/Makefile.am
* app/gradient_cmds.c -> gradients_cmds.c
* libgimp/gimpbrushes_pdb.[ch]
* libgimp/gimpfileops_pdb.[ch]
* libgimp/gimpguides_pdb.[ch]
* libgimp/gimphelp_pdb.[ch]
* libgimp/gimpmessage_pdb.[ch]
* libgimp/gimpparasite_pdb.[ch]
* libgimp/gimppatterns_pdb.[ch]
* libgimp/gimpplugin_pdb.[ch]: replaced with code based on
files generated using pdbgen
* libgimp/gimpbrushmenu.c
* libgimp/gimppatternmenu.c:
reflect changes in gimp[brushes|patterns]_pdb.[ch]
* tools/pdbgen/pdb/gradient.pdb -> gradients.pdb
* tools/pdbgen/pdb/plug_in.pdb: made it create libgimp code
2000-06-01 Michael Natterer <mitch@gimp.org>
Sven Neumann <sven@gimp.org>
Simon Budig <Simon.Budig@unix-ag.org>
Garry R. Osgood <gosgood@idt.net>
Seth Burgess <sjburges@gimp.org>
Tor Lillqvist <tml@iki.fi>
* libgimp/gimpchannel_pdb.[ch]
* libgimp/gimpproceduraldb_pdb.[ch]
......
......@@ -227,7 +227,7 @@ gimp_SOURCES = \
gradient_select.c \
gradient_select_cmds.c \
gradient.h \
gradient_cmds.c \
gradients_cmds.c \
gtkwrapbox.c \
gtkwrapbox.h \
gtkhwrapbox.c \
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
#include "procedural_db.h"
#include "gimpcontext.h"
#include "gradient_header.h"
static ProcRecord gradients_get_list_proc;
static ProcRecord gradients_get_active_proc;
static ProcRecord gradients_set_active_proc;
static ProcRecord gradients_sample_uniform_proc;
static ProcRecord gradients_sample_custom_proc;
void
register_gradients_procs (void)
{
procedural_db_register (&gradients_get_list_proc);
procedural_db_register (&gradients_get_active_proc);
procedural_db_register (&gradients_set_active_proc);
procedural_db_register (&gradients_sample_uniform_proc);
procedural_db_register (&gradients_sample_custom_proc);
}
static Argument *
gradients_get_list_invoker (Argument *args)
{
gboolean success;
Argument *return_args;
gchar **gradients;
gradient_t *grad;
GSList *list;
int i = 0;
gradients = g_new (gchar *, num_gradients);
success = (list = gradients_list) != NULL;
while (list)
{
grad = list->data;
gradients[i++] = g_strdup (grad->name);
list = list->next;
}
return_args = procedural_db_return_args (&gradients_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = num_gradients;
return_args[2].value.pdb_pointer = gradients;
}
return return_args;
}
static ProcArg gradients_get_list_outargs[] =
{
{
PDB_INT32,
"num_gradients",
"The number of loaded gradients"
},
{
PDB_STRINGARRAY,
"gradient_names",
"The list of gradient names"
}
};
static ProcRecord gradients_get_list_proc =
{
"gimp_gradients_get_list",
"Retrieve the list of loaded gradients.",
"This procedure returns a list of the gradients that are currently loaded in the gradient editor. You can later use the gimp_gradients_set_active function to set the active gradient.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
PDB_INTERNAL,
0,
NULL,
2,
gradients_get_list_outargs,
{ { gradients_get_list_invoker } }
};
static Argument *
gradients_get_active_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
success = gimp_context_get_gradient (NULL) != NULL;
return_args = procedural_db_return_args (&gradients_get_active_proc, success);
if (success)
return_args[1].value.pdb_pointer = g_strdup (gimp_context_get_gradient (NULL)->name);
return return_args;
}
static ProcArg gradients_get_active_outargs[] =
{
{
PDB_STRING,
"name",
"The name of the active gradient"
}
};
static ProcRecord gradients_get_active_proc =
{
"gimp_gradients_get_active",
"Retrieve the name of the active gradient.",
"This procedure returns the name of the active gradient in the gradient editor.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
PDB_INTERNAL,
0,
NULL,
1,
gradients_get_active_outargs,
{ { gradients_get_active_invoker } }
};
static Argument *
gradients_set_active_invoker (Argument *args)
{
gboolean success = TRUE;
gchar *name;
gradient_t *gradient;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL)
success = FALSE;
if (success)
{
gradient = gradient_list_get_gradient (gradients_list, name);
success = FALSE;
if (gradient)
{
gimp_context_set_gradient (NULL, gradient);
success = TRUE;
}
}
return procedural_db_return_args (&gradients_set_active_proc, success);
}
static ProcArg gradients_set_active_inargs[] =
{
{
PDB_STRING,
"name",
"The name of the gradient to set"
}
};
static ProcRecord gradients_set_active_proc =
{
"gimp_gradients_set_active",
"Sets the specified gradient as the active gradient.",
"This procedure lets you set the specified gradient as the active or \"current\" one. The name is simply a string which corresponds to one of the loaded gradients in the gradient editor. If no matching gradient is found, this procedure will return an error. Otherwise, the specified gradient will become active and will be used for subsequent custom gradient operations.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
PDB_INTERNAL,
1,
gradients_set_active_inargs,
0,
NULL,
{ { gradients_set_active_invoker } }
};
static Argument *
gradients_sample_uniform_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gint32 i;
gint32 array_length = 0;
gdouble *color_samples = NULL;
gradient_t *gradient;
gdouble pos, delta;
gdouble r, g, b, a;
gdouble *pv;
i = args[0].value.pdb_int;
if (i < 2)
success = FALSE;
if (success)
{
pos = 0.0;
delta = 1.0 / (i - 1);
array_length = i * 4;
pv = color_samples = g_new (gdouble, array_length);
gradient = gimp_context_get_gradient (NULL);
while (i--)
{
gradient_get_color_at (gradient, pos, &r, &g, &b, &a);
*pv++ = r;
*pv++ = g;
*pv++ = b;
*pv++ = a;
pos += delta;
}
}
return_args = procedural_db_return_args (&gradients_sample_uniform_proc, success);
if (success)
{
return_args[1].value.pdb_int = array_length;
return_args[2].value.pdb_pointer = color_samples;
}
return return_args;
}
static ProcArg gradients_sample_uniform_inargs[] =
{
{
PDB_INT32,
"num_samples",
"The number of samples to take"
}
};
static ProcArg gradients_sample_uniform_outargs[] =
{
{
PDB_INT32,
"array_length",
"Length of the color_samples array (4 * num_samples)"
},
{
PDB_FLOATARRAY,
"color_samples",
"Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }"
}
};
static ProcRecord gradients_sample_uniform_proc =
{
"gimp_gradients_sample_uniform",
"Sample the active gradient in uniform parts.",
"This procedure samples the active gradient from the gradient editor in the specified number of uniform parts. It returns a list of floating-point values which correspond to the RGBA values for each sample. The minimum number of samples to take is 2, in which case the returned colors will correspond to the { 0.0, 1.0 } positions in the gradient. For example, if the number of samples is 3, the procedure will return the colors at positions { 0.0, 0.5, 1.0 }.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
PDB_INTERNAL,
1,
gradients_sample_uniform_inargs,
2,
gradients_sample_uniform_outargs,
{ { gradients_sample_uniform_invoker } }
};
static Argument *
gradients_sample_custom_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gint32 i;
gdouble *pos;
gint32 array_length = 0;
gdouble *color_samples = NULL;
gradient_t *gradient;
gdouble r, g, b, a;
gdouble *pv;
i = args[0].value.pdb_int;
if (i <= 0)
success = FALSE;
pos = (gdouble *) args[1].value.pdb_pointer;
if (success)
{
array_length = i * 4;
pv = color_samples = g_new (gdouble, array_length);
gradient = gimp_context_get_gradient (NULL);
while (i--)
{
gradient_get_color_at (gradient, *pos, &r, &g, &b, &a);
*pv++ = r;
*pv++ = g;
*pv++ = b;
*pv++ = a;
pos++;
}
}
return_args = procedural_db_return_args (&gradients_sample_custom_proc, success);
if (success)
{
return_args[1].value.pdb_int = array_length;
return_args[2].value.pdb_pointer = color_samples;
}
return return_args;
}
static ProcArg gradients_sample_custom_inargs[] =
{
{
PDB_INT32,
"num_samples",
"The number of samples to take"
},
{
PDB_FLOATARRAY,
"positions",
"The list of positions to sample along the gradient"
}
};
static ProcArg gradients_sample_custom_outargs[] =
{
{
PDB_INT32,
"array_length",
"Length of the color_samples array (4 * num_samples)"
},
{
PDB_FLOATARRAY,
"color_samples",
"Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }"
}
};
static ProcRecord gradients_sample_custom_proc =
{
"gimp_gradients_sample_custom",
"Sample the active gradient in custom positions.",
"This procedure samples the active gradient from the gradient editor in the specified number of points. The procedure will sample the gradient in the specified positions from the list. The left endpoint of the gradient corresponds to position 0.0, and the right endpoint corresponds to 1.0. The procedure returns a list of floating-point values which correspond to the RGBA values for each sample.",
"Federico Mena Quintero",
"Federico Mena Quintero",
"1997",
PDB_INTERNAL,
2,
gradients_sample_custom_inargs,
2,
gradients_sample_custom_outargs,
{ { gradients_sample_custom_invoker } }
};
......@@ -39,7 +39,7 @@ void register_edit_procs (void);
void register_fileops_procs (void);
void register_floating_sel_procs (void);
void register_gimprc_procs (void);
void register_gradient_procs (void);
void register_gradients_procs (void);
void register_gradient_select_procs (void);
void register_guides_procs (void);
void register_help_procs (void);
......@@ -102,7 +102,7 @@ internal_procs_init (void)
register_gimprc_procs ();
app_init_update_status (NULL, _("Gradients"), 0.292);
register_gradient_procs ();
register_gradients_procs ();
app_init_update_status (NULL, _("Gradient UI"), 0.307);
register_gradient_select_procs ();
......
......@@ -37,7 +37,7 @@ PDB_WRAPPERS_C = \
gimpfileops_pdb.c \
gimpfloatingsel_pdb.c \
gimpgimprc_pdb.c \
gimpgradient_pdb.c \
gimpgradients_pdb.c \
gimpgradientselect_pdb.c \
gimpguides_pdb.c \
gimphelp_pdb.c \
......@@ -70,7 +70,7 @@ PDB_WRAPPERS_H = \
gimpfileops_pdb.h \
gimpfloatingsel_pdb.h \
gimpgimprc_pdb.h \
gimpgradient_pdb.h \
gimpgradients_pdb.h \
gimpgradientselect_pdb.h \
gimpguides_pdb.h \
gimphelp_pdb.h \
......
......@@ -82,6 +82,8 @@ extern "C" {
#define gimp_drawable_image_id gimp_drawable_image
#define gimp_drawable_bpp gimp_drawable_bytes
#define gimp_channel_get_image_id gimp_drawable_image
#define gimp_layer_get_mask_id gimp_layer_mask
#define gimp_layer_get_image_id gimp_drawable_image
#define gimp_layer_is_floating_selection gimp_layer_is_floating_sel
......
......@@ -34,7 +34,7 @@
#include <libgimp/gimpfileops_pdb.h>
#include <libgimp/gimpfloatingsel_pdb.h>
#include <libgimp/gimpgimprc_pdb.h>
#include <libgimp/gimpgradient_pdb.h>
#include <libgimp/gimpgradients_pdb.h>
#include <libgimp/gimpgradientselect_pdb.h>
#include <libgimp/gimpguides_pdb.h>
#include <libgimp/gimphelp_pdb.h>
......
......@@ -28,18 +28,22 @@ gimp_brushes_get_brush_data (gchar *brush_name,
GimpLayerModeEffects *paint_mode,
gint *width,
gint *height,
gint *mask_data_size,
guint8 **mask_data)
{
GParam *return_vals;
gint nreturn_vals;
gint num_mask_data;
return_vals = gimp_run_procedure ("gimp_brushes_get_brush_data",
&nreturn_vals,
PARAM_STRING, brush_name,
PARAM_END);
brush_name = NULL;
brush_name = NULL;
*width = 0;
*height = 0;
*mask_data_size = 0;
*mask_data = NULL;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
brush_name = g_strdup (return_vals[1].data.d_string);
......@@ -48,10 +52,10 @@ gimp_brushes_get_brush_data (gchar *brush_name,
*paint_mode = return_vals[4].data.d_int32;
*width = return_vals[5].data.d_int32;
*height = return_vals[6].data.d_int32;
num_mask_data = return_vals[7].data.d_int32;
*mask_data = g_new (guint8, num_mask_data);
*mask_data_size = return_vals[7].data.d_int32;
*mask_data = g_new (guint8, *mask_data_size);
memcpy (*mask_data, return_vals[8].data.d_int8array,
num_mask_data * sizeof (guint8));
*mask_data_size * sizeof (guint8));
}
gimp_destroy_params (return_vals, nreturn_vals);
......
......@@ -37,6 +37,7 @@ gchar* gimp_brushes_get_brush_data (gchar *brush_name,
GimpLayerModeEffects *paint_mode,
gint *width,
gint *height,
gint *mask_data_size,
guint8 **mask_data);
......
......@@ -270,7 +270,7 @@ brush_select_invoker (gchar *name,
bsel->height = height;
mask_d_sz = width * height;
bsel->mask_data = g_malloc (mask_d_sz);
g_memmove(bsel->mask_data, mask_data, mask_d_sz);
g_memmove (bsel->mask_data, mask_data, mask_d_sz);
brush_pre_update (bsel->brush_preview,
bsel->width, bsel->height, bsel->mask_data);
......@@ -326,6 +326,7 @@ gimp_brush_select_widget (gchar *dname,
gint init_spacing;
GimpLayerModeEffects init_paint_mode;
gdouble init_opacity;
gint mask_data_size;
guint8 *mask_data;
gchar *brush_name;
BSelect *bsel;
......@@ -366,6 +367,7 @@ gimp_brush_select_widget (gchar *dname,
&init_paint_mode,
&width,
&height,
&mask_data_size,
&mask_data);
if (brush_name)
{
......@@ -431,6 +433,7 @@ gimp_brush_select_widget_set_popup (GtkWidget *widget,
gint init_spacing;
GimpLayerModeEffects init_paint_mode;
gdouble init_opacity;
gint *mask_data_size;
guint8 *mask_data;
gchar *brush_name;
BSelect *bsel;
......@@ -445,6 +448,7 @@ gimp_brush_select_widget_set_popup (GtkWidget *widget,
&init_paint_mode,
&width,
&height,
&mask_data_size,
&mask_data);
if (opacity == -1.0)
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpfileops_pdb.c
*
......@@ -11,7 +11,7 @@
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
......@@ -19,21 +19,22 @@
* Boston, MA 02111-1307, USA.
*/
#include "gimp.h"
/* NOTE: This file is autogenerated by pdbgen.pl */
#include "gimp.h"
void
gimp_register_magic_load_handler (gchar *name,
gimp_register_magic_load_handler (gchar *procedure_name,
gchar *extensions,
gchar *prefixes,
gchar *magics)
{
GimpParam *return_vals;
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_register_magic_load_handler",
&nreturn_vals,
PARAM_STRING, name,
PARAM_STRING, procedure_name,
PARAM_STRING, extensions,
PARAM_STRING, prefixes,
PARAM_STRING, magics,
......@@ -43,16 +44,16 @@ gimp_register_magic_load_handler (gchar *name,
}
void
gimp_register_load_handler (gchar *name,
gimp_register_load_handler (gchar *procedure_name,
gchar *extensions,
gchar *prefixes)
{
GimpParam *return_vals;
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_register_load_handler",
&nreturn_vals,
PARAM_STRING, name,
PARAM_STRING, procedure_name,
PARAM_STRING, extensions,
PARAM_STRING, prefixes,
PARAM_END);
......@@ -61,16 +62,16 @@ gimp_register_load_handler (gchar *name,
}
void
gimp_register_save_handler (gchar *name,
gimp_register_save_handler (gchar *procedure_name,
gchar *extensions,
gchar *prefixes)
{
GimpParam *return_vals;
GParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure ("gimp_register_save_handler",
&nreturn_vals,
PARAM_STRING, name,
PARAM_STRING, procedure_name,
PARAM_STRING, extensions,
PARAM_STRING, prefixes,
PARAM_END);
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpfileops_pdb.h
*
......@@ -7,20 +7,22 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
*/
#ifndef __GIMP_FILE_OPS_PDB_H__
#define __GIMP_FILE_OPS_PDB_H__
/* NOTE: This file is autogenerated by pdbgen.pl */
#ifndef __GIMP_FILEOPS_PDB_H__
#define __GIMP_FILEOPS_PDB_H__
#ifdef __cplusplus
extern "C" {
......@@ -29,28 +31,20 @@ extern "C" {
/* For information look into the C source or the html documentation */
/* Install a load file format handler in the procedure database.
*/
void gimp_register_magic_load_handler (gchar *name,
gchar *extensions,
gchar *prefixes,
gchar *magics);
/* Install a load file format handler in the procedure database.
*/
void gimp_register_load_handler (gchar *name,
gchar *extensions,
gchar *prefixes);
/* Install a save file format handler in the procedure database.
*/
void gimp_register_save_handler (gchar *name,
gchar *extensions,
gchar *prefixes);
void gimp_register_magic_load_handler (gchar *procedure_name,
gchar *extensions,
gchar *prefixes,
gchar *magics);
void gimp_register_load_handler (gchar *procedure_name,
gchar *extensions,
gchar *prefixes);
void gimp_register_save_handler (gchar *procedure_name,
gchar *extensions,
gchar *prefixes);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMP_FILE_OPS_PDB_H__ */
#endif /* __GIMP_FILEOPS_PDB_H__ */
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpgradient_pdb.c
* gimpgradients_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -11,7 +11,7 @@
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of