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