1Template::Plugin::GD(3)User Contributed Perl DocumentatioTnemplate::Plugin::GD(3)
2
3
4
6 Template::Plugin::GD - GD plugin(s) for the Template Toolkit
7
9 [% USE GD;
10
11 # create an image
12 img = GD.image(width, height)
13
14 # allocate some colors
15 black = img.colorAllocate(0, 0, 0);
16 red = img.colorAllocate(255, 0, 0);
17 blue = img.colorAllocate(0, 0, 255);
18
19 # draw a blue oval
20 img.arc(50, 50, 95, 75, 0, 360, blue);
21
22 # fill it with red
23 img.fill(50, 50, red);
24
25 # output binary image in PNG format
26 img.png | redirect('example.png');
27 %]
28
30 The Template-GD distribution provides a number of Template Toolkit
31 plugin modules to interface with Lincoln Stein's GD modules. These in
32 turn provide an interface to Thomas Boutell's GD graphics library.
33
34 These plugins were distributed as part of the Template Toolkit until
35 version 2.15 released in February 2006. At this time they were
36 extracted into this separate distribution.
37
38 For general information on the Template Toolkit see the documentation
39 for the Template module or <http://template-toolkit.org>. For
40 information on using plugins, see Template::Plugins and "USE" in
41 Template::Manual::Directives.
42
44 The GD plugin module provides a number of methods to create various
45 other GD objects. But first you need to load the GD plugin.
46
47 [% USE GD %]
48
49 Then you can call the following objects against it.
50
51 image(width, height)
52 Creates a new GD::Image object.
53
54 [% image = GD.image(100, 200) %]
55
56 polygon()
57 Creates a new GD::Polygon object.
58
59 [% poly = GD.polygon;
60 poly.addPt(50,0);
61 poly.addPt(99,99);
62 poly.addPt(0,99);
63 image.filledPolygon(poly, blue);
64 %]
65
66 text()
67 Creates a new GD::Text object.
68
69 [% text = GD.text;
70 text.set_text('Some text');
71 %]
72
74 These are the GD plugins provided in this distribution.
75
76 Template::Plugin::GD
77 Front-end module to the GD plugin collection.
78
79 Template::Plugin::GD::Image
80 Plugin interface providing direct access to the GD::Image module.
81
82 [% USE image = GD.Image %]
83
84 Template::Plugin::GD::Polygon
85 Plugin interface providing direct access to the GD::Polygon module.
86
87 [% USE poly = GD.Polygon;
88 poly.addPt(50,0);
89 poly.addPt(99,99);
90 poly.addPt(0,99);
91 image.filledPolygon(poly, blue);
92 %]
93
94 Template::Plugin::GD::Text
95 Plugin interface providing direct access to the GD::Text module.
96
97 [% USE text = GD.Text;
98 text.set_text('Some text');
99 %]
100
101 Template::Plugin::GD::Text::Align
102 Plugin interface to the GD::Text::Align module for creating aligned
103 text.
104
105 Template::Plugin::GD::Text::Wrap
106 Plugin interface to the GD::Text::Wrap module for creating wrapped
107 text.
108
109 Template::Plugin::GD::Graph::area
110 Plugin interface to the GD::Graph::area module for creating area
111 graphics with axes and legends.
112
113 Template::Plugin::GD::Graph::bars3d
114 Plugin interface to the GD::Graph::bars3d module for creating 3D bar
115 graphs with axes and legends.
116
117 Template::Plugin::GD::Graph::bars
118 Plugin interface to the GD::Graph::bars module for creating bar graphs
119 with axes and legends.
120
121 Template::Plugin::GD::Graph::lines3d
122 Plugin interface to the GD::Graph::lines3d module for creating 3D line
123 graphs with axes and legends.
124
125 Template::Plugin::GD::Graph::lines
126 Plugin interface to the GD::Graph::lines module for creating line
127 graphs with axes and legends.
128
129 Template::Plugin::GD::Graph::linespoints
130 Plugin interface to the GD::Graph::linespoints module for creating
131 line/point graphs with axes and legends
132
133 Template::Plugin::GD::Graph::mixed
134 Plugin interface to the GD::Graph::mixed module for creating mixed
135 graphs with axes and legends.
136
137 Template::Plugin::GD::Graph::pie3d
138 Plugin interface to the GD::Graph::pie3d module for creating 3D pie
139 charts with legends.
140
141 Template::Plugin::GD::Graph::pie
142 Plugin interface to the GD::Graph::pie module for creating pie charts
143 with legends.
144
145 Template::Plugin::GD::Graph::points
146 Plugin interface to the GD::Graph::points module for creating point
147 graphs with axes and legends
148
149 Template::Plugin::GD::Constants
150 Provides access to various GD constants.
151
152 [% USE gdc = GD.Constants;
153 font = gdc.gdLargeFont
154 %]
155
157 Thomas Boutell wrote the GD graphics library. Lincoln D. Stein wrote
158 the Perl GD modules and Martien Verbruggen wrote the GD::Text and
159 GD::Graph modules that interface with it. Craig Barratt wrote the GD
160 plugins for the Template Toolkit. Andy Wardley wrote the Template
161 Toolkit. Larry wrote Perl. Brian and Dennis wrote C. Dennis and Ken
162 wrote Unix.
163
165 This is version 2.66 of the Template::Plugin::GD module set.
166
168 Copyright (C) 2001 Craig Barratt, 2006 Andy Wardley.
169
170 This module is free software; you can redistribute it and/or modify it
171 under the same terms as Perl itself.
172
174 Template, Template::Plugins, GD
175
176
177
178perl v5.28.1 2006-02-03 Template::Plugin::GD(3)