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

Re: cannot create toolbar images



19.11.2004 о 17:45 -0800 Matt Kraai написав(-ла):
> Howdy,
> 
> 
> Could someone help me make this work?
I had the same problem. Script that I used to create Ukrainian images
attached. Note: config file *must* be in UTF-8.

Regards,
-- 
Eugeniy Meshcheryakov

Kyiv National Taras Shevchenko University
Information and Computing Centre
http://icc.univ.kiev.ua
#!/usr/bin/perl -w
#
# Perl script to generate the Debian toolbar icons
# By Craig Small <csmall@debian.org>, modified by various people
#
# See webwml/english/Pics/README for more information.

use strict;
use Gimp qw( :auto ); 
use Gimp::Fu; 
   
sub debian_button {
	my ($words, $antialias, $fontface, $fontsize, $fontcolor, $bgcolor)  = @_;
	my ($image,$layer,$text,$width);
	my $height = 18;
	my $top = 0;
	if ($words =~ s/@(.*)//) {
		my $pos = $1;
		if ($pos =~ m/y=(\d+)/) {
			$top = $1;
		}
	}

	Palette->set_foreground($fontcolor);
	Palette->set_background($bgcolor);


	$image = new Image(80, $height, RGB);
	$layer = new Layer($image, 80, $height, RGBA_IMAGE, "Button", 100, NORMAL_MODE);


	$width = (Gimp->text_get_extents_fontname($words, $fontsize, PIXELS, $fontface))[0];
	# Resize everything
	$image->resize(($width + $height), $height, 0, 0);
	$layer->resize(($width + $height), $height, 0, 0);

	$layer->add_layer(0);


	$image->selection_all;
	$layer->edit_clear;

        $image->rect_select(9, 0, $width, $height, CHANNEL_OP_REPLACE, 0, 0);
	$image->ellipse_select((9-($height/2)), 0, $height, $height, CHANNEL_OP_ADD, 0, 0, 0);
	$image->ellipse_select(((9+$width) - ($height/2)), 0, $height, $height, CHANNEL_OP_ADD, 0,0,0);
	$layer->bucket_fill(BG_BUCKET_FILL, NORMAL_MODE, 100, 0, 0, 5, 5);
	$image->selection_none;

	$text = $image->text_fontname(-1, 9, $top, $words, 0, $antialias, $fontsize, PIXELS, $fontface);
	$image->merge_visible_layers(0);

	Palette->set_background("#df0451");
	Gimp->image_convert_indexed($image, NO_DITHER, MAKE_PALETTE, 8, 0, 0, "");

	return $image;
}
 
   
register 
      "debian_button",
      "Create Debian Toolbar button",            # a small description 
      "A script to generate Debian navbar",      # a help text
      "Craig Small",
      "Copyright (c) 1998, 2001  SPI Inc.",
      "2001-06-10",
      "<Toolbox>/Xtns/Perl-Fu/Debian/Toolbar",   # menu path
      "*",                                       # Image types
      [ 
       [PF_STRING, "words", "Words to put in button", "About"], 
       [PF_BOOL, "antialias", "Use anti-aliasing", 1], 
       [PF_STRING, "fontface", "Font face", "Arial"], 
       [PF_INT, "fontsize", "Font size", "14"], 
       [PF_COLOR, "fontcolor", "Font color", [255,255,255]] ,
       [PF_COLOR, "bgcolor", "Background color", [0,0,132]],
      ], 
      \&debian_button; 
   
  exit main()
# Button text for your language
# This text is in UTF-8 encoding

ABOUT_TEXT   := "Про Debian"
DEVEL_TEXT   := "Розробка"
GETTING_TEXT := "Як отримати"
NEWS_TEXT    := "Новини"
SEARCH_TEXT  := "Пошук"
SITEMAP_TEXT := "Карта сайта"
SUPPORT_TEXT := "Підтримка"

# Font settings.
 ANTIALIAS := 1
 FONTFACE := "Arial Bold"
 FONTSIZE := 14

Attachment: signature.asc
Description: Digital signature


Reply to: