home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / Align.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-30  |  3.7 KB  |  148 lines

  1. #============================================================= -*-Perl-*-
  2. #
  3. # Template::Plugin::GD::Text::Align
  4. #
  5. # DESCRIPTION
  6. #
  7. #   Simple Template Toolkit plugin interfacing to the GD::Text::Align
  8. #   module.
  9. #
  10. # AUTHOR
  11. #   Craig Barratt   <craig@arraycomm.com>
  12. #
  13. # COPYRIGHT
  14. #   Copyright (C) 2001 Craig Barratt.  All Rights Reserved.
  15. #
  16. #   This module is free software; you can redistribute it and/or
  17. #   modify it under the same terms as Perl itself.
  18. #
  19. #----------------------------------------------------------------------------
  20. #
  21. # $Id: Align.pm,v 1.55 2004/01/13 16:21:46 abw Exp $
  22. #
  23. #============================================================================
  24.  
  25. package Template::Plugin::GD::Text::Align;
  26.  
  27. require 5.004;
  28.  
  29. use strict;
  30. use GD::Text::Align;
  31. use Template::Plugin;
  32. use base qw( GD::Text::Align Template::Plugin );
  33. use vars qw( $VERSION );
  34.  
  35. $VERSION = sprintf("%d.%02d", q$Revision: 1.55 $ =~ /(\d+)\.(\d+)/);
  36.  
  37. sub new
  38. {
  39.     my $class   = shift;
  40.     my $context = shift;
  41.     my $gd      = shift;
  42.  
  43.     push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
  44.     return $class->SUPER::new($gd, @_);
  45. }
  46.  
  47. sub set
  48. {
  49.     my $self = shift;
  50.  
  51.     push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
  52.     $self->SUPER::set(@_);
  53. }
  54.  
  55. 1;
  56.  
  57. __END__
  58.  
  59.  
  60. #------------------------------------------------------------------------
  61. # IMPORTANT NOTE
  62. #   This documentation is generated automatically from source
  63. #   templates.  Any changes you make here may be lost.
  64. #   The 'docsrc' documentation source bundle is available for download
  65. #   from http://www.template-toolkit.org/docs.html and contains all
  66. #   the source templates, XML files, scripts, etc., from which the
  67. #   documentation for the Template Toolkit is built.
  68. #------------------------------------------------------------------------
  69.  
  70. =head1 NAME
  71.  
  72. Template::Plugin::GD::Text::Align - Draw aligned strings in GD images
  73.  
  74. =head1 SYNOPSIS
  75.  
  76.     [% USE align = GD.Text.Align(gd_image); %]
  77.  
  78. =head1 EXAMPLES
  79.  
  80.     [% FILTER null;
  81.         USE im  = GD.Image(100,100);
  82.         USE gdc = GD.Constants;
  83.         # allocate some colors
  84.         black = im.colorAllocate(0,   0, 0);
  85.         red   = im.colorAllocate(255,0,  0);
  86.         blue  = im.colorAllocate(0,  0,  255);
  87.         # Draw a blue oval
  88.         im.arc(50,50,95,75,0,360,blue);
  89.  
  90.         USE a = GD.Text.Align(im);
  91.         a.set_font(gdc.gdLargeFont);
  92.         a.set_text("Hello");
  93.         a.set(colour => red, halign => "center");
  94.         a.draw(50,70,0);
  95.  
  96.         # Output image in PNG format
  97.         im.png | stdout(1);
  98.        END;
  99.     -%]
  100.  
  101. =head1 DESCRIPTION
  102.  
  103. The GD.Text.Align plugin provides an interface to the GD::Text::Align
  104. module. It allows text to be drawn in GD images with various alignments
  105. and orientations.
  106.  
  107. See L<GD::Text::Align> for more details. See
  108. L<Template::Plugin::GD::Text::Wrap> for a plugin
  109. that allow you to render wrapped text in GD images.
  110.  
  111. =head1 AUTHOR
  112.  
  113. Craig Barratt E<lt>craig@arraycomm.comE<gt>
  114.  
  115.  
  116. The GD::Text module was written by Martien Verbruggen.
  117.  
  118.  
  119. =head1 VERSION
  120.  
  121. 1.55, distributed as part of the
  122. Template Toolkit version 2.13, released on 30 January 2004.
  123.  
  124. =head1 COPYRIGHT
  125.  
  126.  
  127. Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>
  128.  
  129. GD::Text is copyright 1999 Martien Verbruggen.
  130.  
  131. This module is free software; you can redistribute it and/or
  132. modify it under the same terms as Perl itself.
  133.  
  134. =head1 SEE ALSO
  135.  
  136. L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Text|Template::Plugin::GD::Text>, L<Template::Plugin::GD::Text::Wrap|Template::Plugin::GD::Text::Wrap>, L<GD|GD>, L<GD::Text::Align|GD::Text::Align>
  137.  
  138. =cut
  139.  
  140. # Local Variables:
  141. # mode: perl
  142. # perl-indent-level: 4
  143. # indent-tabs-mode: nil
  144. # End:
  145. #
  146. # vim: expandtab shiftwidth=4:
  147.