#!/opt/bin/perl # by Seth Burgess #[Xach] start off with an image, then pixelize it #[Xach] then add alpha->add layer mask [20:21] #[Xach] render a checkerboard into the layer mask #[Xach] duplicate the image. fill the original with black, then blur the layer # mask (i used 30% of pixelize size) and offset it by some value (i # chose 20% of the pixelize size) #[Xach] duplicate the duplicate, remove the layer mask, move it below everything #[Xach] then add a new white layer on top, set the mode to multiply, and render # a grid into it at pixelize size #[Xach] that's a bit roundabout, but it's also in the xcf # # Because the way xach does it is a bit ackward, I'm switching it around a bit # and working from the bottom up.. # Revision 1.1: Marc Lehman added undo capability # Revision 1.2: Marc Lehman , changed function name # Revision 1.3: Seth Burgess , changed location and # added my email address # Revision 1.4: Seth Burgess removed deprecated stuff # use Gimp qw(:auto __ N_); use Gimp::Fu; register "xach_shadows", "Xach's Shadows o' Fun", "Screen of 50% of your drawing into a dropshadowed layer.", "Seth Burgess", "Seth Burgess ", "2-15-98", N_"/Filters/Map/Xach Shadows...", "RGB*, GRAY*", [ [PF_SLIDER, "block_size", "The size of the blocks...", 10, [4, 255, 1]], ], sub { my($img,$drawable,$blocksize) =@_; eval { $img->undo_group_start }; Context->push(); # $selection_flag = 0; if (!$drawable->has_alpha) { $drawable->add_alpha; }; Context->set_foreground('white'); Context->set_background('black'); # This only can be applied to an entire image right now.. # $selection = $img->selection_save; $img->selection_all; # Now the fun begins :) $drawable->plug_in_pixelize($blocksize); $shadowlayer = $drawable->layer_copy(0); $img->add_layer($shadowlayer,0); $checkmask = $shadowlayer->create_mask(ADD_WHITE_MASK); $shadowlayer->add_mask($checkmask); plug_in_checkerboard ($img, $checkmask, 0, $blocksize); $frontlayer = $shadowlayer->layer_copy(0); $img->add_layer($frontlayer,0); Context->set_background([0,0,0]); $shadowlayer->fill(BACKGROUND_FILL); $checkmask->plug_in_gauss_iir(0.3*$blocksize, 1, 1); $checkmask->offset (1, 0, 0.2*$blocksize, 0.2*$blocksize); $gridlayer = $img->layer_new($img->width, $img->height, RGBA_IMAGE, "Grid 1", 100, 0); $img->add_layer($gridlayer,0); $img->selection_all; gimp_edit_clear($gridlayer); Context->set_background([255,255,255]); gimp_edit_fill($gridlayer, BACKGROUND_FILL); $gridlayer->plug_in_grid((1, $blocksize, 0, [0,0,0], 255) x 3); gimp_layer_set_mode($gridlayer, 3); # Clean up stuff Context->pop(); $img->selection_none; eval { $img->undo_group_end }; gimp_displays_flush(); return(); }; exit main; =head1 LICENSE Copyright Seth Burgess. Distrubuted under the same terms as Gimp-Perl. =cut