1Template::Plugin::GD::IUmsaegre(C3o)ntributed Perl DocumTeenmtpaltaitoen::Plugin::GD::Image(3)
2
3
4

NAME

6       Template::Plugin::GD::Image - Interface to GD Graphics Library
7

SYNOPSIS

9           [% USE im = GD.Image(width, height) %]
10

EXAMPLES

12           [% FILTER null;
13               USE gdc = GD.Constants;
14               USE im  = GD.Image(200,100);
15               black = im.colorAllocate(0  ,0,  0);
16               red   = im.colorAllocate(255,0,  0);
17               r = im.string(gdc.gdLargeFont, 10, 10, "Large Red Text", red);
18               im.png | stdout(1);
19              END;
20           -%]
21
22           [% FILTER null;
23               USE im = GD.Image(100,100);
24               # allocate some colors
25               black = im.colorAllocate(0,   0, 0);
26               red   = im.colorAllocate(255,0,  0);
27               blue  = im.colorAllocate(0,  0,  255);
28               # Draw a blue oval
29               im.arc(50,50,95,75,0,360,blue);
30               # And fill it with red
31               im.fill(50,50,red);
32               # Output binary image in PNG format
33               im.png | stdout(1);
34              END;
35           -%]
36
37           [% FILTER null;
38               USE im   = GD.Image(100,100);
39               USE c    = GD.Constants;
40               USE poly = GD.Polygon;
41
42               # allocate some colors
43               white = im.colorAllocate(255,255,255);
44               black = im.colorAllocate(0,  0,  0);
45               red   = im.colorAllocate(255,0,  0);
46               blue  = im.colorAllocate(0,  0,255);
47               green = im.colorAllocate(0,  255,0);
48
49               # make the background transparent and interlaced
50               im.transparent(white);
51               im.interlaced('true');
52
53               # Put a black frame around the picture
54               im.rectangle(0,0,99,99,black);
55
56               # Draw a blue oval
57               im.arc(50,50,95,75,0,360,blue);
58
59               # And fill it with red
60               im.fill(50,50,red);
61
62               # Draw a blue triangle
63               poly.addPt(50,0);
64               poly.addPt(99,99);
65               poly.addPt(0,99);
66               im.filledPolygon(poly, blue);
67
68               # Output binary image in PNG format
69               im.png | stdout(1);
70              END;
71           -%]
72

DESCRIPTION

74       The GD.Image plugin provides an interface to GD.pm's GD::Image class.
75       The GD::Image class is the main interface to GD.pm.
76
77       It is very important that no extraneous template output appear before
78       or after the image.  Since some methods return values that would
79       otherwise appear in the output, it is recommended that GD.Image code be
80       wrapped in a null filter.  The methods that produce the final output
81       (eg, png, jpeg, gd etc) can then explicitly make their output appear by
82       using the stdout filter, with a non-zero argument to force binary mode
83       (required for non-modern operating systems).
84
85       See GD for a complete description of the GD library and all the methods
86       that can be called via the GD.Image plugin.  See
87       Template::Plugin::GD::Constants for a plugin that allows you access to
88       GD.pm's constants.
89

AUTHOR

91       Thomas Boutell wrote the GD graphics library.
92
93       Lincoln D. Stein wrote the Perl GD modules that interface to it.
94
95       Craig Barratt <craig@arraycomm.com> wrote the original GD plugins for
96       the Template Toolkit (2001).
97
98       Andy Wardley <abw@cpan.org> extracted them from the TT core into a
99       separate distribution for TT version 2.15.
100
102       Copyright (C) 2001 Craig Barratt <craig@arraycomm.com>, 2006 Andy
103       Wardley <abw@cpan.org>.
104
105       The GD.pm interface is copyright 1995-2000, Lincoln D. Stein.
106
107       This module is free software; you can redistribute it and/or modify it
108       under the same terms as Perl itself.
109

SEE ALSO

111       Template::Plugin::GD, GD
112
113
114
115perl v5.28.0                      2006-02-03    Template::Plugin::GD::Image(3)
Impressum