NAME

App::MathImage::Image::Base::SVGout -- SVG image file output

SYNOPSIS

use App::MathImage::Image::Base::SVGout;
my $image = App::MathImage::Image::Base::SVGout->new (-width => 100,
                                                      -height => 100);
$image->set (-file => '/some/filename.svg');
$image->rectangle (0,0, 99,99, 'red');
$image->xy (20,20, '#FF00FF');
$image->line (50,50, 70,70, 'white');
$image->line (50,50, 70,70, 'green');
$image->save;

CLASS HIERARCHY

App::MathImage::Image::Base::SVGout is a subclass of Image::Base,

Image::Base
  App::MathImage::Image::Base::SVGout

DESCRIPTION

App::MathImage::Image::Base::SVGout extends Image::Base to write SVG format image files progressively.

This is an unusual Image::Base module in that it writes to its -file during drawing, rather than holding an image in memory. This means drawing is just prints of SVG elements to the file, but means a -file must be specified before drawing. The final save() just writes a closing </svg> to the file.

Image::Base is pixel oriented so isn't really the sort of thing SVG is meant for, but this module at least makes it possible to get SVG out of some Image::Base drawing code. SVG has many more features than can be accessed with the functions here, and being XML text often isn't too hard to spit out directly.

See Image::Base::SVG for similar SVG output but going to an SVG.pm object.

FUNCTIONS

$image = App::MathImage::Image::Base::SVGout->new (key=>value,...)

Create and return a new SVGout image object.

$image = App::MathImage::Image::Base::SVGout->new (-width => 200, -height => 100);
$newimage = $image->new (key=>value,...)

Clone $image and apply the given settings. This can only be done before drawing has begun.

$colour = $image->xy ($x, $y)

Get an individual pixel. The return is always undef since there's no support for picking out elements etc from the drawn SVG.

$image->load ()
$image->load ($filename)

Loading is not possible with this module.

$image->save ()
$image->save ($filename)

Save the image to an SVG file, either the current -file option, or set that option to $filename and save to there.

ATTRIBUTES

-width (integer)
-height (integer)

Set the SVG canvas size in pixels. These must be set before the first drawing operation, and cannot be changed after the first drawing operation (because they're printed in the initial SVG header).

SEE ALSO

Image::Base, Image::Base::SVG