diff --git a/tools/pdbgen/pdb/channel_ops.pdb b/tools/pdbgen/pdb/channel_ops.pdb new file mode 100644 index 0000000000..842abeee88 --- /dev/null +++ b/tools/pdbgen/pdb/channel_ops.pdb @@ -0,0 +1,91 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub channel_ops_offset { + $blurb = <<'BLURB'; +Offset the drawable by the specified amounts in the X and Y directions +BLURB + + $help = <<'HELP'; +This procedure offsets the specified drawable by the amounts specified by +'offset_x' and 'offset_y'. If 'wrap_around' is set to TRUE, then portions of +the drawable which are offset out of bounds are wrapped around. Alternatively, +the undefined regions of the drawable can be filled with transparency or the +background color, as specified by the 'fill_type' parameter. +HELP + + &std_pdb_misc; + $date = '1997'; + + @inargs = ( + &std_image_arg, + { name => 'drawable', type => 'drawable', + desc => 'The drawable to offset' }, + { name => 'wrap_around', type => 'boolean', + desc => 'wrap image around or fill vacated regions' }, + { name => 'fill_type', type => 'enum GimpOffsetType', + desc => 'fill vacated regions of drawable with background or + transparent: $desc' }, + { name => 'offset_x', type => 'int32', + desc => 'offset by this amount in X direction' }, + { name => 'offset_y', type => 'int32', + desc => 'offset by this amount in Y direction' } + ); + + %invoke = ( + headers => [ qw(channel_ops.h) ], + code => <<'CODE' +offset (gimage, drawable, wrap_around, fill_type, offset_x, offset_y); +CODE + ); +} + +sub channel_ops_duplicate { + $blurb = 'Duplicate the specified image'; + + $help = <<'HELP'; +This procedure duplicates the specified image, copying all layers, channels, +and image information. +HELP + + &std_pdb_misc; + $date = '1997'; + + @inargs = ( &std_image_arg ); + + @outargs = ( + { name => 'new_image', type => 'image', + desc => 'the new, duplicated image', + alias => 'new_gimage' } + ); + + %invoke = ( + headers => [ qw("gimage.h") ], + code => <<'CODE' +success = ((new_gimage = duplicate ((void *) gimage)) != NULL); +CODE + ); +} + +@procs = qw(channel_ops_offset channel_ops_duplicate); +%exports = (app => [@procs]); + +$desc = 'Channel Ops'; + +1; diff --git a/tools/pdbgen/pdb/convert.pdb b/tools/pdbgen/pdb/convert.pdb new file mode 100644 index 0000000000..63026102aa --- /dev/null +++ b/tools/pdbgen/pdb/convert.pdb @@ -0,0 +1,188 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub simple_inargs { + @inargs = ( + &std_image_arg + ); +} + +sub simple_invoke { + my $type = shift; + %invoke = ( + headers => [ qw("gimage.h" "convert.h") ], + code => < 'dither', type => 'boolean', + desc => 'Floyd-Steinberg dithering' }, + { name => 'num_cols', type => 'int32', + desc => 'the number of colors to quantize to' } + ); + + %invoke = ( + headers => [ qw("gimage.h" "convert.h") ], + code => <<'CODE' +{ + success = (gimage_base_type (gimage) != INDEXED); + + if (num_cols < 1 || num_cols > MAXNUMCOLORS) + success = FALSE; + + if (success) + convert_image ((void *) gimage, INDEXED, num_cols, dither, 0); +} +CODE + ); +} + +sub convert_indexed_palette { + $blurb = 'Convert specified image to indexed color'; + + $help = <<'HELP'; +This procedure converts the specified image to indexed color. This process +requires an image of type GRAY or RGB. The 'palette_type' specifies what kind +of palette to use, A type of '0' means to use an optimal palette of 'num_cols' +generated from the colors in the image. A type of '1' means to re-use the +previous palette. A type of '2' means to use the WWW-optimized palette. Type +'3' means to use only black and white colors. A type of '4' means to use a +palette from the gimp palettes directories. +HELP + + &std_pdb_misc; + + @inargs = ( + &std_image_arg, + { name => 'dither', type => 'boolean', + desc => 'Floyd-Steinberg dithering' }, + { name => 'palette_type', type => 'enum GimpDitherPaletteType', + desc => 'The type of palette to use: $desc' }, + { name => 'num_cols', type => 'int32', + desc => 'the number of colors to quantize to, ignored unless + (palette_type == 0)' }, + { name => 'palette', type => 'string', + desc => 'The name of the custom palette to use, ignored unless + (palette_type == 4)' } + ); + + %invoke = ( + headers => [ qw("gimage.h" "convert.h" "palette.h") ], + code => <<'CODE' +{ + if (success = (gimage_base_type (gimage) != INDEXED)) + { + PaletteEntriesP entries, the_palette = NULL; + GSList *list; + + switch (palette_type) + { + case MAKE_PALETTE: + if (num_cols < 1 || num_cols > MAXNUMCOLORS) + success = FALSE; + break; + + case REUSE_PALETTE: + case WEB_PALETTE: + case MONO_PALETTE: + break; + + case CUSTOM_PALETTE: + if (!palette_entries_list) + palette_init_palettes (FALSE); + + for (list = palette_entries_list; list; list = g_slist_next (list)) + { + entries = (PaletteEntriesP) list->data; + if (strcmp (palette_name, entries->name) == 0) + { + the_palette = entries; + break; + } + } + + if (the_palette == NULL) + success = FALSE; + else + theCustomPalette = the_palette; + + break; + + default: + success = FALSE; + } + } + + if (success) + convert_image ((void *) gimage, INDEXED, num_cols, dither, palette_type); +} +CODE + ); +} + +@procs = qw(convert_rgb convert_grayscale convert_indexed + convert_indexed_palette); +%exports = (app => [@procs]); + +$desc = 'Convert'; + +1; diff --git a/tools/pdbgen/pdb/display.pdb b/tools/pdbgen/pdb/display.pdb new file mode 100644 index 0000000000..43928e2a42 --- /dev/null +++ b/tools/pdbgen/pdb/display.pdb @@ -0,0 +1,99 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# The defs + +sub display_new { + $blurb = 'Create a new display for the specified image.'; + + $help = <<'HELP'; +Creates a new display for the specified image. If the image already has a +display, another is added. Multiple displays are handled transparently by the +GIMP. The newly created display is returned and can be subsequently destroyed +with a call to 'gimp-display-delete'. This procedure only makes sense for use +with the GIMP UI. +HELP + + &std_pdb_misc; + + @inargs = ( &std_image_arg ); + + @outargs = ( + { name => 'display', type => 'display', + desc => 'The new display' } + ); + + %invoke = ( + headers => [ qw("gdisplay.h") ], + vars => [ 'guint scale = 0x101' ], + code => <<'CODE' +{ + if (gimage->layers == NULL) + success = FALSE; + else + success = ((display = gdisplay_new (gimage, scale)) != NULL); +} +CODE + ); +} + +sub display_delete { + $blurb = 'Delete the specified display'; + + $help = <<'HELP'; +This procedure removes the specified display. If this is the last remaining +display for the underlying image, then the image is deleted also. +HELP + + &std_pdb_misc; + + @inargs = ( + { name => 'display', type => 'display', + desc => 'The display to delete' } + ); + + %invoke = ( + headers => [ qw("gdisplay.h") ], + code => 'gtk_widget_destroy (display->shell);' + ); +} + +sub displays_flush { + $blurb = 'Flush all internal changes to the user interface'; + + $help = <<'HELP'; +This procedure takes no arguments and returns nothing except a success status. +Its purpose is to flush all pending updates of image manipulations to the user +interface. It should be called whenever appropriate. +HELP + + &std_pdb_misc; + + %invoke = ( + headers => [ qw("gdisplay.h") ], + code => 'gdisplays_flush ();' + ); +} + +@procs = qw(display_new display_delete displays_flush); +%exports = (app => [@procs], lib => [@procs]); + +$desc = 'GDisplay procedures'; + +1; diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb new file mode 100644 index 0000000000..f50832e02a --- /dev/null +++ b/tools/pdbgen/pdb/drawable.pdb @@ -0,0 +1,74 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub drawable_arg { + { name => 'drawable', type => 'drawable', desc => 'The drawable' } +} + +sub drawable_merge_shadow { + $blurb = 'Merge the shadow buffer with the specified drawable.'; + + $help = <<'HELP'; +This procedure combines the contents of the image's shadow buffer (for +temporary processing) with the specified drawable. The "undo" parameter +specifies whether to add an undo step for the operation. Requesting no undo is +useful for such applications as 'auto-apply'. +HELP + + &std_pdb_misc; + + @inargs = ( + &drawable_arg, + { name => 'undo', type => 'boolean', + desc => 'Push merge to undo stack?' } + ); + + %invoke = ( + headers => [ qw("drawable.h") ], + code => 'drawable_merge_shadow (drawable, undo);' + ); +} + +sub drawable_fill { + $blurb = 'Fill the drawable with the specified fill mode.'; + + $help = <<'HELP'; +This procedure fills the drawable with the fill mode. If the fill mode is +foreground the current foreground color is used. If the fill mode is +background, the current background color is used. If the fill type is white, +then white is used. Transparent fill only affects layers with an alpha channel, +in which case the alpha channel is set to transparent. If the drawable has no +alpha channel, it is filled to white. No fill leaves the drawable's contents +undefined. This procedure is unlike the bucket fill tool because it fills +regardless of a selection +HELP + + &std_pdb_misc; + + @inargs = ( + &drawable_arg, + { name => 'fill_type', type => 'enum GimpFillType', + desc => 'The type of fill: $desc' } + ); + + %invoke = ( + headers => [ qw("drawable.h") ], + code => 'drawable_fill (drawable, fill_type);' + ); +} diff --git a/tools/pdbgen/pdb/edit.pdb b/tools/pdbgen/pdb/edit.pdb new file mode 100644 index 0000000000..899529e2fe --- /dev/null +++ b/tools/pdbgen/pdb/edit.pdb @@ -0,0 +1,169 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# Common arguments for image and drawable +sub inargs { + @inargs = ( + &std_image_arg, + { name => 'drawable', type => 'drawable', + desc => "The drawable to @{[shift]}" } + ); +} + +# Common invoker for checking for image/drawable consistency +sub invoke { + %invoke = ( + headers => [ qw("global_edit.h") ], + code => < 'paste_into', type => 'boolean', + desc => 'Clear selection, or paste behind it?' }; + + @outargs = ( + { name => 'floating_sel', type => 'layer', + desc => 'The new floating selection', alias => 'layer' } + ); + + &invoke('(layer != NULL)'); + $cmd = "layer = edit_paste (gimage, drawable, global_buf, paste_into);\n"; + $invoke{code} =~ s/(else\n)/$1 . ' ' x 4 . "{\n" . ' ' x 6 . $cmd/se; + $invoke{code} =~ s/(success = \(.*?\n)/' ' x 2 . $1 . ' ' x 4 . "}\n"/se; +} + +sub edit_clear { + $blurb = 'Clear selected area of drawable.'; + + $help = <<'HELP'; +This procedure clears the specified drawable. If the drawable has an alpha +channel, the cleared pixels will become transparent. If the drawable does not +have an alpha channel, cleared pixels will be set to the background color. This +procedure only affects regions within a selection if there is a selection +active. +HELP + + &std_pdb_misc; + &inargs('clear from'); + &invoke('edit_clear (gimage, drawable)'); +} + +sub edit_fill { + $blurb = 'Fill selected area of drawable.'; + + $help = <<'HELP'; +This procedure fills the specified drawable with the background color. This +procedure only affects regions within a selection if there is a selection +active. +HELP + + &std_pdb_misc; + &inargs('fill to'); + &invoke('edit_fill (gimage, drawable)'); +} + +sub edit_stroke { + $blurb = 'Stroke the current selection'; + + $help = <<'HELP'; +This procedure strokes the current selection, painting along the selection +boundary with the active brush and foreground color. The paint is applied to +the specified drawable regardless of the active selection. +HELP + + &std_pdb_misc; + &inargs('stroke to'); + &invoke('gimage_mask_stroke (gimage, drawable)'); + push @{$invoke{headers}}, qw("gimage_mask.h"); +} + +@procs = qw(edit_cut edit_copy edit_paste edit_clear edit_fill edit_stroke); +%exports = (app => [@procs]); + +$desc = 'Edit procedures'; + +# For edit_paste +$code = "extern TileManager *global_buf;\n"; + +1; diff --git a/tools/pdbgen/pdb/floating_sel.pdb b/tools/pdbgen/pdb/floating_sel.pdb new file mode 100644 index 0000000000..15411fe545 --- /dev/null +++ b/tools/pdbgen/pdb/floating_sel.pdb @@ -0,0 +1,97 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub inargs { + @inargs = ( + { name => 'floating_sel', type => 'layer', + desc => 'The floating selection' } + ); +} + +sub invoke { + my @subname = split /::/, (caller 1)[3]; + my $cmd = pop @subname; + %invoke = ( + headers => [ qw("layer.h" "floating_sel.h") ], + code => < [@procs]); + +$desc = 'Floating selections'; + +1; diff --git a/tools/pdbgen/pdb/gdisplay.pdb b/tools/pdbgen/pdb/gdisplay.pdb new file mode 100644 index 0000000000..43928e2a42 --- /dev/null +++ b/tools/pdbgen/pdb/gdisplay.pdb @@ -0,0 +1,99 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# The defs + +sub display_new { + $blurb = 'Create a new display for the specified image.'; + + $help = <<'HELP'; +Creates a new display for the specified image. If the image already has a +display, another is added. Multiple displays are handled transparently by the +GIMP. The newly created display is returned and can be subsequently destroyed +with a call to 'gimp-display-delete'. This procedure only makes sense for use +with the GIMP UI. +HELP + + &std_pdb_misc; + + @inargs = ( &std_image_arg ); + + @outargs = ( + { name => 'display', type => 'display', + desc => 'The new display' } + ); + + %invoke = ( + headers => [ qw("gdisplay.h") ], + vars => [ 'guint scale = 0x101' ], + code => <<'CODE' +{ + if (gimage->layers == NULL) + success = FALSE; + else + success = ((display = gdisplay_new (gimage, scale)) != NULL); +} +CODE + ); +} + +sub display_delete { + $blurb = 'Delete the specified display'; + + $help = <<'HELP'; +This procedure removes the specified display. If this is the last remaining +display for the underlying image, then the image is deleted also. +HELP + + &std_pdb_misc; + + @inargs = ( + { name => 'display', type => 'display', + desc => 'The display to delete' } + ); + + %invoke = ( + headers => [ qw("gdisplay.h") ], + code => 'gtk_widget_destroy (display->shell);' + ); +} + +sub displays_flush { + $blurb = 'Flush all internal changes to the user interface'; + + $help = <<'HELP'; +This procedure takes no arguments and returns nothing except a success status. +Its purpose is to flush all pending updates of image manipulations to the user +interface. It should be called whenever appropriate. +HELP + + &std_pdb_misc; + + %invoke = ( + headers => [ qw("gdisplay.h") ], + code => 'gdisplays_flush ();' + ); +} + +@procs = qw(display_new display_delete displays_flush); +%exports = (app => [@procs], lib => [@procs]); + +$desc = 'GDisplay procedures'; + +1; diff --git a/tools/pdbgen/pdb/gradients.pdb-23829 b/tools/pdbgen/pdb/gradients.pdb-23829 new file mode 100644 index 0000000000..d6af7d548c --- /dev/null +++ b/tools/pdbgen/pdb/gradients.pdb-23829 @@ -0,0 +1,272 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub pdb_misc { + $author = 'Federico Mena Quintero'; + $copyright = $author; + $date = '1997'; +} + +sub gradients_get_list { + $blurb = 'Retrieve the list of loaded gradients.'; + + $help = <<'HELP'; +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. +HELP + + &pdb_misc; + + @outargs = ( + { name => 'num_gradients', type => 'int32', + desc => 'The number of loaded gradients' }, + { name => 'gradient_names', type => 'stringarray', + desc => 'The list of gradient names', alias => 'gradients', + retval => 1, num_elements => '*num_gradients' } + ); + + %invoke = ( + headers => [ qw("gradient.h") ], + vars => ['gradient_t *grad', 'GSList *list', 'int i = 0'], + code => <<'CODE' +{ + gradients = g_new (char *, num_gradients); + + success = ((list = gradients_list) != NULL); + while (list) + { + grad = list->data; + gradients[i++] = g_strdup (grad->name); + list = list->next; + } +} +CODE + ); +} + +sub gradients_get_active { + $blurb = 'Retrieve the name of the active gradient.'; + + $help = <<'HELP'; +This procedure returns the name of the active gradient in the gradient editor. +HELP + + &pdb_misc; + + @outargs = ( + { + name => 'name', + type => 'string', + desc => 'The name of the active gradient', + alias => 'g_strdup (curr_gradient->name)', no_declare => 1 + } + ); + + %invoke = ( + headers => [ qw("gradient.h") ], + code => 'success = (curr_gradient != NULL);' + ); +} + +sub gradients_set_active { + $blurb = 'Sets the specified gradient as the active gradient.'; + + $help = <<'HELP'; +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. +HELP + + &pdb_misc; + + @inargs = ( + { name => 'name', type => 'string', + desc => 'The name of the gradient to set' } + ); + + %invoke = ( + headers => [ qw("gradient.h") ], + vars => ['gradient_t *grad', 'GSList *list'], + code => <<'CODE' +{ + success = (name != NULL); + + if (success) + { + success = FALSE; + list = gradients_list; + while (list) + { + grad = list->data; + + if (strcmp (grad->name, name) == 0) + { + success = TRUE; + + /* FIXME: violates functionality-GUI separation */ + if (grad->list_item != NULL) + /* Select that gradient in the listbox */ + gtk_list_select_child (GTK_LIST (g_editor->list), + grad->list_item); + else + /* Just update the current gradient */ + curr_gradient = grad; + + break; + } + + list = list->next; + } + } +} +CODE + ); +} + +sub sample_num_arg { + { name => 'num_samples', type => 'int32', + desc => 'The number of samples to take', alias => 'i' } +} + +sub sample_outargs { + @outargs = ( + { name => 'array_length', type => 'int32', + desc => 'Length of the color_samples array (4 * num_samples)' }, + { name => 'color_samples', type => 'floatarray', + desc => 'Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }', + retval => 1, num_elements => '*array_length' } + ); +} + +sub gradients_sample_uniform { + $blurb = 'Sample the active gradient in uniform parts.'; + + $help = <<'HELP'; +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 }. +HELP + + &pdb_misc; + + @inargs = ( &sample_num_arg ); + &sample_outargs; + + %invoke = ( + headers => [ qw("gradient.h") ], + vars => ['gdouble pos, delta', 'gdouble r, g, b, a', 'gdouble *pv'], + code => <<'CODE' +{ + if (i >= 2) + { + pos = 0.0; + delta = 1.0 / (i - 1); + + array_length = i * 4; + + pv = color_samples = g_new (gdouble, array_length); + + while (i--) + { + grad_get_color_at(pos, &r, &g, &b, &a); + + *pv++ = r; + *pv++ = g; + *pv++ = b; + *pv++ = a; + + pos += delta; + } + } + else + success = FALSE; +} +CODE + ); +} + +sub gradients_sample_custom { + $blurb = 'Sample the active gradient in custom positions.'; + + $help = <<'HELP'; +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. +HELP + + &pdb_misc; + + @inargs = ( + &sample_num_arg, + { + name => 'positions', + type => 'floatarray', + desc => 'The list of positions to sample along the gradient', + alias => 'pos' + } + ); + + &sample_outargs; + + %invoke = ( + headers => [ qw("gradient.h") ], + vars => ['gdouble r, g, b, a', 'gdouble *pv'], + code => <<'CODE' +{ + if (i >= 2) + { + array_length = i * 4; + + pv = color_samples = g_new (gdouble, array_length); + + while (i--) + { + grad_get_color_at(*pos, &r, &g, &b, &a); + + *pv++ = r; + *pv++ = g; + *pv++ = b; + *pv++ = a; + + pos++; + } + } + else + success = FALSE; +} +CODE + ); +} + +@procs = qw(gradients_get_list gradients_get_active gradients_set_active + gradients_sample_uniform gradients_sample_custom); +%exports = (app => [@procs], lib => [@procs]); + +$desc = 'Gradients'; + +1; diff --git a/tools/pdbgen/pdb/misc_tools.pdb b/tools/pdbgen/pdb/misc_tools.pdb new file mode 100644 index 0000000000..d1f9a067c8 --- /dev/null +++ b/tools/pdbgen/pdb/misc_tools.pdb @@ -0,0 +1,280 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# Tools + +# shortcuts + +sub tool_init_args { + (image => ['image', 'The image'], + drawable => ['drawable', 'The affected drawable']); +} + +sub sample_merged_arg { + (sample_merged => ['boolean', 'Use the composite image, not the drawable']); +} + +sub antialias_arg { + (antialias => ['boolean', 'Antialiasing $desc']); +} + +sub feather_select_args { + (feather => ['boolean', 'Feather option for selections'], + feather_radius => ['float', 'Radius for feather operation']); +} + +sub stroke_args { + (num_strokes => ['0 < int32', + 'number of stroke control points (count each coordinate as + 2 points)'], + strokes => ['floatarray', + 'array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., + sn.x, sn.y }']); +} + +# The defs + +sub airbrush { + $blurb = <<'BLURB'; +Paint in the current brush with varying pressure. Paint application is +time-dependent. +BLURB + + $help = <<'HELP'; +This tool simulates the use of an airbrush. Paint pressure represents the +relative intensity of the paint application. High pressure results in a thicker +layer of paint while low pressure results in a thinner layer. +HELP; + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + pressure => ['0 <= float <= 100', + 'The pressure of the airbrush strokes $desc'], + &stroke_args + ); + + @invoke = ( + 'airbrush.h', + 'airbrush_non_gui (drawable, pressure, num_strokes, strokes);' + ); +} + +sub blend { + $blurb = <<'BLURB'; +Blend between the starting and ending coordinates with the specified blend mode +and gradient type. +BLURB + + $help = <<'HELP'; +This tool requires information on the paint application mode, the blend mode, +and the gradient type. It creates the specified variety of blend using the +starting and ending coordinates as defined for each gradient type. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + blend_mode => ['enum BlendMode', + 'The type of blend: $desc'], + gradient_type => ['enum PaintMode', + 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final blend $desc'], + offset => ['0 <= float', + 'Offset relates to the starting and ending coordinates + specified for the blend. This parameter is mode dependent + $desc'], + repeat => ['enum RepeatMode', 'Repeat mode: $desc'], + supersample => ['boolean', 'Do adaptive supersampling $desc'], + max_depth => ['1 <= int32 <= 9', + 'Maximum recursion levels for supersampling', + 'attach supersample'], + threshold => ['0 <= float <= 4', + 'Supersampling threshold', + 'attach supersample'], + x1 => ['float', 'The x coordinate of this blend's starting point'], + y1 => ['float', 'The y coordinate of this blend's starting point'], + x2 => ['float', 'The x coordinate of this blend's ending point'], + y2 => ['float', 'The y coordinate of this blend's ending point'] + ); + + @invoke = ( + 'blend.h', + 'blend (image, drawable, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, supersample, max_depth, threshold, x1, y1, x2, y2);' + ); +} + +sub bucket_fill { + $blurb = <<'BLURB'; +Fill the area specified either by the current selection if there is one, or by +a seed fill starting at the specified coordinates. +BLURB + + $help = <<'HELP' +This tool requires information on the paint application mode, and the fill +mode, which can either be in the foreground color, or in the currently active +pattern. If there is no selection, a seed fill is executed at the specified +coordinates and extends outward in keeping with the threshold parameter. If +there is a selection in the target image, the threshold, sample merged, x, and +y arguments are unused. If the sample_merged parameter is non-zero, the data of +the composite image will be used instead of that for the specified drawable. +This is equivalent to sampling for colors after merging all visible layers. In +the case of merged sampling, the x,y coordinates are relative to the image's +origin; otherwise, they are relative to the drawable's origin. +HELP; + + &std_pdb_misc; + + my $validity = 'This parameter is only valid when there is no selection in the specified image.' + my $coord = "The \$a coordinate of this bucket fill's application. $validity"; + + %inargs = ( + &tool_init_args, + fill_mode => ['enum FillMode', 'The type of fill: $desc'], + paint_mode => ['enum PaintMode', 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final bucket fill $desc'], + threshold => ['0 <= float <= 255', + "The threshold determines how extensive the seed fill + will be. It's value is specified in terms of intensity + levels \$desc. $validity'], + &sample_merged_arg, + x => ['float', eval qq/{\$a = 'x';"$coord";}/], + y => ['float', eval qq/{\$a = 'y';"$coord";}/] + ); + + @invoke = ( + 'bucket_fill.h', + 'bucket_fill (image, drawable, fill_mode, paint_mode, opacity, threshold, sample_merged, x, y);' + ); +} + +sub by_color_select { + $blurb = <<'BLURB' +Create a selection by selecting all pixels (in the specified drawable) with the +same (or similar) color to that specified. +BLURB + + $help = <<'HELP' +This tool creates a selection over the specified image. A by-color selection is +determined by the supplied color under the constraints of the specified +threshold. Essentially, all pixels (in the drawable) that have color +sufficiently close to the specified color (as determined by the threshold +value) are included in the selection. The antialiasing parameter allows the +final selection mask to contain intermediate values based on close misses to +the threshold bar. Feathering can be enabled optionally and is controlled with +the \"feather_radius\" parameter. If the sample_merged parameter is non-zero, +the data of the composite image will be used instead of that for the specified +drawable. This is equivalent to sampling for colors after merging all visible +layers. In the case of a merged sampling, the supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + color => ['color', 'The color to select'], + threshold => ['0 <= int32 <= 255', + 'Threshold in intensity levels $desc'], + operation => ['enum Operation', 'The selection operation: $desc'], + &antialias_arg, + &feather_select_args, + &sample_merged_arg + ); + + @invoke = ( + 'by_color_select.h', + 'by_color_select (image, drawable, color, threshold, operation, antialias, feather, feather_radius, sample_merged);' + ); +} + +sub clone { + $blurb = <<'BLURB' +Clone from the source to the dest drawable using the current brush +BLURB + + $help = <<'HELP' +This tool clones (copies) from the source drawable starting at the specified +source coordinates to the dest drawable. If the \"clone_type\" argument is set +to PATTERN-CLONE, then the current pattern is used as the source and the +\"src_drawable\" argument is ignored. Pattern cloning assumes a tileable +pattern and mods the sum of the src coordinates and subsequent stroke offsets +with the width and height of the pattern. For image cloning, if the sum of the +src coordinates and subsequent stroke offsets exceeds the extents of the src +drawable, then no paint is transferred. The clone tool is capable of +transforming between any image types including RGB->Indexed--although +converting from any type to indexed is significantly slower. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + src_drawable => ['drawable', "The source drawable"], + clone_type => ['enum CloneType', 'The type of clone: $desc'], + src_x => ['float', 'The x coordinate in the source image'], + src_y => ['float', 'The y coordinate in the source image'], + &stroke_args + ); + + @invoke = ( + 'clone.h', + 'clone_non_gui (drawable, src_drawable, clone_type, src_x, src_y, num_strokes, strokes);' + ); +} + +sub color_picker { + $blurb = <<'BLURB'; +Determine the color at the given drawable coordinates +BLURB + + $help = <<'HELP'; +This tool determines the color at the specified coordinates. The returned color +is an RGB triplet even for grayscale and indexed drawables. If the coordinates +lie outside of the extents of the specified drawable, then an error is +returned. If the drawable has an alpha channel, the algorithm examines the +alpha value of the drawable at the coordinates. If the alpha value is +completely transparent (0), then an error is returned. If the sample_merged +parameter is non-zero, the data of the composite image will be used instead of +that for the specified drawable. This is equivalent to sampling for colors +after merging all visible layers. In the case of a merged sampling, the +supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + x => ['float', 'x coordinate of upper-left corner of rectangle'], + y => ['float', 'y coordinate of upper-left corner of rectangle'], + &sample_merged_arg, + save_color => ['boolean', 'Save the color to the active palette'] + ); + + %outargs = ( + color => ['color', 'The return color'] + ); + + %invoke = ( + 'color_picker.h', + ' +} diff --git a/tools/pdbgen/pdb/paint_tools.pdb b/tools/pdbgen/pdb/paint_tools.pdb new file mode 100644 index 0000000000..d1f9a067c8 --- /dev/null +++ b/tools/pdbgen/pdb/paint_tools.pdb @@ -0,0 +1,280 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# Tools + +# shortcuts + +sub tool_init_args { + (image => ['image', 'The image'], + drawable => ['drawable', 'The affected drawable']); +} + +sub sample_merged_arg { + (sample_merged => ['boolean', 'Use the composite image, not the drawable']); +} + +sub antialias_arg { + (antialias => ['boolean', 'Antialiasing $desc']); +} + +sub feather_select_args { + (feather => ['boolean', 'Feather option for selections'], + feather_radius => ['float', 'Radius for feather operation']); +} + +sub stroke_args { + (num_strokes => ['0 < int32', + 'number of stroke control points (count each coordinate as + 2 points)'], + strokes => ['floatarray', + 'array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., + sn.x, sn.y }']); +} + +# The defs + +sub airbrush { + $blurb = <<'BLURB'; +Paint in the current brush with varying pressure. Paint application is +time-dependent. +BLURB + + $help = <<'HELP'; +This tool simulates the use of an airbrush. Paint pressure represents the +relative intensity of the paint application. High pressure results in a thicker +layer of paint while low pressure results in a thinner layer. +HELP; + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + pressure => ['0 <= float <= 100', + 'The pressure of the airbrush strokes $desc'], + &stroke_args + ); + + @invoke = ( + 'airbrush.h', + 'airbrush_non_gui (drawable, pressure, num_strokes, strokes);' + ); +} + +sub blend { + $blurb = <<'BLURB'; +Blend between the starting and ending coordinates with the specified blend mode +and gradient type. +BLURB + + $help = <<'HELP'; +This tool requires information on the paint application mode, the blend mode, +and the gradient type. It creates the specified variety of blend using the +starting and ending coordinates as defined for each gradient type. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + blend_mode => ['enum BlendMode', + 'The type of blend: $desc'], + gradient_type => ['enum PaintMode', + 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final blend $desc'], + offset => ['0 <= float', + 'Offset relates to the starting and ending coordinates + specified for the blend. This parameter is mode dependent + $desc'], + repeat => ['enum RepeatMode', 'Repeat mode: $desc'], + supersample => ['boolean', 'Do adaptive supersampling $desc'], + max_depth => ['1 <= int32 <= 9', + 'Maximum recursion levels for supersampling', + 'attach supersample'], + threshold => ['0 <= float <= 4', + 'Supersampling threshold', + 'attach supersample'], + x1 => ['float', 'The x coordinate of this blend's starting point'], + y1 => ['float', 'The y coordinate of this blend's starting point'], + x2 => ['float', 'The x coordinate of this blend's ending point'], + y2 => ['float', 'The y coordinate of this blend's ending point'] + ); + + @invoke = ( + 'blend.h', + 'blend (image, drawable, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, supersample, max_depth, threshold, x1, y1, x2, y2);' + ); +} + +sub bucket_fill { + $blurb = <<'BLURB'; +Fill the area specified either by the current selection if there is one, or by +a seed fill starting at the specified coordinates. +BLURB + + $help = <<'HELP' +This tool requires information on the paint application mode, and the fill +mode, which can either be in the foreground color, or in the currently active +pattern. If there is no selection, a seed fill is executed at the specified +coordinates and extends outward in keeping with the threshold parameter. If +there is a selection in the target image, the threshold, sample merged, x, and +y arguments are unused. If the sample_merged parameter is non-zero, the data of +the composite image will be used instead of that for the specified drawable. +This is equivalent to sampling for colors after merging all visible layers. In +the case of merged sampling, the x,y coordinates are relative to the image's +origin; otherwise, they are relative to the drawable's origin. +HELP; + + &std_pdb_misc; + + my $validity = 'This parameter is only valid when there is no selection in the specified image.' + my $coord = "The \$a coordinate of this bucket fill's application. $validity"; + + %inargs = ( + &tool_init_args, + fill_mode => ['enum FillMode', 'The type of fill: $desc'], + paint_mode => ['enum PaintMode', 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final bucket fill $desc'], + threshold => ['0 <= float <= 255', + "The threshold determines how extensive the seed fill + will be. It's value is specified in terms of intensity + levels \$desc. $validity'], + &sample_merged_arg, + x => ['float', eval qq/{\$a = 'x';"$coord";}/], + y => ['float', eval qq/{\$a = 'y';"$coord";}/] + ); + + @invoke = ( + 'bucket_fill.h', + 'bucket_fill (image, drawable, fill_mode, paint_mode, opacity, threshold, sample_merged, x, y);' + ); +} + +sub by_color_select { + $blurb = <<'BLURB' +Create a selection by selecting all pixels (in the specified drawable) with the +same (or similar) color to that specified. +BLURB + + $help = <<'HELP' +This tool creates a selection over the specified image. A by-color selection is +determined by the supplied color under the constraints of the specified +threshold. Essentially, all pixels (in the drawable) that have color +sufficiently close to the specified color (as determined by the threshold +value) are included in the selection. The antialiasing parameter allows the +final selection mask to contain intermediate values based on close misses to +the threshold bar. Feathering can be enabled optionally and is controlled with +the \"feather_radius\" parameter. If the sample_merged parameter is non-zero, +the data of the composite image will be used instead of that for the specified +drawable. This is equivalent to sampling for colors after merging all visible +layers. In the case of a merged sampling, the supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + color => ['color', 'The color to select'], + threshold => ['0 <= int32 <= 255', + 'Threshold in intensity levels $desc'], + operation => ['enum Operation', 'The selection operation: $desc'], + &antialias_arg, + &feather_select_args, + &sample_merged_arg + ); + + @invoke = ( + 'by_color_select.h', + 'by_color_select (image, drawable, color, threshold, operation, antialias, feather, feather_radius, sample_merged);' + ); +} + +sub clone { + $blurb = <<'BLURB' +Clone from the source to the dest drawable using the current brush +BLURB + + $help = <<'HELP' +This tool clones (copies) from the source drawable starting at the specified +source coordinates to the dest drawable. If the \"clone_type\" argument is set +to PATTERN-CLONE, then the current pattern is used as the source and the +\"src_drawable\" argument is ignored. Pattern cloning assumes a tileable +pattern and mods the sum of the src coordinates and subsequent stroke offsets +with the width and height of the pattern. For image cloning, if the sum of the +src coordinates and subsequent stroke offsets exceeds the extents of the src +drawable, then no paint is transferred. The clone tool is capable of +transforming between any image types including RGB->Indexed--although +converting from any type to indexed is significantly slower. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + src_drawable => ['drawable', "The source drawable"], + clone_type => ['enum CloneType', 'The type of clone: $desc'], + src_x => ['float', 'The x coordinate in the source image'], + src_y => ['float', 'The y coordinate in the source image'], + &stroke_args + ); + + @invoke = ( + 'clone.h', + 'clone_non_gui (drawable, src_drawable, clone_type, src_x, src_y, num_strokes, strokes);' + ); +} + +sub color_picker { + $blurb = <<'BLURB'; +Determine the color at the given drawable coordinates +BLURB + + $help = <<'HELP'; +This tool determines the color at the specified coordinates. The returned color +is an RGB triplet even for grayscale and indexed drawables. If the coordinates +lie outside of the extents of the specified drawable, then an error is +returned. If the drawable has an alpha channel, the algorithm examines the +alpha value of the drawable at the coordinates. If the alpha value is +completely transparent (0), then an error is returned. If the sample_merged +parameter is non-zero, the data of the composite image will be used instead of +that for the specified drawable. This is equivalent to sampling for colors +after merging all visible layers. In the case of a merged sampling, the +supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + x => ['float', 'x coordinate of upper-left corner of rectangle'], + y => ['float', 'y coordinate of upper-left corner of rectangle'], + &sample_merged_arg, + save_color => ['boolean', 'Save the color to the active palette'] + ); + + %outargs = ( + color => ['color', 'The return color'] + ); + + %invoke = ( + 'color_picker.h', + ' +} diff --git a/tools/pdbgen/pdb/palette.pdb b/tools/pdbgen/pdb/palette.pdb new file mode 100644 index 0000000000..3b755ec05e --- /dev/null +++ b/tools/pdbgen/pdb/palette.pdb @@ -0,0 +1,188 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub color_blurb { + $blurb = "@{[shift]} the current GIMP @{[shift]}ground color."; +} + +sub color_arg { + my $ground = (shift) . "ground"; + { + name => $ground, + type => 'color', + desc => "The $ground color", + alias => 'col' + } +} + +sub invoke_get { + %invoke = ( + headers => [ qw("gimpimage.h" "palette.h") ], + vars => ['guchar r, g, b'], + code => < [ qw("gimpimage.h" "palette.h") ], + code => < [ qw("palette.h") ], + code => 'palette_set_default_colors ();' + ); +} + +sub palette_swap_colors { + $blurb = 'Swap the current GIMP foreground and background colors.'; + + $help = <<'HELP'; +This procedure swaps the current GIMP foreground and background colors, so that +the new foreground color becomes the old background color and vice versa. +HELP + + &std_pdb_misc; + + %invoke = ( + headers => [ qw("palette.h") ], + code => 'palette_swap_colors ();' + ); +} + +sub palette_refresh { + $blurb = 'Refreshes current palettes.'; + + $help = <<'HELP'; +This procedure incorporates all palettes currently in the users palette path. +HELP + + $author = 'Adrian Likins '; + $copyright = 'Adrian Likins'; + $date = '1998'; + + %invoke = ( + headers => [ qw("palette.h") ], + code => <<'CODE' +{ + /* FIXME: I've hardcoded success to be TRUE, because brushes_init() is a + * void function right now. It'd be nice if it returned a value at + * some future date, so we could tell if things blew up when reparsing + * the list (for whatever reason). + * - Seth "Yes, this is a kludge" Burgess + * + * -and shamelessly stolen by Adrian Likins for use here... + */ + + palette_free_palettes (); + palette_init_palettes (FALSE); +} +CODE + ); +} + +@procs = qw(palette_get_foreground palette_get_background + palette_set_foreground palette_set_background + palette_set_default_colors palette_swap_colors + palette_refresh); +%exports = (app => [@procs], lib => [@procs]); + +$desc = 'Palette'; + +1; diff --git a/tools/pdbgen/pdb/procedural_db.pdb b/tools/pdbgen/pdb/procedural_db.pdb new file mode 100644 index 0000000000..0b2487bf72 --- /dev/null +++ b/tools/pdbgen/pdb/procedural_db.pdb @@ -0,0 +1,456 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub proc_name_arg { + { name => 'procedure', type => 'string', + desc => 'The procedure name', alias => 'proc_name' }, +} + +sub regex_arg { + my $type = shift; + { name => $type, type => 'string', + desc => "The regex for procedure $type" } +} + +sub data_ident_arg { + { name => 'identifier', type => 'string', + desc => 'The identifier associated with data' } +} + +sub data_bytes_arg { + { name => 'bytes', type => 'int32', + desc => 'The number of bytes in the data' } +} + +sub data_arg { + { name => 'data', type => 'int8array', + desc => 'A byte array containing data' } +} + +sub arg_info_proc { + my $type = shift; my $long_type = shift; my $real_type = shift; + + $blurb = < "$type_num", type => 'int32', + desc => "The $long_type number" } + ); + + @outargs = ( + { name => "${type}_type", type => 'enum PDBArgType', + desc => "The type of $long_type \$desc", + alias => "${type}->arg_type" }, + { name => "${type}_name", type => 'string', + desc => "The name of the $long_type", + alias => "${type}->name" }, + { name => "${type}_desc", type => 'string', + desc => "A description of the $long_type", + alias => "${type}->description" } + ); + + %invoke = ( + headers => [ qw("procedural_db.h") ], + vars => [ 'ProcRecord *proc;' ], + code => <= 0 && ${type}_num < proc->num_$real_type)) + $type = \&proc->${real_type}[${type}_num]; + else + success = FALSE; +} +CODE + ); +} + +# The defs + +sub procedural_db_query { + $alias{lib} = 'query_database'; + + $blurb = <<'BLURB'; +Queries the procedural database for its contents using regular expression +matching. +BLURB + + $help = <<'HELP'; +This procedure queries the contents of the procedural database. It is supplied +with seven arguments matching procedures on { name, blurb, help, author, +copyright, date, procedure type}. This is accomplished using regular expression +matching. For instance, to find all procedures with "jpeg" listed in the blurb, +all seven arguments can be supplied as ".*", except for the second, which can +be supplied as ".*jpeg.*". There are two return arguments for this procedure. +The first is the number of procedures matching the query. The second is a +concatenated list of procedure names corresponding to those matching the query. +If no matching entries are found, then the returned string is NULL and the +number of entries is 0. +HELP + + &std_pdb_misc; + + @inargs = ( + ®ex_arg('name'), + ®ex_arg('blurb'), + ®ex_arg('help'), + ®ex_arg('author'), + ®ex_arg('copyright'), + ®ex_arg('date'), + ®ex_arg('proc_type') + ); + $inargs[$#inargs]->{desc} =~ + s + ; + + @outargs = ( + { + name => 'num_matches', + type => 'int32', + desc => 'The number of matching procedures', + alias => 'pdb_query.num_procs' + }, + { + name => 'procedure_names', + type => 'stringarray', + desc => 'The list of procedure names' + alias => 'pdb_query.list_or_procs' + } + ); + + my($regcomp, $free, $once); + foreach (@inargs) { + $regcomp .= ' ' x 2 if $once; + $regcomp .= "regcomp (&pdb_query.${_}_regex, $_, 0);\n"; + + $free .= ' ' x 2 if $once++; + $free .= "free (pdb_query.${_}_regex.buffer);\n"; + } + + %invoke = ( + headers => [ qw("procedural_db.h" "regex.h") ], + vars => [ 'PDBQuery pdb_query' ], + code => < 'blurb', type => 'string', + desc => 'A short blurb' }, + { name => 'help', type => 'string', + desc => 'Detailed procedure help' }, + { name => 'author', type => 'string', + desc => 'Author(s) of the procedure' }, + { name => 'copyright', type => 'string', + desc => 'The copyright' }, + { name => 'date', type => 'string', + desc => 'Copyright date' }, + { name => 'proc_type', type => 'enum PDBProcType', + desc => 'The procedure type: $desc' }, + { name => 'num_args', type => 'int32', + desc => 'The number of input arguments' }, + { name => 'num_values', type => 'int32', + desc => 'The number of return values' } + ); + + foreach (@outargs) { $_->{alias} = "proc->$_->{name}" } + + %invoke = ( + headers => [ qw("procedural_db.h") ], + code => <<'CODE' +success = ((proc = procedural_db_lookup (proc_name)) != NULL); +CODE + ); +} + +sub procedural_db_proc_arg { + &arg_info_proc('arg', 'argument', 'args'); +} + +sub procedural_db_proc_val { + &arg_info_proc('val', 'return value', 'values'); +} + +sub procedural_db_get_data { + $alias{lib} = 'get_data'; + + $blurb = 'Returns data associated with the specified identifier.'; + + $help = <<'HELP'; +This procedure returns any data which may have been associated with the +specified identifier. The data is a variable length array of bytes. If no data +has been associated with the identifier, an error is returned. +HELP + + &std_pdb_misc; + $date = '1997'; + + @inargs = ( &data_ident_arg ); + + @outargs = ( &data_bytes_arg, &data_arg ); + $outargs[0]->{alias} = 'data->bytes'; + $outargs[1]->{alias} = 'data_copy'; + + @globals = ('static GList *data_list = NULL'); + + %invoke = ( + headers => [ qw("procedural.db.h" ], + vars => ['PDBData *data', 'char *data_copy', 'GList *list'], + code => <<'CODE' +{ + success = FALSE; + + list = data_list; + while (list) + { + data = (PDBData *) list->data; + list = list->next; + + if (strcmp (data->identifier, identifier) == 0) + { + data_copy = g_new (char, data->bytes); + memcpy (data_copy, data->data, data->bytes); + + success = TRUE; + break; + } + } +} +CODE + ); +} + +sub procedural_db_get_data_size { + $alias{lib} = 'get_data_size'; + + $blurb = 'Returns size of data associated with the specified identifier.'; + + $help = <<'HELP'; +This procedure returns the size of any data which may have been associated with +the specified identifier. If no data has been associated with the identifier, +an error is returned. +HELP + + $author = 'Nick Lamb'; + $copyright = $author; + $date = '1998'; + + @inargs = ( &data_ident_arg ); + + @outargs = ( &data_bytes_arg ); + $outargs[0]->{alias} = 'data->bytes'; + + %invoke = ( + headers => [ qw("procedural.db.h" ], + vars => ['PDBData *data', 'GList *list'], + code => <<'CODE' +{ + success = FALSE; + + list = data_list; + while (list) + { + data = (PDBData *) list->data; + list = list->next; + + if (strcmp (data->identifier, identifier) == 0) + { + success = TRUE; + break; + } + } +} +CODE + ); +} + +sub procedural_db_set_data { + $alias{lib} = 'set_data'; + + $blurb = 'Associates the specified identifier with the supplied data.'; + + $help = <<'HELP'; +This procedure associates the supplied data with the provided identifier. The +data may be subsequently retrieved by a call to 'procedural-db-get-data'. +HELP + + &std_pdb_misc; + $date = '1997'; + + @inargs = ( &data_ident_arg, &data_bytes_arg, &data_arg ); + $inargs[2]->{alias} = 'data_src'; + + %invoke = ( + headers => [ qw("procedural.db.h" ], + vars => ['PDBData *data = NULL', 'GList *list'], + code => <<'CODE' +{ + list = data_list; + while (list) + { + if (strcmp (((PDBData *) list->data)->identifier, identifier) == 0) + data = (PDBData *) list->data; + + list = list->next; + } + + /* If there isn't already data with the specified identifier, create one */ + if (data == NULL) + { + data = (PDBData *) g_new (PDBData, 1); + data_list = g_list_append (data_list, data); + } + else + g_free (data->data); + + data->identifier = g_strdup (identifier); + data->bytes = bytes; + data->data = g_new (char, data->bytes); + memcpy (data->data, (char *) data_src, data->bytes); +} +CODE + ); +} + +$support{types} = <<'SUPPORT'; +/* Query structure */ +typedef struct _PDBQuery PDBQuery; + +struct _PDBQuery +{ + regex_t name_regex; + regex_t blurb_regex; + regex_t help_regex; + regex_t author_regex; + regex_t copyright_regex; + regex_t date_regex; + regex_t proc_type_regex; + + char ** list_of_procs; + int num_procs; +}; + +typedef struct _PDBData PDBData; + +struct _PDBData +{ + char *identifier; + int bytes; + char *data; +}; +SUPPORT + +$support{code} = <<'SUPPORT'; +static inline int +match_strings (regex_t *preg, + char *a) +{ + return regexec (preg, a, 0, NULL, 0); +} + +static void +procedural_db_query_entry (gpointer key, + gpointer value, + gpointer user_data) +{ + GList *list; + ProcRecord *proc; + PDBQuery *pdb_query; + int new_length; + + list = (GList *) value; + proc = (ProcRecord *) list->data; + pdb_query = (PDBQuery *) user_data; + + if (!match_strings (&pdb_query->name_regex, proc->name) && + !match_strings (&pdb_query->blurb_regex, proc->blurb) && + !match_strings (&pdb_query->help_regex, proc->help) && + !match_strings (&pdb_query->author_regex, proc->author) && + !match_strings (&pdb_query->copyright_regex, proc->copyright) && + !match_strings (&pdb_query->date_regex, proc->date) && + !match_strings (&pdb_query->proc_type_regex, proc_type_str[(int) proc->pro +c_type])) + { + new_length = (proc->name) ? (strlen (proc->name) + 1) : 0; + + if (new_length) + { + pdb_query->num_procs++; + pdb_query->list_of_procs = g_realloc (pdb_query->list_of_procs, + (sizeof (char **) * pdb_query->nu +m_procs)); + pdb_query->list_of_procs[pdb_query->num_procs - 1] = g_strdup (proc->n +ame); + } + } +} +SUPPORT + +@procs = qw(procedural_db_dump procedural_db_query procedural_db_proc_info + procedural_db_proc_arg procedural_db_proc_val + procedural_db_get_data procedural_db_get_data_size + procedural_db_set_data) +%exports = (app => [@procs], lib => [@procs[5..7], @procs[1..2]]); + +$desc = 'Procedural database'; + +1; diff --git a/tools/pdbgen/pdb/tools.pdb b/tools/pdbgen/pdb/tools.pdb new file mode 100644 index 0000000000..d1f9a067c8 --- /dev/null +++ b/tools/pdbgen/pdb/tools.pdb @@ -0,0 +1,280 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# Tools + +# shortcuts + +sub tool_init_args { + (image => ['image', 'The image'], + drawable => ['drawable', 'The affected drawable']); +} + +sub sample_merged_arg { + (sample_merged => ['boolean', 'Use the composite image, not the drawable']); +} + +sub antialias_arg { + (antialias => ['boolean', 'Antialiasing $desc']); +} + +sub feather_select_args { + (feather => ['boolean', 'Feather option for selections'], + feather_radius => ['float', 'Radius for feather operation']); +} + +sub stroke_args { + (num_strokes => ['0 < int32', + 'number of stroke control points (count each coordinate as + 2 points)'], + strokes => ['floatarray', + 'array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., + sn.x, sn.y }']); +} + +# The defs + +sub airbrush { + $blurb = <<'BLURB'; +Paint in the current brush with varying pressure. Paint application is +time-dependent. +BLURB + + $help = <<'HELP'; +This tool simulates the use of an airbrush. Paint pressure represents the +relative intensity of the paint application. High pressure results in a thicker +layer of paint while low pressure results in a thinner layer. +HELP; + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + pressure => ['0 <= float <= 100', + 'The pressure of the airbrush strokes $desc'], + &stroke_args + ); + + @invoke = ( + 'airbrush.h', + 'airbrush_non_gui (drawable, pressure, num_strokes, strokes);' + ); +} + +sub blend { + $blurb = <<'BLURB'; +Blend between the starting and ending coordinates with the specified blend mode +and gradient type. +BLURB + + $help = <<'HELP'; +This tool requires information on the paint application mode, the blend mode, +and the gradient type. It creates the specified variety of blend using the +starting and ending coordinates as defined for each gradient type. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + blend_mode => ['enum BlendMode', + 'The type of blend: $desc'], + gradient_type => ['enum PaintMode', + 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final blend $desc'], + offset => ['0 <= float', + 'Offset relates to the starting and ending coordinates + specified for the blend. This parameter is mode dependent + $desc'], + repeat => ['enum RepeatMode', 'Repeat mode: $desc'], + supersample => ['boolean', 'Do adaptive supersampling $desc'], + max_depth => ['1 <= int32 <= 9', + 'Maximum recursion levels for supersampling', + 'attach supersample'], + threshold => ['0 <= float <= 4', + 'Supersampling threshold', + 'attach supersample'], + x1 => ['float', 'The x coordinate of this blend's starting point'], + y1 => ['float', 'The y coordinate of this blend's starting point'], + x2 => ['float', 'The x coordinate of this blend's ending point'], + y2 => ['float', 'The y coordinate of this blend's ending point'] + ); + + @invoke = ( + 'blend.h', + 'blend (image, drawable, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, supersample, max_depth, threshold, x1, y1, x2, y2);' + ); +} + +sub bucket_fill { + $blurb = <<'BLURB'; +Fill the area specified either by the current selection if there is one, or by +a seed fill starting at the specified coordinates. +BLURB + + $help = <<'HELP' +This tool requires information on the paint application mode, and the fill +mode, which can either be in the foreground color, or in the currently active +pattern. If there is no selection, a seed fill is executed at the specified +coordinates and extends outward in keeping with the threshold parameter. If +there is a selection in the target image, the threshold, sample merged, x, and +y arguments are unused. If the sample_merged parameter is non-zero, the data of +the composite image will be used instead of that for the specified drawable. +This is equivalent to sampling for colors after merging all visible layers. In +the case of merged sampling, the x,y coordinates are relative to the image's +origin; otherwise, they are relative to the drawable's origin. +HELP; + + &std_pdb_misc; + + my $validity = 'This parameter is only valid when there is no selection in the specified image.' + my $coord = "The \$a coordinate of this bucket fill's application. $validity"; + + %inargs = ( + &tool_init_args, + fill_mode => ['enum FillMode', 'The type of fill: $desc'], + paint_mode => ['enum PaintMode', 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final bucket fill $desc'], + threshold => ['0 <= float <= 255', + "The threshold determines how extensive the seed fill + will be. It's value is specified in terms of intensity + levels \$desc. $validity'], + &sample_merged_arg, + x => ['float', eval qq/{\$a = 'x';"$coord";}/], + y => ['float', eval qq/{\$a = 'y';"$coord";}/] + ); + + @invoke = ( + 'bucket_fill.h', + 'bucket_fill (image, drawable, fill_mode, paint_mode, opacity, threshold, sample_merged, x, y);' + ); +} + +sub by_color_select { + $blurb = <<'BLURB' +Create a selection by selecting all pixels (in the specified drawable) with the +same (or similar) color to that specified. +BLURB + + $help = <<'HELP' +This tool creates a selection over the specified image. A by-color selection is +determined by the supplied color under the constraints of the specified +threshold. Essentially, all pixels (in the drawable) that have color +sufficiently close to the specified color (as determined by the threshold +value) are included in the selection. The antialiasing parameter allows the +final selection mask to contain intermediate values based on close misses to +the threshold bar. Feathering can be enabled optionally and is controlled with +the \"feather_radius\" parameter. If the sample_merged parameter is non-zero, +the data of the composite image will be used instead of that for the specified +drawable. This is equivalent to sampling for colors after merging all visible +layers. In the case of a merged sampling, the supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + color => ['color', 'The color to select'], + threshold => ['0 <= int32 <= 255', + 'Threshold in intensity levels $desc'], + operation => ['enum Operation', 'The selection operation: $desc'], + &antialias_arg, + &feather_select_args, + &sample_merged_arg + ); + + @invoke = ( + 'by_color_select.h', + 'by_color_select (image, drawable, color, threshold, operation, antialias, feather, feather_radius, sample_merged);' + ); +} + +sub clone { + $blurb = <<'BLURB' +Clone from the source to the dest drawable using the current brush +BLURB + + $help = <<'HELP' +This tool clones (copies) from the source drawable starting at the specified +source coordinates to the dest drawable. If the \"clone_type\" argument is set +to PATTERN-CLONE, then the current pattern is used as the source and the +\"src_drawable\" argument is ignored. Pattern cloning assumes a tileable +pattern and mods the sum of the src coordinates and subsequent stroke offsets +with the width and height of the pattern. For image cloning, if the sum of the +src coordinates and subsequent stroke offsets exceeds the extents of the src +drawable, then no paint is transferred. The clone tool is capable of +transforming between any image types including RGB->Indexed--although +converting from any type to indexed is significantly slower. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + src_drawable => ['drawable', "The source drawable"], + clone_type => ['enum CloneType', 'The type of clone: $desc'], + src_x => ['float', 'The x coordinate in the source image'], + src_y => ['float', 'The y coordinate in the source image'], + &stroke_args + ); + + @invoke = ( + 'clone.h', + 'clone_non_gui (drawable, src_drawable, clone_type, src_x, src_y, num_strokes, strokes);' + ); +} + +sub color_picker { + $blurb = <<'BLURB'; +Determine the color at the given drawable coordinates +BLURB + + $help = <<'HELP'; +This tool determines the color at the specified coordinates. The returned color +is an RGB triplet even for grayscale and indexed drawables. If the coordinates +lie outside of the extents of the specified drawable, then an error is +returned. If the drawable has an alpha channel, the algorithm examines the +alpha value of the drawable at the coordinates. If the alpha value is +completely transparent (0), then an error is returned. If the sample_merged +parameter is non-zero, the data of the composite image will be used instead of +that for the specified drawable. This is equivalent to sampling for colors +after merging all visible layers. In the case of a merged sampling, the +supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + x => ['float', 'x coordinate of upper-left corner of rectangle'], + y => ['float', 'y coordinate of upper-left corner of rectangle'], + &sample_merged_arg, + save_color => ['boolean', 'Save the color to the active palette'] + ); + + %outargs = ( + color => ['color', 'The return color'] + ); + + %invoke = ( + 'color_picker.h', + ' +} diff --git a/tools/pdbgen/pdb/transform_tools.pdb b/tools/pdbgen/pdb/transform_tools.pdb new file mode 100644 index 0000000000..d1f9a067c8 --- /dev/null +++ b/tools/pdbgen/pdb/transform_tools.pdb @@ -0,0 +1,280 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +# Tools + +# shortcuts + +sub tool_init_args { + (image => ['image', 'The image'], + drawable => ['drawable', 'The affected drawable']); +} + +sub sample_merged_arg { + (sample_merged => ['boolean', 'Use the composite image, not the drawable']); +} + +sub antialias_arg { + (antialias => ['boolean', 'Antialiasing $desc']); +} + +sub feather_select_args { + (feather => ['boolean', 'Feather option for selections'], + feather_radius => ['float', 'Radius for feather operation']); +} + +sub stroke_args { + (num_strokes => ['0 < int32', + 'number of stroke control points (count each coordinate as + 2 points)'], + strokes => ['floatarray', + 'array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., + sn.x, sn.y }']); +} + +# The defs + +sub airbrush { + $blurb = <<'BLURB'; +Paint in the current brush with varying pressure. Paint application is +time-dependent. +BLURB + + $help = <<'HELP'; +This tool simulates the use of an airbrush. Paint pressure represents the +relative intensity of the paint application. High pressure results in a thicker +layer of paint while low pressure results in a thinner layer. +HELP; + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + pressure => ['0 <= float <= 100', + 'The pressure of the airbrush strokes $desc'], + &stroke_args + ); + + @invoke = ( + 'airbrush.h', + 'airbrush_non_gui (drawable, pressure, num_strokes, strokes);' + ); +} + +sub blend { + $blurb = <<'BLURB'; +Blend between the starting and ending coordinates with the specified blend mode +and gradient type. +BLURB + + $help = <<'HELP'; +This tool requires information on the paint application mode, the blend mode, +and the gradient type. It creates the specified variety of blend using the +starting and ending coordinates as defined for each gradient type. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + blend_mode => ['enum BlendMode', + 'The type of blend: $desc'], + gradient_type => ['enum PaintMode', + 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final blend $desc'], + offset => ['0 <= float', + 'Offset relates to the starting and ending coordinates + specified for the blend. This parameter is mode dependent + $desc'], + repeat => ['enum RepeatMode', 'Repeat mode: $desc'], + supersample => ['boolean', 'Do adaptive supersampling $desc'], + max_depth => ['1 <= int32 <= 9', + 'Maximum recursion levels for supersampling', + 'attach supersample'], + threshold => ['0 <= float <= 4', + 'Supersampling threshold', + 'attach supersample'], + x1 => ['float', 'The x coordinate of this blend's starting point'], + y1 => ['float', 'The y coordinate of this blend's starting point'], + x2 => ['float', 'The x coordinate of this blend's ending point'], + y2 => ['float', 'The y coordinate of this blend's ending point'] + ); + + @invoke = ( + 'blend.h', + 'blend (image, drawable, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, supersample, max_depth, threshold, x1, y1, x2, y2);' + ); +} + +sub bucket_fill { + $blurb = <<'BLURB'; +Fill the area specified either by the current selection if there is one, or by +a seed fill starting at the specified coordinates. +BLURB + + $help = <<'HELP' +This tool requires information on the paint application mode, and the fill +mode, which can either be in the foreground color, or in the currently active +pattern. If there is no selection, a seed fill is executed at the specified +coordinates and extends outward in keeping with the threshold parameter. If +there is a selection in the target image, the threshold, sample merged, x, and +y arguments are unused. If the sample_merged parameter is non-zero, the data of +the composite image will be used instead of that for the specified drawable. +This is equivalent to sampling for colors after merging all visible layers. In +the case of merged sampling, the x,y coordinates are relative to the image's +origin; otherwise, they are relative to the drawable's origin. +HELP; + + &std_pdb_misc; + + my $validity = 'This parameter is only valid when there is no selection in the specified image.' + my $coord = "The \$a coordinate of this bucket fill's application. $validity"; + + %inargs = ( + &tool_init_args, + fill_mode => ['enum FillMode', 'The type of fill: $desc'], + paint_mode => ['enum PaintMode', 'The paint application mode: $desc'], + opacity => ['0 <= float <= 100', + 'The opacity of the final bucket fill $desc'], + threshold => ['0 <= float <= 255', + "The threshold determines how extensive the seed fill + will be. It's value is specified in terms of intensity + levels \$desc. $validity'], + &sample_merged_arg, + x => ['float', eval qq/{\$a = 'x';"$coord";}/], + y => ['float', eval qq/{\$a = 'y';"$coord";}/] + ); + + @invoke = ( + 'bucket_fill.h', + 'bucket_fill (image, drawable, fill_mode, paint_mode, opacity, threshold, sample_merged, x, y);' + ); +} + +sub by_color_select { + $blurb = <<'BLURB' +Create a selection by selecting all pixels (in the specified drawable) with the +same (or similar) color to that specified. +BLURB + + $help = <<'HELP' +This tool creates a selection over the specified image. A by-color selection is +determined by the supplied color under the constraints of the specified +threshold. Essentially, all pixels (in the drawable) that have color +sufficiently close to the specified color (as determined by the threshold +value) are included in the selection. The antialiasing parameter allows the +final selection mask to contain intermediate values based on close misses to +the threshold bar. Feathering can be enabled optionally and is controlled with +the \"feather_radius\" parameter. If the sample_merged parameter is non-zero, +the data of the composite image will be used instead of that for the specified +drawable. This is equivalent to sampling for colors after merging all visible +layers. In the case of a merged sampling, the supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + color => ['color', 'The color to select'], + threshold => ['0 <= int32 <= 255', + 'Threshold in intensity levels $desc'], + operation => ['enum Operation', 'The selection operation: $desc'], + &antialias_arg, + &feather_select_args, + &sample_merged_arg + ); + + @invoke = ( + 'by_color_select.h', + 'by_color_select (image, drawable, color, threshold, operation, antialias, feather, feather_radius, sample_merged);' + ); +} + +sub clone { + $blurb = <<'BLURB' +Clone from the source to the dest drawable using the current brush +BLURB + + $help = <<'HELP' +This tool clones (copies) from the source drawable starting at the specified +source coordinates to the dest drawable. If the \"clone_type\" argument is set +to PATTERN-CLONE, then the current pattern is used as the source and the +\"src_drawable\" argument is ignored. Pattern cloning assumes a tileable +pattern and mods the sum of the src coordinates and subsequent stroke offsets +with the width and height of the pattern. For image cloning, if the sum of the +src coordinates and subsequent stroke offsets exceeds the extents of the src +drawable, then no paint is transferred. The clone tool is capable of +transforming between any image types including RGB->Indexed--although +converting from any type to indexed is significantly slower. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + src_drawable => ['drawable', "The source drawable"], + clone_type => ['enum CloneType', 'The type of clone: $desc'], + src_x => ['float', 'The x coordinate in the source image'], + src_y => ['float', 'The y coordinate in the source image'], + &stroke_args + ); + + @invoke = ( + 'clone.h', + 'clone_non_gui (drawable, src_drawable, clone_type, src_x, src_y, num_strokes, strokes);' + ); +} + +sub color_picker { + $blurb = <<'BLURB'; +Determine the color at the given drawable coordinates +BLURB + + $help = <<'HELP'; +This tool determines the color at the specified coordinates. The returned color +is an RGB triplet even for grayscale and indexed drawables. If the coordinates +lie outside of the extents of the specified drawable, then an error is +returned. If the drawable has an alpha channel, the algorithm examines the +alpha value of the drawable at the coordinates. If the alpha value is +completely transparent (0), then an error is returned. If the sample_merged +parameter is non-zero, the data of the composite image will be used instead of +that for the specified drawable. This is equivalent to sampling for colors +after merging all visible layers. In the case of a merged sampling, the +supplied drawable is ignored. +HELP + + &std_pdb_misc; + + %inargs = ( + &tool_init_args, + x => ['float', 'x coordinate of upper-left corner of rectangle'], + y => ['float', 'y coordinate of upper-left corner of rectangle'], + &sample_merged_arg, + save_color => ['boolean', 'Save the color to the active palette'] + ); + + %outargs = ( + color => ['color', 'The return color'] + ); + + %invoke = ( + 'color_picker.h', + ' +} diff --git a/tools/pdbgen/pdb/undo.pdb b/tools/pdbgen/pdb/undo.pdb new file mode 100644 index 0000000000..5137efd7ee --- /dev/null +++ b/tools/pdbgen/pdb/undo.pdb @@ -0,0 +1,71 @@ +# The GIMP -- an image manipulation program +# Copyright (C) 1995 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. + +# "Perlized" from C source by Manish Singh + +sub inargs { + @inargs = ( &std_image_arg ); + $inargs[0]->{desc} = 'The ID of the image in which to pop an undo group'; +} + +# The defs + +sub undo_push_group_start { + $blurb = 'Starts a group undo.'; + + $help = <<'HELP'; +This function is used to start a group undo--necessary for logically combining +two or more undo operations into a single operation. This call must be used in +conjunction with a 'gimp-undo-push-group-end' call. +HELP + + &std_pdb_misc; + $date = '1997'; + + &inargs; + + %invoke = ( + headers => [ qw("undo.h") ], + code => 'undo_push_group_start (gimage, MISC_UNDO);' + ); +} + +sub undo_push_group_end { + $blurb = 'Finish a group undo.'; + + $help = <<'HELP'; +This function must be called once for each gimp-undo-push-group call that is +made. +HELP + + &std_pdb_misc; + $date = '1997'; + + &inargs; + + %invoke = ( + headers => [ qw("undo.h") ], + code => 'undo_push_group_end (gimage);' + ); +} + +@procs = qw(undo_push_group_start undo_push_group_end); +%exports = (app => [@procs]); + +$desc = 'Undo'; + +1;