@node GD, GDBM_File, Font/AFM, Module List
@unnumbered Interface to Gd Graphics Library


@unnumberedsec NAME

GD.pm - Interface to Gd Graphics Library

@unnumberedsec DESCRIPTION

@strong{GD.pm} is a port of Thomas Boutell@'s gd graphics library (see
below).  GD allows you to create color drawings using a large number of
graphics primitives, and emit the drawings as GIF files.

GD defines the following three classes:

@table @asis
@item @code{GD::Image}
An image class, which holds the image data and accepts graphic
primitive method calls.

@item @code{GD::Font}
A font class, which holds static font information and used for text
rendering.

@item @code{GD::Polygon}
A simple polygon object, used for storing lists of vertices prior to
rendering a polygon into an image.

@end table
A Simple Example:

@example
#!/usr/local/bin/perl
@end example

@example
use GD;

# create a new image
$im = new GD::Image(100,100);
@end example

@example
# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);       
$red = $im->colorAllocate(255,0,0);      
$blue = $im->colorAllocate(0,0,255);
@end example

@example
# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced(@'true@');
@end example

@example
# Put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
@end example

@example
# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
@end example

@example
# And fill it with red
$im->fill(50,50,$red);
@end example

@example
# Convert the image to GIF and print it on standard output
print $im->gif;
@end example

Notes:

@enumerate
@item 
To create a new, empty image, send a new() message to GD::Image, passing it the width and height of the image you want to create.  An image object will be returned.  Other class methods allow you to initialize an image from a preexisting GIF, GD or XBM file.
@item 
Next you will ordinarily add colors to the image@'s color table. colors are added using a colorAllocate() method call.  The three parameters in each call are the red, green and blue (rgb) triples for the desired color.  The method returns the index of that color in the image@'s color table.  You should store these indexes for later use.
@item 
Now you can do some drawing!  The various graphics primitives are described below.  In this example, we do some text drawing, create an oval, and create and draw a polygon.
@item 
Polygons are created with a new() message to GD::Polygon.  You can add points to the returned polygon one at a time using the addPt() method. The polygon can then be passed to an image for rendering.
@item 
When you@'re done drawing, you can convert the image into GIF format by sending it a gif() message.  It will return a (potentially large) scalar value containing the binary data for the image.  Ordinarily you will print it out at this point or write it to a file.
@end enumerate
@unnumberedsec Method Calls

@unnumberedsubsec Creating and Saving Images

@table @asis
@item new
@code{GD::Image::new(width,height)} @emph{class method}

To create a new, blank image, send a new() message to the GD::Image
class.  For example:

@example
$myImage = new GD::Image(100,100) || die;
@end example

This will create an image that is 100 x 100 pixels wide.  If you don@'t
specify the dimensions, a default of 64 x 64 will be chosen. If
something goes wrong (e.g. insufficient memory), this call will
return undef.

@item @code{newFromGif}
@code{GD::Image::newFromGif(FILEHANDLE)} @emph{class method}

This will create an image from a GIF file read in through the provided
filehandle.  The filehandle must previously have been opened on a
valid GIF file or pipe.  If successful, this call will return an
initialized image which you can then manipulate as you please.  If it
fails, which usually happens if the thing at the other end of the
filehandle is not a valid GIF file, the call returns undef.  Notice
that the call doesn@'t automatically close the filehandle for you.

To get information about the size and color usage of the information,
you can call the image query methods described below.

@example
Example usage:
@end example

@example
open (GIF,"barnswallow.gif") || die;
$myImage = newFromGif GD::Image(GIF) || die;
close GIF;
@end example

@item @code{newFromXbm}
@code{GD::Image::newFromXbm(FILEHANDLE)} @emph{class method}

This works in exactly the same way as @code{newFromGif}, but reads the
contents of an X Bitmap file:

@example
open (XBM,"coredump.xbm") || die;
$myImage = newFromXbm GD::Image(XBM) || die;
close XBM;
@end example

@item @code{newFromGd}
@code{GD::Image::newFromGd(FILEHANDLE)} @emph{class method}

This works in exactly the same way as @code{newFromGif}, but reads the
contents of a GD file.  GD is Tom Boutell@'s disk-based storage format,
intended for the rare case when you need to read and write the image
to disk quickly.  It@'s not intended for regular use, because, unlike
GIF or JPEG, no image compression is performed and these files can
become @strong{BIG}.

@example
open (GDF,"godzilla.gd") || die;
$myImage = newFromGd GD::Image(GDF) || die;
close GDF;
@end example

@item @code{gif}
@code{GD::Image::gif} @emph{object method}

This returns the image data in GIF format.  You can then print it,
pipe it to a display program, or write it to a file.  Example:

@example
$gif_data = $myImage->gif;
open (DISPLAY,"| display -") || die;
print DISPLAY $gif_data;
close DISPLAY;
@end example

@item @code{gd}
@code{GD::Image::gd} @emph{object method}

This returns the image data in GD format.  You can then print it,
pipe it to a display program, or write it to a file.  Example:

@example
print MYOUTFILE $myImage->gd;
@end example

@end table
@unnumberedsubsec Color Control

@table @asis
@item @code{colorAllocate}
@code{GD::Image::colorAllocate(red,green,blue)} @emph{object method}

This allocates a color with the specified red, green and blue
components and returns its index in the color table, if specified.
The first color allocated in this way becomes the image@'s background
color.  (255,255,255) is white (all pixels on).  (0,0,0) is black (all
pixels off).  (255,0,0) is fully saturated red.  (127,127,127) is 50%
gray.  You can find plenty of examples in /usr/X11/lib/X11/rgb.txt.

If no colors are allocated, then this function returns -1.

Example:

@example
$white = $myImage->colorAllocate(0,0,0); #background color
$black = $myImage->colorAllocate(255,255,255);
$peachpuff = $myImage->colorAllocate(255,218,185);
@end example

@item @code{colorDeallocate}
@code{GD::Image::colorDeallocate(colorIndex)} @emph{object method} 

This marks the color at the specified index as being ripe for
reallocation.  The next time colorAllocate is used, this entry will be
replaced.  You can call this method several times to deallocate
multiple colors.  There@'s no function result from this call.

Example:

@example
$myImage->colorDeallocate($peachpuff);
$peachy = $myImage->colorAllocate(255,210,185);
@end example

@item @code{colorClosest}
@code{GD::Image::colorClosest(red,green,blue)} @emph{object method}

This returns the index of the color closest in the color table to the
red green and blue components specified.  If no colors have yet been
allocated, then this call returns -1.

Example:

@example
$apricot = $myImage->colorClosest(255,200,180);
@end example

@item @code{colorExact}
@code{GD::Image::colorExact(red,green,blue)} @emph{object method}

This returns the index of a color that exactly matches the specified
red green and blue components.  If such a color is not in the color
table, this call returns -1.

@example
$rosey = $myImage->colorExact(255,100,80);
warn "Everything@'s coming up roses.\n" if $rosey >= 0;
@end example

@item @code{colorsTotal}
@code{GD::Image::colorsTotal)} @emph{object method}

This returns the total number of colors allocated in the object.

@example
$maxColors = $myImage->colorsTotal;
@end example

@item @code{getPixel}
@code{GD::Image::getPixel(x,y)} @emph{object method}

This returns the color table index underneath the specified
point.  It can be combined with rgb()
to obtain the rgb color underneath the pixel.

Example:

@example
$index = $myImage->getPixel(20,100);
($r,$g,$b) = $myImage->rgb($index);
@end example

@item @code{rgb}
@code{GD::Image::rgb(colorIndex)} @emph{object method}

This returns a list containing the red, green and blue components of
the specified color index.

Example:

@example
@@RGB = $myImage->rgb($peachy);
@end example

@item @code{transparent}
@code{GD::Image::transparent(colorIndex)} @emph{object method}

This marks the color at the specified index as being transparent.
Portions of the image drawn in this color will be invisible.  This is
useful for creating paintbrushes of odd shapes, as well as for
making GIF backgrounds transparent for displaying on the Web.  Only
one color can be transparent at any time. To disable transparency, 
specify -1 for the index.  

If you call this method without any parameters, it will return the
current index of the transparent color, or -1 if none.

Example:

@example
open(GIF,"test.gif");
$im = newFromGif GD::Image(GIF);
$white = $im->colorClosest(255,255,255); # find white
$im->transparent($white);
print $im->gif;
@end example

@end table
@unnumberedsubsec Special Colors

GD implements a number of special colors that can be used to achieve
special effects.  They are constants defined in the GD::
namespace, but automatically exported into your namespace when the GD
module is loaded.

@table @asis
@item @code{setBrush}
@itemx @code{gdBrushed}
@code{GD::Image::setBrush( )} and @code{GD::gdBrushed}

You can draw lines and shapes using a brush pattern.  Brushes are 
just images that you can create and manipulate in the usual way. When
you draw with them, their contents are used for the color and shape of
the lines.

To make a brushed line, you must create or load the brush first, then
assign it to the image using @code{setBrush}.  You can then draw in that
with that brush using the @code{gdBrushed} special color.  It@'s often 
useful to set the background of the brush to transparent so that 
the non-colored parts don@'t overwrite other parts of your image.

Example:

@example
# Create a brush at an angle
$diagonal_brush = new GD::Image(5,5);
$white = $diagonal_brush->allocateColor(255,255,255);
$black = $diagonal_brush->allocateColor(0,0,0);
$diagonal_brush->transparent($white);
$diagonal_brush->line(0,4,4,0,$black); # NE diagonal
@end example

@example
# Set the brush
$myImage->setBrush($diagonal_brush);

# Draw a circle using the brush
$myImage->arc(50,50,25,25,0,360,gdBrushed);
@end example

@item @code{setStyle}
@itemx @code{gdStyled}
@code{GD::Image::setStyle(@@colors)} and @code{GD::gdStyled}

Styled lines consist of an arbitrary series of repeated colors and are
useful for generating dotted and dashed lines.  To create a styled
line, use @code{setStyle} to specify a repeating series of colors.  It
accepts an array consisting of one or more color indexes.  Then
draw using the @code{gdStyled} special color.  Another special color,
@code{gdTransparent} can be used to introduce holes in the line, as the
example shows.

Example:

@example
# Set a style consisting of 4 pixels of yellow,
# 4 pixels of blue, and a 2 pixel gap
$myImage->setStyle($yellow,$yellow,$yellow,$yellow,
		   $blue,$blue,$blue,$blue,
		   gdTransparent,gdTransparent);
$myImage->arc(50,50,25,25,0,360,gdStyled);
@end example

To combine the @code{gdStyled} and @code{gdBrushed} behaviors, you can specify
@code{gdStyledBrushed}.  In this case, a pixel from the current brush
pattern is rendered wherever the color specified in setStyle() is
neither gdTransparent nor 0.

@item @code{gdTiled}
Draw filled shapes and flood fills using a pattern.  The pattern is
just another image.  The image will be tiled multiple times in order
to fill the required space, creating wallpaper effects.  You must call
@code{setTile} in order to define the particular tile pattern you@'ll use
for drawing when you specify the gdTiled color.
details.

@item @code{gdStyled}
The gdStyled color is used for creating dashed and dotted lines.  A
styled line can contain any series of colors and is created using the
@code{setStyled} command.

@end table
@unnumberedsubsec Drawing Commands

@table @asis
@item @code{setPixel}
@code{GD::Image::setPixel(x,y,color)} @emph{object method} 

This sets the pixel at (x,y) to the specified color index.  No value
is returned from this method.  The coordinate system starts at the
upper left at (0,0) and gets larger as you go down and to the right.
You can use a real color, or one of the special colors gdBrushed, 
gdStyled and gdStyledBrushed can be specified.

Example:

@example
# This assumes $peach already allocated
$myImage->setPixel(50,50,$peach);
@end example

@item @code{line}
@code{GD::Image::line(x1,y1,x2,y2,color)} @emph{object method}

This draws a line from (x1,y1) to (x2,y2) of the specified color.  You
can use a real color, or one of the special colors gdBrushed, 
gdStyled and gdStyledBrushed.

Example:

@example
# Draw a diagonal line using the currently defind
# paintbrush pattern.
$myImage->line(0,0,150,150,gdBrushed);
@end example

@item @code{dashedLine}
@code{GD::Image::dashedLine(x1,y1,x2,y2,color)} @emph{object method}

This draws a dashed line from (x1,y1) to (x2,y2) in the specified
color.  A more powerful way to generate arbitrary dashed and dotted
lines is to use the setStyle() method described below and to draw with
the special color gdStyled.

Example:

@example
$myImage->dashedLine(0,0,150,150,$blue);
@end example

@item @code{rectangle}
@code{GD::Image::rectangle(x1,y1,x2,y2,color)} @emph{object method}

This draws a rectangle with the specified color.  (x1,y1) and (x2,y2)
are the upper left and lower right corners respectively.  Both real 
color indexes and the special colors gdBrushed, gdStyled and 
gdStyledBrushed are accepted.

Example:

@example
$myImage->rectangle(10,10,100,100,$rose);
@end example

@item @code{filledRectangle}
@code{GD::Image::filledRectangle(x1,y1,x2,y2,color)} @emph{object method}

This draws a rectangle filed with the specified color.  You can use a
real color, or the special fill color gdTiled to fill the polygon
with a pattern.

Example:

@example
# read in a fill pattern and set it
open(GIF,"happyface.gif") || die;
$tile = newFromGif GD::Image(GIF);
$myImage->setTile($tile); 
@end example

@example
# draw the rectangle, filling it with the pattern
$myImage->filledRectangle(10,10,150,200,gdTiled);
@end example

@item @code{polygon}
@code{GD::Image::polygon(polygon,color)} @emph{object method} 

This draws a polygon with the specified color.  The polygon must be
created first (see below).  The polygon must have at least three
vertices.  If the last vertex doesn@'t close the polygon, the method
will close it for you.  Both real color indexes and the special 
colors gdBrushed, gdStyled and gdStyledBrushed can be specified.

Example:

@example
$poly = new GD::Polygon;
$poly->addPt(50,0);
$poly->addPt(99,99);
$poly->addPt(0,99);
$myImage->polygon($poly,$blue);
@end example

@item @code{filledPolygon}
@code{GD::Image::filledPolygon(poly,color)} @emph{object method}

This draws a polygon filled with the specified color.  You can use a
real color, or the special fill color gdTiled to fill the polygon
with a pattern.

Example:

@example
# make a polygon
$poly = new GD::Polygon;
$poly->addPt(50,0);
$poly->addPt(99,99);
$poly->addPt(0,99);
@end example

@example
# draw the polygon, filling it with a color
$myImage->filledPolygon($poly,$peachpuff);
@end example

@item @code{arc}
@code{GD::Image::arc(cx,cy,width,height,start,end,color)} @emph{object method}

This draws arcs and ellipses.  (cx,cy) are the center of the arc, and
(width,height) specify the width and height, respectively.  The
portion of the ellipse covered by the arc are controlled by start and
end, both of which are given in degrees from 0 to 360.  Zero is at the
top of the ellipse, and angles increase clockwise.  To specify a
complete ellipse, use 0 and 360 as the starting and ending angles.  To
draw a circle, use the same value for width and height.

You can specify a normal color or one of the special colors gdBrushed,
gdStyled, or gdStyledBrushed.

Example:

@example
# draw a semicircle centered at 100,100
$myImage->arc(100,100,50,50,0,180,$blue);
@end example

@item @code{fill}
@code{GD::Image::fill(x,y,color)} @emph{object method}

This method flood-fills regions with the specified color.  The color
will spread through the image, starting at point (x,y), until it is
stopped by a pixel of a different color from the starting pixel (this
is similar to the "paintbucket" in many popular drawing toys).  You
can specify a normal color, or the special color gdTiled, to flood-fill
with patterns.

Example:

@example
# Draw a rectangle, and then make its interior blue
$myImage->rectangle(10,10,100,100,$black);
$myImage->fill(50,50,$blue);
@end example

@item @code{GD::Image::fillToBorder(x,y,bordercolor,color)} @emph{object method}
Like @code{fill}, this method flood-fills regions with the specified color,
starting at position (x,y).
However, instead of stopping when it hits a pixel of a different color
than the starting pixel, flooding will only stop when it hits the
color specified by bordercolor.  You must specify a normal indexed
color for the bordercolor.  However, you are free to use the gdTiled
color for the fill.

Example:

@example
# This has the same effect as the previous example
$myImage->rectangle(10,10,100,100,$black);
$myImage->fillToBorder(50,50,$black,$blue);
@end example

@end table
@unnumberedsubsec Image Copying Commands

Two methods are provided for copying a rectangular region from one
image to another.  One method copies a region without resizing it.
The other allows you to stretch the region during the copy operation.

With either of these methods it is important to know that the routines
will attempt to flesh out the destination image@'s color table to match
the colors that are being copied from the source.  If the
destination@'s color table is already full, then the routines will
attempt to find the best match, with varying results.

@table @asis
@item copy
@code{GD::Image::copy(sourceImage,dstX,dstY,srcX,srcY,width,height)} @emph{object method}

This is the simpler of the two copy operations, copying the specified
region from the source image to the destination image (the one
performing the method call).  (srcX,srcY) specify the upper left
corner of a rectangle in the source image, and (width,height) give the
width and height of the region to copy.  (dstX,dstY) control where in
the destination image to stamp the copy.  You can use the same image
for both the source and the destination, but the source and
destination regions must not overlap or strange things will happen.

Example:

@example
$myImage = new GD::Image(100,100);
... various drawing stuff ...
$srcImage = new GD::Image(50,50);
... more drawing stuff ...
# copy a 25x25 pixel region from $srcImage to
# the rectangle starting at (10,10) in $myImage
$myImage->copy($srcImage,10,10,0,0,25,25);
@end example

@item @code{copyResized}
@code{GD::Image::copyResized(sourceImage,dstX,dstY,srcX,srcY,destW,destH,srcW,srcH)} @emph{object method}

This method is similar to copy() but allows you to choose different
sizes for the source and destination rectangles.  The source and
destination rectangle@'s are specified independently by (srcW,srcH) and
(destW,destH) respectively.  copyResized() will stretch or shrink the
image to accomodate the size requirements.

Example:

@example
$myImage = new GD::Image(100,100);
... various drawing stuff ...
$srcImage = new GD::Image(50,50);
... more drawing stuff ...
# copy a 25x25 pixel region from $srcImage to
# a larger rectangle starting at (10,10) in $myImage
$myImage->copyResized($srcImage,10,10,0,0,50,50,25,25);
@end example

@end table
@unnumberedsubsec Character and String Drawing

Gd allows you to draw characters and strings, either in normal
horizontal orientation or rotated 90 degrees.  These routines use a
GD::Font object, described in more detail below.  There are four
built-in fonts, available in global variables gdLargeFont,
gdMediumBoldFont, gdSmallFont and gdTinyFont.  Currently there is no
way of dynamically creating your own fonts.

@table @asis
@item @code{string}
@code{GD::Image::string(font,x,y,string,color)} @emph{Object Method}

This method draws a string startin at position (x,y) in the specified
font and color.  Your choices of fonts are gdSmallFont, gdMediumBoldFont,
gdTinyFont and gdLargeFont.

Example:

@example
$myImage->string(gdSmallFont,2,10,"Peachy Keen",$peach);
@end example

@item @code{stringUp}
@code{GD::Image::stringUp(font,x,y,string,color)} @emph{Object Method}

Just like the previous call, but draws the text rotated
counterclockwise 90 degrees.

@item @code{char}
@itemx @code{charUp}
@code{GD::Image::char(font,x,y,char,color)} @emph{Object Method}
@code{GD::Image::charUp(font,x,y,char,color)} @emph{Object Method}

These methods draw single characters at position (x,y) in the
specified font and color.  They@'re carry-overs from the C interface,
where there is a distinction between characters and strings.  Perl is
insensible to such subtle distinctions.

@end table
@unnumberedsubsec Miscellaneous Image Methods

@table @asis
@item @code{interlaced}
@code{GD::Image::interlaced( )} @code{GD::Image::interlaced(1)} @emph{Object method}

This method sets or queries the image@'s interlaced setting.  Interlace
produces a cool venetian blinds effect on certain viewers.  Provide a
true parameter to set the interlace attribute.  Provide undef to
disable it.  Call the method without parameters to find out the
current setting.

@item c<getBounds>
@code{GD::Image::getBounds( )} @emph{Object method}

This method will return a two-member list containing the width and
height of the image.  You query but not not change the size of the
image once it@'s created.

@end table
@unnumberedsubsec Polygon Methods

A few primitive polygon creation and manipulation methods are
provided.  They aren@'t part of the Gd library, but I thought they
might be handy to have around (they@'re borrowed from my qd.pl
Quickdraw library).

@table @asis
@item c<new>
@code{GD::Polygon::new} @emph{class method}

Create an empty polygon with no vertices.

@example
$poly = new GD::Polygon;
@end example

@item @code{addPt}
@code{GD::Polygon::addPt(x,y)} @emph{object method}

Add point (x,y) to the polygon.

@example
$poly->addPt(0,0);
$poly->addPt(0,50);
$poly->addPt(25,25);
$myImage->fillPoly($poly,$blue);
@end example

@item @code{getPt}
@code{GD::Polygon::getPt(index)} @emph{object method}

Retrieve the point at the specified vertex.

@example
($x,$y) = $poly->getPt(2);
@end example

@item @code{setPt}
@code{GD::Polygon::setPt(index,x,y)} @emph{object method}

Change the value of an already existing vertex.  It is an error to set
a vertex that isn@'t already defined.

@example
$poly->setPt(2,100,100);
@end example

@item @code{deletePt}
@code{GD::Polygon:deletePt(index)} @emph{object method}

Delete the specified vertex, returning its value.

@example
($x,$y) = $poly->deletePt(1); 
@end example

@item length
@code{GD::Polygon::length} @emph{object method}

Return the number of vertices in the polygon.

@example
$points = $poly->length;
@end example

@item @code{vertices}
@code{GD::Polygon::vertices} @emph{object method}

Return a list of all the verticies in the polygon object.  Each
membver of the list is a reference to an (x,y) array.

@example
@@vertices = $poly->vertices;
foreach $v (@@vertices)
   print join(",",@@$v),"\n";
@}
@end example

@item @code{bounds}
@code{GD::Polygon::bounds} @emph{object method}

Return the smallest rectangle that completely encloses the polygon.
The return value is an array containing the (left,top,right,bottom) of
the rectangle.

@example
($left,$top,$right,$bottom) = $poly->bounds;
@end example

@item @code{offset}
@code{GD::Polygon::offset(dx,dy)} @emph{object method}

Offset all the vertices of the polygon by the specified horizontal
(dh) and vertical (dy) amounts.  Positive numbers move the polygon
down and to the right.

@example
$poly->offset(10,30);
@end example

@item map
@code{GD::Polygon::map(srcL,srcT,srcR,srcB,destL,dstT,dstR,dstB)} @emph{object method}

Map the polygon from a source rectangle to an equivalent position in a
destination rectangle, moving it and resizing it as necessary.  See
polys.pl for an example of how this works.  Both the source and
destination rectangles are given in (left,top,right,bottom)
coordinates.  For convenience, you can use the polygon@'s own bounding
box as the source rectangle.

@example
# Make the polygon really tall
$poly->map($poly->bounds,0,0,50,200);
@end example

@end table
@unnumberedsubsec Font Utilities

Gd@'s support for fonts is minimal.  Basically you have access to
gdSmallFont and gdLargeFont for drawing, and not much else.  However,
for future compatibility, I@'ve made the fonts into perl objects of
type GD::Font that you can query and, perhaps someday manipulate.

@table @asis
@item @code{gdSmallFont}
@code{GD::Font::gdSmallFont} @emph{constant}

This is the basic small font, "borrowed" from a well known public
domain 6x12 font.

@item @code{gdLargeFont}
@code{GD::Font::gdLargeFont} @emph{constant}

This is the basic large font, "borrowed" from a well known public
domain 8x16 font.

@item @code{gdMediumBoldFont}
@code{GD::Font::gdMediumBoldFont} @emph{constant}

This is a bold font intermediate in size between the small and large
fonts, borrowed from a public domain 7x13 font;

@item @code{gdTinyFont}
@code{GD::Font::gdTinyFont} @emph{constant}

This is a tiny, almost unreadable font, 5x8 pixels wide.

@item @code{nchars}
@code{GD::Font::nchars}	@emph{object method}

This returns the number of characters in the font.

@example
print "The large font contains ",gdLargeFont->nchars," characters\n";
@end example

@item @code{offset}
@code{GD::Font::offset} 	@emph{object method}

This returns the ASCII value of the first character in the font

@item @code{width}
@itemx @code{height}
@code{GD::Font::width} @code{GD::Font::height}	@emph{object methods}

These return the width and height of the font.

@example
($w,$h) = (gdLargeFont->width,gdLargeFont->height);
@end example

@end table
@unnumberedsec Obtaining the C-language version of gd

libgd, the C-language version of gd, can be obtained at URL
http://www.boutell.com/gd/gd.html.  Directions for installing and
using it can be found at that site.  Please do not contact me for help
with libgd.

@unnumberedsec Copyright Information

The GD.pm interface is copyright 1995, Lincoln D. Stein.  You are free
to use it for any purpose, commercial or noncommercial, provided that
if you redistribute the source code this statement of copyright
remains attached. The gd library is covered separately under a 1994
copyright by Quest Protein Database Center, Cold Spring Harbor Labs
and Thomas Boutell.  For usage information see the gd documentation at
URL

@example
http://www.boutell.com/gd/gd.html
@end example

The latest versions of GD.pm are available at

@example
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/GD.html
ftp://ftp-genome.wi.mit.edu/pub/software/WWW/GD.pm.tar.gz
@end example

