#!/opt/bin/perl eval 'exec /opt/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell # 7/15/03 # Changed spot that its registered from /Guides to /Image/Guides # to reduce horizontal clutter on menubar use Gimp; use Gimp::Fu; use Gimp::Util; register "guide_to_selection", "Puts a selection mask around the guides", "Selects the area under the guides (1px wide)", "Marc Lehmann", "Marc Lehmann ", "1999-08-01", N_"/Image/Guides/To Selection...", "*", [ [PF_RADIO, "operation", "The selection operation (CHANNEL_OP_ADD, CHANNEL_OP_SUBTRACT, CHANNEL_OP_REPLACE)", CHANNEL_OP_REPLACE, [ADD => CHANNEL_OP_ADD, SUB => CHANNEL_OP_SUBTRACT, REPLACE => CHANNEL_OP_REPLACE]], [PF_TOGGLE, "feather", "Feather the selection?", 0], [PF_SPINNER, "feather_radius","Radius for feather operation", 1, [0, 1000, 1e0]], ], [], ['gimp-1.1'], sub { my($img, $drawable, $operation, $feather, $radius) = @_; my($W,$H) = ($img->width, $img->height); $i = $img->find_next_guide(0); while ($i) { my ($x,$y,$w,$h); $x = $img->get_guide_position($i); if ($img->get_guide_orientation($i) == ORIENTATION_HORIZONTAL) { ($x,$y,$w,$h) = (0,$x-$width,$W,1); } else { ($x,$y,$w,$h) = ($x,0,1,$H); } $img->rect_select($x,$y,$w,$h,$operation,$feather,$radius); $operation = CHANNEL_OP_ADD if $operation == CHANNEL_OP_REPLACE; $i = $img->find_next_guide($i); } (); }; exit main; =head1 LICENSE Copyright Marc Lehman. Distrubuted under the same terms as Gimp-Perl. =cut