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 / Polygon.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-30  |  3.9 KB  |  156 lines

  1. #============================================================= -*-Perl-*-
  2. #
  3. # Template::Plugin::GD::Polygon
  4. #
  5. # DESCRIPTION
  6. #
  7. #   Simple Template Toolkit plugin interfacing to the GD::Polygon
  8. #   class in the GD.pm 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: Polygon.pm,v 1.55 2004/01/13 16:20:46 abw Exp $
  22. #
  23. #============================================================================
  24.  
  25. package Template::Plugin::GD::Polygon;
  26.  
  27. require 5.004;
  28.  
  29. use strict;
  30. use GD;
  31. use Template::Plugin;
  32. use base qw( 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.     return new GD::Polygon(@_);
  42. }
  43.  
  44. 1;
  45.  
  46. __END__
  47.  
  48.  
  49. #------------------------------------------------------------------------
  50. # IMPORTANT NOTE
  51. #   This documentation is generated automatically from source
  52. #   templates.  Any changes you make here may be lost.
  53. #   The 'docsrc' documentation source bundle is available for download
  54. #   from http://www.template-toolkit.org/docs.html and contains all
  55. #   the source templates, XML files, scripts, etc., from which the
  56. #   documentation for the Template Toolkit is built.
  57. #------------------------------------------------------------------------
  58.  
  59. =head1 NAME
  60.  
  61. Template::Plugin::GD::Polygon - Interface to GD module Polygon class
  62.  
  63. =head1 SYNOPSIS
  64.  
  65.     [% USE poly = GD.Polygon;
  66.        poly.addPt(50,0);
  67.        poly.addPt(99,99);
  68.     %]
  69.  
  70. =head1 EXAMPLES
  71.  
  72.     [% FILTER null;
  73.         USE im   = GD.Image(100,100);
  74.         USE c    = GD.Constants;
  75.  
  76.         # allocate some colors
  77.         white = im.colorAllocate(255,255,255);
  78.         black = im.colorAllocate(0,  0,  0);
  79.         red   = im.colorAllocate(255,0,  0);
  80.         blue  = im.colorAllocate(0,  0,255);
  81.         green = im.colorAllocate(0,  255,0);
  82.  
  83.         # make the background transparent and interlaced
  84.         im.transparent(white);
  85.         im.interlaced('true');
  86.  
  87.         # Put a black frame around the picture
  88.         im.rectangle(0,0,99,99,black);
  89.  
  90.         # Draw a blue oval
  91.         im.arc(50,50,95,75,0,360,blue);
  92.  
  93.         # And fill it with red
  94.         im.fill(50,50,red);
  95.  
  96.         # Draw a blue triangle by defining a polygon
  97.         USE poly = GD.Polygon;
  98.         poly.addPt(50,0);
  99.         poly.addPt(99,99);
  100.         poly.addPt(0,99);
  101.         im.filledPolygon(poly, blue);
  102.  
  103.         # Output binary image in PNG format
  104.         im.png | stdout(1);
  105.        END;
  106.     -%]
  107.  
  108. =head1 DESCRIPTION
  109.  
  110. The GD.Polygon plugin provides an interface to GD.pm's GD::Polygon class.
  111.  
  112. See L<GD> for a complete description of the GD library and all the
  113. methods that can be called via the GD.Polygon plugin.
  114. See L<Template::Plugin::GD::Image> for the main interface to the
  115. GD functions.
  116. See L<Template::Plugin::GD::Constants> for a plugin that allows you
  117. access to GD.pm's constants.
  118.  
  119. =head1 AUTHOR
  120.  
  121. Craig Barratt E<lt>craig@arraycomm.comE<gt>
  122.  
  123.  
  124. Lincoln D. Stein wrote the GD.pm interface to the GD library.
  125.  
  126.  
  127. =head1 VERSION
  128.  
  129. 1.55, distributed as part of the
  130. Template Toolkit version 2.13, released on 30 January 2004.
  131.  
  132. =head1 COPYRIGHT
  133.  
  134.  
  135. Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>
  136.  
  137. The GD.pm interface is copyright 1995-2000, Lincoln D. Stein.
  138.  
  139. This module is free software; you can redistribute it and/or
  140. modify it under the same terms as Perl itself.
  141.  
  142. =head1 SEE ALSO
  143.  
  144. L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Image|Template::Plugin::GD::Image>, L<Template::Plugin::GD::Constants|Template::Plugin::GD::Constants>, L<GD|GD>
  145.  
  146. =cut
  147.  
  148. # Local Variables:
  149. # mode: perl
  150. # perl-indent-level: 4
  151. # indent-tabs-mode: nil
  152. # End:
  153. #
  154. # vim: expandtab shiftwidth=4:
  155.