1package Template::Plugin::GD::Text::Align;
2
3use strict;
4use warnings;
5use base qw( GD::Text::Align Template::Plugin );
6
7our $VERSION = sprintf("%d.%02d", q$Revision: 1.56 $ =~ /(\d+)\.(\d+)/);
8
9sub new {
10    my $class   = shift;
11    my $context = shift;
12    my $gd      = shift;
13    push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
14    return $class->SUPER::new($gd, @_);
15}
16
17sub set {
18    my $self = shift;
19    push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
20    $self->SUPER::set(@_);
21}
22
231;
24
25__END__
26
27=head1 NAME
28
29Template::Plugin::GD::Text::Align - Draw aligned strings in GD images
30
31=head1 SYNOPSIS
32
33    [% USE align = GD.Text.Align(gd_image); %]
34
35=head1 EXAMPLES
36
37    [% FILTER null;
38        USE im  = GD.Image(100,100);
39        USE gdc = GD.Constants;
40        # allocate some colors
41        black = im.colorAllocate(0,   0, 0);
42        red   = im.colorAllocate(255,0,  0);
43        blue  = im.colorAllocate(0,  0,  255);
44        # Draw a blue oval
45        im.arc(50,50,95,75,0,360,blue);
46
47        USE a = GD.Text.Align(im);
48        a.set_font(gdc.gdLargeFont);
49        a.set_text("Hello");
50        a.set(colour => red, halign => "center");
51        a.draw(50,70,0);
52
53        # Output image in PNG format
54        im.png | stdout(1);
55       END;
56    -%]
57
58=head1 DESCRIPTION
59
60The GD.Text.Align plugin provides an interface to the GD::Text::Align
61module. It allows text to be drawn in GD images with various
62alignments and orientations.
63
64See L<GD::Text::Align> for more details. See
65L<Template::Plugin::GD::Text::Wrap> for a plugin that allow you to
66render wrapped text in GD images.
67
68=head1 AUTHOR
69
70Thomas Boutell wrote the GD graphics library.
71
72Lincoln D. Stein wrote the Perl GD modules that interface to it
73and Martien Verbruggen wrote the GD::Text module.
74
75Craig Barratt E<lt>craig@arraycomm.comE<gt> wrote the original GD
76plugins for the Template Toolkit (2001).
77
78Andy Wardley E<lt>abw@cpan.orgE<gt> extracted them from the TT core
79into a separate distribution for TT version 2.15.
80
81These modules are looking for a new maintainer.  Please contact
82Andy Wardley if you are willing to help out.
83
84=head1 COPYRIGHT
85
86Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>,
872006 Andy Wardley E<lt>abw@cpan.orgE<gt>.
88
89GD::Text is copyright 1999 Martien Verbruggen.
90
91This module is free software; you can redistribute it and/or
92modify it under the same terms as Perl itself.
93
94=head1 SEE ALSO
95
96L<Template::Plugin::GD>, L<Template::Plugin::GD::Text>, L<Template::Plugin::GD::Text::Wrap>, L<GD|GD>
97
98=cut
99
100# Local Variables:
101# mode: perl
102# perl-indent-level: 4
103# indent-tabs-mode: nil
104# End:
105#
106# vim: expandtab shiftwidth=4:
107