#!/usr/bin/perl use Gimp; use Gimp::Fu; register "gimp_fu_example_script", # fill in a function name "A non-working example of Gimp::Fu usage", # and a short description, "Just a starting point to derive new ". # a (possibly multiline) help text "scripts. Always remember to put a long". "help message here!", "Marc Lehmann ", # don't forget your name (author) "(c)1998,1999,2000 Marc Lehmann", # and your copyright! "20000321", # the date this script was written (YYYYMMDD) N_"/Xtns/Gimp::Fu Example...", # the menu path "RGB*, GRAYA", # image types to accept (RGB, RGAB amnd GRAYA) [ # argument type, switch name , a short description , default value, extra arguments [PF_SLIDER , "width" , "The image width" , 360, [300, 500]], [PF_SPINNER , "height" , "The image height" , 100, [100, 200]], [PF_STRING , "text" , "The Message" , "example text"], [PF_INT , "bordersize" , "The bordersize" , 10], [PF_FLOAT , "borderwidth" , "The borderwidth" , 1/5], [PF_FONT , "font" , "The Font Family" ], [PF_COLOUR , "text_colour" , "The (foreground) text colour", [10,10,10]], [PF_COLOUR , "bg_colour" , "The background colour" , "#ff8000"], [PF_TOGGLE , "ignore_cols" , "Ignore colours" , 0], [PF_IMAGE , "extra_image" , "An additonal picture to ignore"], [PF_DRAWABLE , "extra_draw" , "Somehting to ignroe as well" ], [PF_RADIO , "type" , "The effect type" , 0, [small => 0, large => 1]], [PF_BRUSH , "a_brush" , "An unused brush" ], [PF_PATTERN , "a_pattern" , "An unused pattern" ], [PF_GRADIENT , "a_gradients" , "An unused gradients" ], ], sub { # now do sth. useful with the garbage we got ;) my($width,$height,$text,$brd1,$brd2,$font,$fg,$bg,$ignore,$xtraimg,$xtradrw,$effecttype,$brush,$pattern,$gradient)=@_; # set tracing, disable this to get rid of the debugging output Gimp::set_trace(TRACE_CALL); my $img = new Image ($width, $height, RGB); # put an undo group around any modifications, so that # they can be undone in one step. $img->undo_push_group_start; # the __ before the string in the next line indicates text that must be translated my $l = new Layer ($img, $width, $height, RGB, __"Background", 100, NORMAL_MODE); $l->add_layer(0); # now a few syntax examples Palette->set_foreground($fg) unless $ignore; Palette->set_background($bg) unless $ignore; fill $l BG_IMAGE_FILL; $text_layer = $img->text_fontname(-1, 10, 10, $text, 5, 1, xlfd_size($font), $font); Palette->set_foreground("green"); # close the undo push group $img->undo_push_group_end; $img; # return the image, or an empty list, i.e. () }; exit main;