Lincoln Stein's GD.pm is a Perl port of Thomas Boutell's
gd graphics library (which is implemented in C). Though it's
more C-specific, Boutell.com's gd page
(
http://www.boutell.com/gd)
provides a lot of useful information and examples, and will
give you insight as to how the original library was
implemented.
-
robsv