#! /usr/bin/perl
# Simple script to demonstrate the basics of gimp-perl

use Gimp;
use Gimp::Fu;

register "colored_canvas",
         "Creates a colored canvas",
         "This script creates a canvas pattern over a color gradient",
         "Wolfgang Mauerer",
         "wolfgang\@mynetix.de", # @ must be written as \@ in a perl string
         "0.0",
         "<Toolbox>/Xtns/Script-Fu/Patterns/Color Canvas",
         "",
         [],
         sub {
	     my $image = new Image(640, 480, RGB);
	     # Set new selections for the fore and background-color.
	     Palette->set_foreground('red');
	     Palette->set_background('blue');
	     my $layer = $image->layer_new(640, 480, 
                                           RGB_IMAGE, "Color Canvas", 
                                           100, NORMAL_MODE);
	     
	     # Create a color gradient with the choosen colors.
	     Gimp->gimp_blend($layer, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 
                              639, 379);

	     # ... and apply the canvas filter
	     Gimp->plug_in_apply_canvas($image, $layer, 0, 10);
	     $image->add_layer($layer, 0);

	     return $image;
	 };

exit main;
