• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Graphics/Primitive/Driver/H03-May-2022-1,195756

t/H15-Dec-2016-9768

ChangesH A D15-Dec-20163.5 KiB168119

LICENSEH A D15-Dec-201617.9 KiB380292

MANIFESTH A D15-Dec-2016322 1716

META.jsonH A D15-Dec-20162 KiB7068

META.ymlH A D15-Dec-20161.1 KiB3938

Makefile.PLH A D15-Dec-20161.9 KiB7765

READMEH A D15-Dec-2016399 167

README.mkdnH A D15-Dec-20163.1 KiB12277

README

1
2
3This archive contains the distribution Graphics-Primitive-Driver-Cairo,
4version 0.47:
5
6  Cairo backend for Graphics::Primitive
7
8This software is copyright (c) 2016 by Cold Hard Code, LLC.
9
10This is free software; you can redistribute it and/or modify it under
11the same terms as the Perl 5 programming language system itself.
12
13
14This README file was generated by Dist::Zilla::Plugin::Readme v6.008.
15
16

README.mkdn

1# NAME
2
3Graphics::Primitive::Driver::Cairo - Cairo backend for Graphics::Primitive
4
5# VERSION
6
7version 0.47
8
9# SYNOPSIS
10
11    use Graphics::Primitive::Component;
12    use Graphics::Primitive::Driver::Cairo;
13
14    my $driver = Graphics::Primitive::Driver::Cairo->new;
15    my $container = Graphics::Primitive::Container->new(
16        width => 800,
17        height => 600
18    );
19    my $black = Graphics::Primitive::Color->new(red => 0, green => 0, blue => 0);
20    $container->border->width(1);
21    $container->border->color($black);
22    $container->padding(
23        Graphics::Primitive::Insets->new(top => 5, bottom => 5, left => 5, right => 5)
24    );
25    my $comp = Graphics::Primitive::Component->new;
26    $comp->background_color($black);
27    $container->add_component($comp, 'c');
28
29    my $lm = Layout::Manager::Compass->new;
30    $lm->do_layout($container);
31
32    my $driver = Graphics::Primitive::Driver::Cairo->new(
33        format => 'PDF'
34    );
35    $driver->draw($container);
36    $driver->write('/Users/gphat/foo.pdf');
37
38# DESCRIPTION
39
40This module draws Graphics::Primitive objects using Cairo.
41
42# IMPLEMENTATION DETAILS
43
44- **Borders**
45
46    Borders are drawn clockwise starting with the top one.  Since cairo can't do
47    line-joins on different colored lines, each border overlaps those before it.
48    This is not the way I'd like it to work, but i'm opting to fix this later.
49    Consider yourself warned.
50
51# ATTRIBUTES
52
53## antialias\_mode
54
55Set/Get the antialias mode of this driver. Options are default, none, gray and
56subpixel.
57
58## cairo
59
60This driver's Cairo::Context object
61
62## format
63
64Get the format for this driver.
65
66## surface
67
68Get/Set the surface on which this driver is operating.
69
70# METHODS
71
72## data
73
74Get the data in a scalar for this driver.
75
76## write ($file)
77
78Write this driver's data to the specified file.
79
80## get\_text\_bounding\_box ($font, $text, $angle)
81
82Returns two [Rectangles](https://metacpan.org/pod/Graphics::Primitive::Rectangle) that encloses the
83supplied text. The origin's x and y maybe negative, meaning that the glyphs in
84the text extending left of x or above y.
85
86The first rectangle is the bounding box required for a container that wants to
87contain the text.  The second box is only useful if an optional angle is
88provided.  This second rectangle is the bounding box of the un-rotated text
89that allows for a controlled rotation.  If no angle is supplied then the
90two rectangles are actually the same object.
91
92If the optional angle is supplied the text will be rotated by the supplied
93amount in radians.
94
95## get\_textbox\_layout ($tb)
96
97Returns a [Graphics::Primitive::Driver::TextLayout](https://metacpan.org/pod/Graphics::Primitive::Driver::TextLayout) for the supplied
98textbox.
99
100## reset
101
102Reset the driver.
103
104## draw
105
106Draws the specified component.  Container's components are drawn recursively.
107
108# ACKNOWLEDGEMENTS
109
110Danny Luna
111
112# AUTHOR
113
114Cory G Watson <gphat@cpan.org>
115
116# COPYRIGHT AND LICENSE
117
118This software is copyright (c) 2016 by Cold Hard Code, LLC.
119
120This is free software; you can redistribute it and/or modify it under
121the same terms as the Perl 5 programming language system itself.
122