Provide (as seamless as possible) an SVG wrapper to the GD API in order to provide SVG output of images generate with the Perl GD module
$im = new GD::Image(100,50);
# allocate black -- this will be our background
$black = $im->colorAllocate(0, 0, 0);
# allocate white
$white = $im->colorAllocate(255, 255, 255);
# allocate red
$red = $im->colorAllocate(255, 0, 0);
# allocate blue
$blue = $im->colorAllocate(0,0,255);
#Inscribe an ellipse in the image
$im->arc(50, 25, 98, 48, 0, 360, $white);
# Flood-fill the ellipse. Fill color is red, and will replace the
# black interior of the ellipse
$im->fill(50, 21, $red);
# print the image to stdout
Does nothing at this time
retrieve the style in SVG format for predefined fomts
set a pixel to a colour Because SVG does not understand pixels, this method has to be faked. We know from the image size what is meant by a pixel, so we create a rectangle of size 1x1 and give it a colour
Allocate the colour to a variable (red,green,blue)
for an rbg tripplet, either returns the index for the colour or generates a new index for that colour
return the number of allocated colors
check for the existance of an exact color
returns the closest colour to the RGB triplet being submitted
Draw a line between 2 points
Draw a filled rectangle.
Draw a rectangle.
Draw an arc. Only supports closed arcs at present. Note that we will ultimately need to differenciate between an arc and a circle.
Draw a polygon defined by ab SVG::GD::Polygon object
Draw an empty polygon
write a text string
write a character
write a character upwards
Return the red,green,blue array for an allocated colour
replace the gif writing request with an svg writing request
Return the binary image in PNG format
Return the binary image in JPEG format
Return the binary image in GIF format Note that some versions of SVG::GD do not support this method
To install SVG::GD, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.