The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SVG::ChristmasTree - Perl extension to draw Christmas trees with SVG

DESCRIPTION

Perl extension to draw Christmas trees with SVG

SYNOPSIS

    # Default tree
    my $tree = SVG::ChristmasTree->new;
    print $tree->as_xml;

    # Or change things
    my $tree = SVG::ChristmasTree->new({
      layers => 5,
      leaf_colour => 'rgb(0,255,0)',
      pot_colour => 'rgb(0,0,255)',
    });
    print $tree->as_xml;

Methods

$tree = SVG::ChristmasTree->new(\%args)

Constructs and returns a new SVG::ChristmasTree object. With no arguments, a default tree design is created, but it is possible to change that by passing the following attributes to the method.

width INT

The width of the tree diagram in "pixels". The default is 1,000.

layers INT

The number of layers in the tree. The default tree has four layers.

trunk_length INT

The length of the trunk in "pixels". The default length is 100.

leaf_colour STR

The colour of the tree's leaves. This must be defined as an SVG RGB value. The default value is "rgb(0,127,0)".

bauble_colour STR

The colour of the baubles that hang on the tree. This must be defined as an SVG RGB value. The default value is "rgb(212,175,55)".

trunk colour STR

The colour of the tree trunk. This must be defined as an SVG RGB value. The default value is "rgb(139,69,19)".

pot_colour STR

The colour of the pot. This must be defined as an SVG RGB value. The default value is "rgb(191,0,0)".

pot_height INT

The height of the pot in "pixels". The default height is 200.

$tree->as_xml

Returns the SVG document as XML. You will usually want to store the returned value in a variable, print it to STDOUT or write it to a file.

AUTHOR

Dave Cross <dave@perlhacks.com>

COPYRIGHT AND LICENCE

Copyright (c) 2018, Magnum Solutions Ltd. All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.