#!/usr/bin/perl # # Rewritten for GIMP 1.2 and the Graphics Muse Tools CD # by Michael J. Hammel (mjhammel@graphics-muse.org # Jan 26, 2002 use Gimp ":auto"; use Gimp::Fu; sub disco { my ($size, $bgcolor, $radius , $color , $moveBig , $moveSmall) = @_; # Create the background $img = gimp_image_new($size, $size, RGB); $layer = gimp_layer_new($img, $size, $size, RGB, "Layer 1", 100, NORMAL_MODE); gimp_image_add_layer($layer, -1); gimp_palette_set_background($bgcolor); gimp_edit_fill($layer, BG_IMAGE_FILL); my $ncircles = int($size/$radius/2); for ($i=0; $i<$ncircles; $i++) { for ($j=0; $j<$ncircles; $j++) { # Select a circle $xa = $i*$radius*2; $ya = $j*$radius*2; $xb = $radius*2; $yb = $radius*2; gimp_ellipse_select($img, $xa , $ya, $xb , $yb, REPLACE, 1, 0, 0); # Paint the disk gimp_palette_set_background($color); gimp_edit_fill($layer, BG_IMAGE_FILL); gimp_selection_none($img); $colorCenter = [$i*30, ($ncircles-$j)*25, ($i+$j)*15]; # Select a circle $xa = $xa+($radius/2)+$moveBig; $ya = $ya+($radius/2)+$moveBig; $xb = $radius; $yb = $radius; gimp_ellipse_select($img, $xa , $ya, $xb , $yb, REPLACE, 1, 0, 0); # Paint the disk gimp_palette_set_background($colorCenter); gimp_edit_fill($layer, BG_IMAGE_FILL); gimp_selection_none($img); $colorCenterS = [$j*60, ($ncircles-$i)*50, ($i+$j)*30]; # Select a circle $xa = $xa+($radius/4)+$moveSmall; $ya = $ya+($radius/4)+$moveSmall; $xb = $radius/2; $yb = $radius/2; gimp_ellipse_select($img, $xa , $ya, $xb , $yb, REPLACE, 1, 0, 0); # Paint the disk gimp_palette_set_background($colorCenterS); gimp_edit_fill($layer, BG_IMAGE_FILL); gimp_selection_none($img); } } return $img; } # register the script register "flashy_disks", "A 70s Disco background", "A 70s Disco background", "Casa jc", "Casa jc", "2001-07-24", "/Xtns/Perl-Fu/Disco", "*", [ [PF_INT32, "size", "Img size", 400], [PF_COLOR, "background", "Background color", [255,255,255]], [PF_INT32, "radius", "Disk radius", 40], [PF_COLOR, "color", "Disk color", [0,0,0]], [PF_INT32, "move_big_disk", "XY move for Big Disk", 0], [PF_INT32, "move_small_disk", "XY move for Small Disk", 0], ], \&disco; exit main();