#! /usr/bin/perl ################################################################################# # # aquabou.pl # A Gimp Perl-Fu that create a Aqua Style Button # # Copyright (C) 2001 Denis Bodor # # 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. # # # Rewritten for GIMP 1.2 and the Graphics Muse Tools CD # by Michael J. Hammel (mjhammel@graphics-muse.org # Jan 26, 2002 ################################################################################# use Gimp; use Gimp::Fu; register "aqua_pro", "Creates a aqua-style button", "This script creates a multi-layered aqua button. Thx to Wolfgang Mauerer.", "Denis Bodor", "lefinnois\@lefinnois.net", # @ must be written as \@ in a perl string "0.0", "/Xtns/Script-Fu/Buttons/AquaPro", "", [ [PF_COLOR, 'color', 'Button color','#477cb7'], [PF_COLOR, 'back', 'Backgrounf color','#000000'] ], sub { my $image = new Image(512, 286, RGB); my $coulfg = shift; my $coulbg = shift; # Set new selections for the fore and background-color. $oldfg=Palette->get_foreground(); $oldbg=Palette->get_background(); Palette->set_foreground($coulfg); Palette->set_background('white'); my $fond = $image->layer_new(512, 286, RGBA_IMAGE, "Background", 100, NORMAL_MODE); my $base = $image->layer_new(512, 286, RGBA_IMAGE, "Base", 90, NORMAL_MODE); my $ombre = $image->layer_new(512, 286, RGBA_IMAGE, "Shadow", 70, NORMAL_MODE); my $reflh = $image->layer_new(512, 286, RGBA_IMAGE, "Top Reflect", 80, SCREEN_MODE); my $lum = $image->layer_new(512, 286, RGBA_IMAGE, "light", 100, OVERLAY_MODE); $image->add_layer($reflh, 0); $image->add_layer($lum, 1); $image->add_layer($base, 2); $image->add_layer($ombre, 3); $image->add_layer($fond, 4); $reflh->edit_clear(); $lum->edit_clear(); $base->edit_clear(); $ombre->edit_clear(); $fond->edit_clear(); # fill the background Palette->set_foreground($coulbg); $fond->edit_fill(0); # make base of the button $maskbase=$base->layer_create_mask(2); $maskbase->edit_clear(); Palette->set_foreground('white'); $maskbase->edit_fill(0); selzone($image); Palette->set_foreground($coulfg); $base->edit_fill(0); $image->selection_shrink(58); Palette->set_foreground('#a0a0a0'); $maskbase->edit_fill(0); $image->selection_none(); $maskbase->plug_in_gauss_rle2(74,74); # Gimp->gimp_image_add_layer_mask($image,$base,$maskbase); $image->image_add_layer_mask($base,$maskbase); $maskbase->channel_set_visible(0); # Make shadow selzone($image); $image->selection_translate(0,50); Palette->set_foreground($coulfg); $ombre->edit_fill(0); $image->selection_none(); $ombre->plug_in_gauss_rle2(44,44); Palette->set_foreground($coulfg); $maskombre=$ombre->layer_create_mask(2); $maskombre->edit_clear(); Palette->set_foreground('black'); $maskombre->edit_fill(0); selzone($image); $image->selection_invert(); $maskombre->edit_clear(); $image->image_add_layer_mask($ombre,$maskombre); $maskombre->channel_set_visible(0); #make light $image->selection_none(); Palette->set_foreground('black'); $lum->edit_fill(0); selzone($image); $image->selection_shrink(30); $image->selection_translate(0,45); Palette->set_foreground('white'); $lum->edit_fill(0); $image->selection_none(); $lum->plug_in_gauss_rle2(50,50); #Top reflect $image->rect_select(122, 50, 268, 40, 2, 0, 0); my $chacha = $image->selection_save(); $image->selection_none(); $image->plug_in_gauss_iir($chacha, 36, 1, 1); $chacha->levels(0, 123, 133, 1.0, 0, 255); $chacha->selection_load(); $image->image_remove_channel($chacha); Palette->set_foreground('black'); $reflh->blend(1,0,0,100,0,0,0,0,0,256,97,256,50); $reflh->perspective(0,122,50, 390,50, 80,90,432,90 ); $image->image_floating_selection()->floating_sel_anchor(); Palette->set_foreground($oldfg); Palette->set_background($oldbg); return $image; }; exit main; sub selzone { my $img= shift; $img->ellipse_select(40, 40, 176, 176, 2, 1, 0, 0); $img->ellipse_select(296, 40, 176, 176, 0, 1, 0, 0); $img->rect_select(128, 40, 256, 176, 0, 0, 0); }