| Image-Button documentation | view source | Contained in the Image-Button distribution. |
Image::Button - Base class for building PNG buttons using GD.
use Image::Button::Rect;
my $b1 = new Image::Button::Rect(text => 'text b1',
font => 'newsgotn.ttf',
fontsize => 20,
file => 'b1.png');
# $b2 is like $b1, but with different text and going to another file
my $b2 = $b1->copy(text => 'text b2',
file => 'b2.png');
$b1->print;
$b2->print;
Image::Button builds simple PNG buttons of the type you would use in an on-line application. It provides facilities to build several of them, possibly related (same width and/or height). Modules to create different types of buttons can be easily integrated. The buttons it can create so far would not cause a graphic designer to jump from his chair, drooling with excitement. But he wouldn't fall from his chair in disgust either (I hope).
Image::Button uses GD with TrueType support, which requires freetype (http://www.freetype.org). It also requires true type fonts. It's remarkably difficult to find free fonts out there that can be used to make decent buttons (clean, non-pretentious, ideally sans-serif). Let me know if you find any.
The TrueType fonts should be located either in the current directory or in the directory pointed at by the environment variable TTFONTS.
There is only OO interface to the packages, and all function calls require named parameters.
The way to construct the button will depend on the button type being constructed, but it will generally be of the form:
my $b = new Image::Button::Rect(text => 'text',
font => 'newsgotn.ttf',
fontsize => 20,
fgcolor => [ 85, 85, 136 ], # text
btcolor => [ 238, 238, 204 ],
bgcolor => [ 255, 255, 255 ],
file => 'file.png');
See the man page of the button you are trying to construct for a description of the arguments.
Image::Button::Plain for specifics on plain rectangular buttons.
Image::Button::Rect for specifics on 3D rectangular buttons.
Image::Button::Set for building sets of related buttons.
Add tests. Oval buttons. Triangular buttons (arrow type).
Juan M. García-Reyero <joanmg@twostones.org>
Copyright (C) 2003 Juan M. García-Reyero. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Image-Button documentation | view source | Contained in the Image-Button distribution. |