[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Gimp perl scripts for Debian buttons



G'day All,
  Here are the scripts that I used to make some buttons.  I'd like people to
test them before we put them onto the web pages.  As requested they also
have transparent backgrounds.

  - Craig

-- 
Craig Small VK2XLZ, PGP: AD 8D D8 63 6E BF C3 C7  47 41 B1 A2 1F 46 EC 90
Eye-Net Consulting http://www.eye-net.com.au/     <csmall@eye-net.com.au>
MIEEE <csmall@ieee.org>              Debian developer <csmall@debian.org>
#!/usr/bin/perl -w

use Gimp qw( :auto ); 
use Gimp::Fu; 
   
sub debian_button {
	my ($words, $fontcolor, $bgcolor) = @_;
	my ($image,$layer,$text,$width);
	my $height = 18;

	gimp_palette_set_foreground($fontcolor);
	gimp_palette_set_background($bgcolor);


	$image = gimp_image_new(80, $height, RGB);
	$layer = gimp_layer_new($image, 80, $height, RGBA_IMAGE, "Button", 100, NORMAL_MODE);
	$text = gimp_text($image, $layer, 9, 3, $words, 0, 0, "15", PIXELS, "*", "Lucida", "bold", "r", "*", "*");
	

	$width = gimp_drawable_width($text);

	# Resize everything
	gimp_image_resize($image, ($width + $height), $height, 0, 0);
	gimp_layer_resize($layer, ($width + $height), $height, 0, 0);

	gimp_image_add_layer($image, $layer, 0);


	gimp_selection_all($image);
	gimp_edit_clear($image, $layer);

        gimp_rect_select($image, 9, 0, $width, $height, SELECTION_REPLACE, 0, 0);
	gimp_ellipse_select($image, (9-($height/2)), 0, $height, $height, SELECTION_ADD, 0, 0, 0);
	gimp_ellipse_select($image, ((9+$width) - ($height/2)), 0, $height, $height, SELECTION_ADD, 0,0,0);
	gimp_bucket_fill($image, $layer, BG_BUCKET_FILL, NORMAL_MODE, 100, 0, 0, 5, 5);
	gimp_selection_none($image);

	gimp_floating_sel_anchor($text);

	gimp_convert_indexed_palette($image, 0, 0, 8, "");

	return $image;
}
 
   
register 
      "debian_button",                 # fill in name 
      "Create Debian Toolbar button",  # a small description 
      "A tutorial script",       # a help text 
      "Craig Small",            # Your name 
      "(c) SPI Inc",        # Your copyright 
      "1998-05-18",              # Date 
      "<Toolbox>/Xtns/Perl-Fu/Debian/Toolbar",   # menu path 
      "*",                       # Image types 
      [ 
       [PF_STRING,   "words", "words to put in button", "Home"], 
       [PF_COLOR, "fontcolor", "Font color", [255,255,255]] ,
       [PF_COLOR, "bgcolor", "Background color", [0,0,132]] 
      ], 
      \&debian_button; 
   
  exit main()
#!/bin/sh

# This script makes the Debian buttons, it is often a good idea
# to have gimp perl up and running so it is a lot faster.
#
# Uncomment this line to run the server
#
# gimp --no-interface --no-data --batch '(extension-perl-server 0 0 0)' &
#
# TRANSLATORS, Edit the stuff in ""s
HOME_TEXT="Home"
ABOUT_TEXT="About Debian"
NEWS_TEXT="News"
DISTRIB_TEXT="Distribution"
SUPPORT_TEXT="Support"
DEVEL_TEXT="Development"
SEARCH_TEXT="Search"

cwd=`pwd`
# Dont' edit below this line
./debbar.pl -words "${HOME_TEXT}" -o ${cwd}/home.gif
./debbar.pl -words "${ABOUT_TEXT}" -o ${cwd}/about.gif
./debbar.pl -words "${NEWS_TEXT}" -o ${cwd}/news.gif
./debbar.pl -words "${DISTRIB_TEXT}" -o ${cwd}/distrib.gif
./debbar.pl -words "${SUPPORT_TEXT}" -o ${cwd}/support.gif
./debbar.pl -words "${DEVEL_TEXT}" -o ${cwd}/devel.gif
./debbar.pl -words "${SEARCH_TEXT}" -o ${cwd}/search.gif


Reply to: