SVG::ChristmasTree - Perl extension to draw Christmas trees with SVG
Perl extension to draw Christmas trees with SVG
# 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;
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.
The width of the tree diagram in "pixels". The default is 1,000.
The number of layers in the tree. The default tree has four layers.
The length of the trunk in "pixels". The default length is 100.
The colour of the tree's leaves. This must be defined as an SVG RGB value. The default value is "rgb(0,127,0)".
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)".
The colour of the tree trunk. This must be defined as an SVG RGB value. The default value is "rgb(139,69,19)".
The colour of the pot. This must be defined as an SVG RGB value. The default value is "rgb(191,0,0)".
The height of the pot in "pixels". The default height is 200.
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.
STDOUT
Dave Cross <dave@perlhacks.com>
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.
To install SVG::ChristmasTree, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SVG::ChristmasTree
CPAN shell
perl -MCPAN -e shell install SVG::ChristmasTree
For more information on module installation, please visit the detailed CPAN module installation guide.