.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Graphics::Primitive 3pm" .TH Graphics::Primitive 3pm "2022-06-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Graphics::Primitive \- Device and library agnostic graphic primitives .SH "SYNOPSIS" .IX Header "SYNOPSIS" Graphics::Primitive is a device and library agnostic system for creating and manipulating various graphical elements such as Borders, Fonts, Paths and the like. .PP .Vb 7 \& my $c = Graphics::Primitive::Component\->new( \& background_color => Graphics::Color::RGB\->new( \& red => 1, green => 0, blue => 0 \& ), \& width => 500, height => 350, \& border => new Graphics::Primitive::Border\->new( width => 5 ) \& ); \& \& my $driver = Graphics::Primitive::Driver::Cairo\->new(format => \*(AqSVG\*(Aq); \& \& $driver\->prepare($c); \& $driver\->finalize($c); \& $driver\->draw($c); \& \& $driver\->write($filename) .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Graphics::Primitive is library agnostic system for drawing things. .PP The idea is to allow you to create and manipulate graphical components and then pass them off to a Driver for actual drawing. .SH "CONCEPTS" .IX Header "CONCEPTS" The root object for Graphics::Primitive is the Component. Components contain all the common elements that you'd expect: margins, padding, background color etc. .PP The next most important is the Container. Containers are Components that can hold other Components. Containers have all the attributes and methods of a Component with the addition of the \&\fIlayout_manager\fR attribute for us with Layout::Manager. .PP Another important Component is the Canvas. The Canvas differs from other components by being a container for various Geometry::Primitive objects. This allows drawing of arbitrary shapes that do not fit existing components. .SH "DRAWING LIFECYCLE" .IX Header "DRAWING LIFECYCLE" After creating all your components, there is a lifecycle that allows them to do their internal housekeeping to prepare for eventual drawing. The lifecycle is: \fBprepare\fR, \fBlayout\fR and \fBpack\fR. Detailed explanation of these methods can be found in Component. .SH "PREPARATION" .IX Header "PREPARATION" Graphics::Primitive::Component has a \f(CW\*(C`prepared\*(C'\fR flag. This flag is set as part of the \f(CW\*(C`prepare\*(C'\fR method (shocking, I know). If this flag is set, then subsequent calls to \f(CW\*(C`prepare\*(C'\fR are ignored. Containers also have a prepare flag, but this flag is \fBnot\fR set when calling \f(CW\*(C`prepare\*(C'\fR. A Container's flag should be set by the layout manager. More information may be found with Layout::Manager. .SH "INSPIRATION" .IX Header "INSPIRATION" Most of the concepts that you'll find in Graphics::Primitive are inspired by Cairo 's \s-1API\s0 and \&\s-1CSS\s0 's box model. .SH "AUTHOR" .IX Header "AUTHOR" Cory Watson, \f(CW\*(C`\*(C'\fR .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Florian Ragwitz .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Many of the ideas here come from my experience using the Cairo library. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2008\-2010 by Cory G Watson. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.