# 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 sub inargs { @inargs = ( { name => 'drawable', type => 'drawable', desc => "The drawable to @{[shift]}" } ); } # Common invoker for checking for image/drawable consistency sub invoke { %invoke = ( headers => [ qw("core/gimp.h" "core/gimpedit.h") ], vars => [ 'GimpImage *gimage' ], 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', init => 1 } ); &invoke('layer != NULL'); $cmd = "layer = gimp_edit_paste (gimage, drawable, gimp->global_buffer, paste_into);\n"; $invoke{code} =~ s/(success.*$)/"$cmd $1"/me; } 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('gimp_edit_clear (gimage, drawable)'); } sub edit_fill { $blurb = 'Fill selected area of drawable.'; $help = <<'HELP'; This procedure fills the specified 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. Other fill modes should not be used. This procedure only affects regions within a selection if there is a selection active. HELP &std_pdb_misc; $author .= ' & Raphael Quinet'; $date = '1995-2000'; @inargs = ( { name => 'drawable', type => 'drawable', desc => "The drawable to fill to" }, { name => 'fill_type', type => 'enum GimpFillType', desc => 'The type of fill: %%desc%%' } ); &invoke('gimp_edit_fill (gimage, drawable, (GimpFillType) fill_type)'); } 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('gimp_image_mask_stroke (gimage, drawable, gimp_get_current_context (gimage->gimp))'); push @{$invoke{headers}}, qw("core/gimpimage-mask.h"); } @headers = qw("core/gimpimage.h"); @procs = qw(edit_cut edit_copy edit_paste edit_clear edit_fill edit_stroke); %exports = (app => [@procs], lib => [@procs]); $desc = 'Edit procedures'; 1;