Section: User Contributed Perl Documentation (3)
Updated: 2003-03-04
Index Return to Main Contents


Image::Button::Plain - Builds plain rectangular PNG buttons  


  use Image::Button::Plain;

  my $b1 = new Image::Button::Plain(text     => 'text b1',
                                    font     => 'newsgotn.ttf',
                                    fontsize => 20,
                                    bdcolor  => [0, 0, 0], # border
                                    file     => 'b1.png');




Builds a plain vanilla rectangular button, with an optional border, using GD with TrueType support. See Image::Button for more details about things you can do with Buttons.  


    my $b = new Image::Button::Plain(text     => 'text',
                                     font     => 'newsgotn.ttf',
                                     fontsize => 20,
                                     file     => 'file.png');

The arguments are

text => 'button text'
Defaults to ''.
font => 'something.ttf'
The TrueType font with which to print. It should be localted either in the current directory or in the directory pointed at by the environment variable TTFONTS. Mandatory.
fontsize => 12
Font size. Defaults to 12 points.
file => 'button.png'
File where the button will be saved. Can be overridden in the print function. Mandatory if you plan to use Image::Button::Set to output several related buttons at a time. Defaults to the button text, replacing spaces by '-'. Use '>-' if you want to send the image to standard output.
bgcolor => [ 255, 255, 255 ]
Background color in RGB (so [255,255,255] is white and [0,0,0] is black). Defaults to [255,255,255]. Used only as a default for btcolor, down there, for compatibility with other button types.
btcolor => [ 238, 238, 204 ]
Button color in RGB . Defaults to the background color, which in turn defaults to white.
fgcolor => [ 0, 0, 0 ]
Foreground (text) color in RGB. Defaults to [0,0,0].
bdcolor => [ 0, 0, 0 ]
Border color in RGB. Defaults to the button color, so if you don't set it you'll get a solid rectangle of btcolor.
border => 1
Border size in pixels. Note that if you want to see the border you have to set the border color with bdcolor. Defaults to 1.
vmargin => 4
Vertical margin under and over the text. Defaults to 4 pixels.
hmargin => 4
Horizontal margin left and right of the text. Defaults to 4 pixels.


Image::Button for a description of how to make buttons, and other functions you can use with Image::Button::Plain.

Image::Button::Set for building sets of related buttons.  


Juan M. García-Reyero <>  


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.



COPYRIGHT manual pages