Name: SVG::GD

Version 0.18

Author: Ronan Oger

Abstract

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

Synopsis

use GD;
use SVG::GD;
$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);

binmode STDOUT;

# print the image to stdout
print $im->png;

gdTinyFont

returns SVG::GD::Font::Tiny

gdSmallFont

returns SVG::GD::Font::Small();

gdMediumBoldFont

returns SVG::GD::Font::Bold();

gdLargeFont

Returns SVG::GD::Font::Large()

gdGiantFont

Returns SVG::GD::Font::Giant()

gdBrushed

Does nothing at this time

getSVGstyle($font)

retrieve the style in SVG format for predefined fomts

setPixel

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

colorAllocate

Allocate the colour to a variable (red,green,blue)

colorResolve ($red,$green,$blue)

for an rbg tripplet, either returns the index for the colour or generates a new index for that colour

colorsTotal

return the number of allocated colors

colorExact

check for the existance of an exact color

colorClosest

returns the closest colour to the RGB triplet being submitted

line

Draw a line between 2 points

filledRectangle

Draw a filled rectangle.

rectangle

Draw a rectangle.

arc

Draw an arc. Only supports closed arcs at present. Note that we will ultimately need to differenciate between an arc and a circle.

SVG::GD::Image::filledPolygon

Draw a polygon defined by ab SVG::GD::Polygon object

polygon

Draw an empty polygon

string methods

string

write a text string

char

write a character

charUp

write a character upwards

rgb

Return the red,green,blue array for an allocated colour

svg

replace the gif writing request with an svg writing request

png

Return the binary image in PNG format

jpg

Return the binary image in JPEG format

gif

Return the binary image in GIF format Note that some versions of SVGGD do not support this method