]> git.imager.perl.org - imager.git/commitdiff
svn:ignore some more profiler files and other junk
authorTony Cook <tony@develop=help.com>
Tue, 4 Jul 2006 11:17:12 +0000 (11:17 +0000)
committerTony Cook <tony@develop=help.com>
Tue, 4 Jul 2006 11:17:12 +0000 (11:17 +0000)
we now pass the pod coverage test on the Imager class, remove the TODO

add pod coverage tests for several other classes, and pass them

14 files changed:
Imager.pm
MANIFEST
lib/Imager/Color.pm
lib/Imager/Color/Float.pm
lib/Imager/Color/Table.pm
lib/Imager/Expr.pm
lib/Imager/Files.pod
lib/Imager/Fill.pm
lib/Imager/Font.pm
lib/Imager/Font/BBox.pm
lib/Imager/Font/Wrap.pm
lib/Imager/Handy.pod [new file with mode: 0644]
lib/Imager/ImageTypes.pod
t/t93podcover.t

index f6e0ab844476b1a9ff5d1f83fe15c2fc81aa3795..090a8b88417692dd752b804073d21c41f70a03ab 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -3447,7 +3447,7 @@ render text and more.
 
 =item *
 
-Imager - This document - Synopsis Example, Table of Contents and
+Imager - This document - Synopsis, Example, Table of Contents and
 Overview.
 
 =item *
@@ -3551,14 +3551,32 @@ or if you want to create an empty image:
 This example creates a completely black image of width 400 and height
 300 and 4 channels.
 
-When an operation fails which can be directly associated with an image
-the error message is stored can be retrieved with
-C<$img-E<gt>errstr()>.
+=head1 ERROR HANDLING
 
-In cases where no image object is associated with an operation
-C<$Imager::ERRSTR> is used to report errors not directly associated
-with an image object.  You can also call C<Imager->errstr> to get this
-value.
+In general a method will return false when it fails, if it does use the errstr() method to find out why:
+
+=over
+
+=item errstr
+
+Returns the last error message in that context.
+
+If the last error you received was from calling an object method, such
+as read, call errstr() as an object method to find out why:
+
+  my $image = Imager->new;
+  $image->read(file => 'somefile.gif')
+     or die $image->errstr;
+
+If it was a class method then call errstr() as a class method:
+
+  my @imgs = Imager->read_multi(file => 'somefile.gif')
+    or die Imager->errstr;
+
+Note that in some cases object methods are implemented in terms of
+class methods so a failing object method may set both.
+
+=back
 
 The C<Imager-E<gt>new> method is described in detail in
 L<Imager::ImageTypes>.
@@ -3591,6 +3609,8 @@ copy() - L<Imager::Transformations/copy>
 
 crop() - L<Imager::Transformations/crop> - extract part of an image
 
+def_guess_type() - L<Imager::Files/def_guess_type>
+
 deltag() -  L<Imager::ImageTypes/deltag> - delete image tags
 
 difference() - L<Imager::Filters/"Image Difference">
index e890a46d73c4ca60eb8a02d0fc922be7713d7c0c..643f993e6f5be9e7178199def82aad46260b51f1 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -142,6 +142,7 @@ lib/Imager/Font/Type1.pm
 lib/Imager/Font/Win32.pm
 lib/Imager/Font/Wrap.pm
 lib/Imager/Fountain.pm
+lib/Imager/Handy.pod
 lib/Imager/ImageTypes.pod
 lib/Imager/Inline.pod           Using Imager with Inline::C
 lib/Imager/Matrix2d.pm
index fb76992895fff4004d5b9f0fe46675bbccdf0b5c..b9aac906c7bc6565f11750daf78e77b92dc94226 100644 (file)
@@ -217,7 +217,7 @@ sub _get_x_color {
 
 # Parse color spec into an a set of 4 colors
 
-sub pspec {
+sub _pspec {
   return (@_,255) if @_ == 3 && !grep /[^\d.+eE-]/, @_;
   return (@_    ) if @_ == 4 && !grep /[^\d.+eE-]/, @_;
   if ($_[0] =~ 
@@ -329,13 +329,13 @@ sub pspec {
 
 sub new {
   shift; # get rid of class name.
-  my @arg = pspec(@_);
+  my @arg = _pspec(@_);
   return @arg ? new_internal($arg[0],$arg[1],$arg[2],$arg[3]) : ();
 }
 
 sub set {
   my $self = shift;
-  my @arg = pspec(@_);
+  my @arg = _pspec(@_);
   return @arg ? set_internal($self, $arg[0],$arg[1],$arg[2],$arg[3]) : ();
 }
 
index bf3508fdd3e31a4a15b06aecc80586cb443ab847..7a57e207bc8b97273226de2125ede980006ee7e9 100644 (file)
@@ -11,7 +11,7 @@ $VERSION = "1.004";
 
 # Parse color spec into an a set of 4 colors
 
-sub pspec {
+sub _pspec {
   return (@_,1) if @_ == 3;
   return (@_    ) if @_ == 4;
   if ($_[0] =~ 
@@ -24,24 +24,18 @@ sub pspec {
   return ();
 }
 
-
-
 sub new {
   shift; # get rid of class name.
-  my @arg = pspec(@_);
+  my @arg = _pspec(@_);
   return @arg ? new_internal($arg[0],$arg[1],$arg[2],$arg[3]) : ();
 }
 
 sub set {
   my $self = shift;
-  my @arg = pspec(@_);
+  my @arg = _pspec(@_);
   return @arg ? set_internal($self, $arg[0],$arg[1],$arg[2],$arg[3]) : ();
 }
 
-
-
-
-
 1;
 
 __END__
index 04b5d4bb94735f9b0acd18f6ad699a2a7c0c3643..04ff2ede2d3cc5b58a6ceb67705f68ae85d7a27a 100644 (file)
@@ -831,7 +831,18 @@ The table contains the standard X11 rgb.txt colors.
 This table is not included as part of Imager::Color itself since it's
 moderately large.
 
-There is only one method: get($name).
+There is only one method:
+
+=over
+
+=item get
+
+  my @rgb = Imager::Color::Table->get('red')
+    or die "No red found";
+
+Retrieves a color from Imager::Color::Tables built-in color table.
+
+=back
 
 =head1 AUTHOR
 
index e58d4d97f1e97e4befcfb2587eb48b9d8d9167c6..893a9ac0828dcfd16701799ee25ca418e0a14c48 100644 (file)
@@ -538,9 +538,11 @@ To create a new Imager::Expr object, call:
 You will need to set an expression value and you may set any of the
 following:
 
-=over 4
+=over
+
+=item *
 
-=item constants
+constants
 
 A hashref defining extra constants for expression parsing.  The names
 of the constants must be valid identifiers (/[^\W\d]\w*/) and the
@@ -549,7 +551,9 @@ scalars).
 
 Imager::Expr may define it's own constants (currently just pi.)
 
-=item variables
+=item *
+
+variables
 
 A reference to an array of variable names.  These are allocated
 numeric registers starting from register zero.
@@ -600,7 +604,28 @@ I'll write this one day.
 
 Methods used by parsers:
 
-=over 4
+=over
+
+=item compile
+
+This is the main method you'll need to implement in a parser.  See the
+existing parsers for a guide.
+
+It's supplied the following parameters:
+
+=over
+
+=item *
+
+$expr - the expression to be parsed
+
+=item *
+
+$options - the options hash supplied to transform2.
+
+=back
+
+Return an array ref of array refs containing opcodes and operands.
 
 =item @vars = $self->_variables()
 
@@ -616,6 +641,29 @@ Set the return value of Imager::Expr::error()
 
 Converts marginally parsed RPN to register code.
 
+=item assemble
+
+Called to convert op codes into byte code.
+
+=item numre
+
+Returns a regular expression that matches floating point numbers.
+
+=item optimize
+
+Optimizes the assembly code, including attempting common subexpression
+elimination and strength reducing division by a constant into
+multiplication by a constant.
+
+=item register_type
+
+Called by a new expression parser implementation to register itself,
+call as:
+
+  YourClassName->register_type('type code');
+
+where type code is the parameter that will accept the expression.
+
 =back
 
 =head2 Future compatibility
index c656b3b6aaea6d57337563e45d835886de24af6c..db14624c09ae71f262bc6ba212fc2b0bc9741989 100644 (file)
@@ -175,8 +175,20 @@ will attempt to guess it from the filename.  This is done by calling
 the code reference stored in C<$Imager::FORMATGUESS>.  This is only
 done when write() or write_multi() is called with a C<file> parameter.
 
-The default function examines the extension of the filename to guess
-the type.
+The default function value of C<$Imager::FORMATGUESS> is
+C<\&Imager::def_guess_type>.
+
+=over
+
+=item def_guess_type
+
+This is the default function Imager uses to derive a file type from a
+file name.  This is a function, not a method.
+
+Accepts a single parameter, the filename and returns the type or
+undef.
+
+=back
 
 You can replace function with your own implementation if you have some
 specialized need.  The function takes a single parameter, the name of
index fe1e5d61d4364e80bfa918e2b70e616da2c36d28..d6718572e9a8be1b53659cc6976bec885ad72133 100644 (file)
@@ -170,8 +170,20 @@ sub combines {
 
 =head1 DESCRIPTION 
 
-Creates fill objects for use by some drawing functions, currently just
-the Imager box() method.
+Creates fill objects for use by most filled area drawing functions.
+
+All fills are created with the new method.
+
+=over
+
+=item new
+
+  my $fill = Imager::Fill=>new(...);
+
+The parameters depend on the type of fill being created.  See below
+for details.
+
+=back
 
 The currently available fills are:
 
index 08b6ef658b78e2060348aab6b472a3caf4be2a5c..66a4b7e44d6cc040cb0780713625ff34e06b05cb 100644 (file)
@@ -794,6 +794,11 @@ say how those name tables are unreliable, or how FT2 handles them.
 Both Freetype 1.x and 2.x allow support for glyph names to not be
 included.
 
+=item draw
+
+This is used by Imager's string() method to implement drawing text.
+See L<Imager::Draw/string>.
+
 =back
 
 =head1 MULTIPLE MASTER FONTS
@@ -867,6 +872,16 @@ unicode character 00C3 "LATIN CAPITAL LETTER A WITH DIAERESIS", and
 your font doesn't support it, Imager will I<not> build it from 0041
 "LATIN CAPITAL LETTER A" and 0308 "COMBINING DIAERESIS".
 
+To check if a driver supports UTF8 call the utf8 method:
+
+=over
+
+=item utf8
+
+Return true if the font supports UTF8.
+
+=back
+
 =head2 Native UTF8 Support
 
 If your version of perl supports UTF8 and the driver supports UTF8,
@@ -905,7 +920,11 @@ Since some formats can be handled by more than one driver, a priority
 list is used to choose which one should be used, if a given format can
 be handled by more than one driver.
 
-The current priority can be retrieved with:
+=over
+
+=item priorities
+
+The current priorities can be retrieved with:
 
   @drivers = Imager::Font->priorities();
 
@@ -913,6 +932,8 @@ You can set new priorities and save the old priorities with:
 
   @old = Imager::Font->priorities(@drivers);
 
+=back
+
 If you supply driver names that are not currently supported, they will
 be ignored.
 
index e16052934ec775ea275368146396f74009c51c8a..e53ce519853724c242bf6d2effcacde0712bf693 100644 (file)
@@ -44,6 +44,10 @@ accessible.
 
 =item start_offset()
 
+=item neg_width
+
+=item left_bearing
+
 Returns the horizonatal offset from the selected drawing location to
 the left edge of the first character drawn.  If this is positive, the
 first glyph is to the right of the drawing location.
@@ -67,7 +71,9 @@ sub left_bearing {
   return $_[0][0];
 }
 
-=item end_offset()
+=item end_offset
+
+=item pos_width
 
 The offset from the selected drawing location to the right edge of the
 last character drawn.  Should always be positive.
index 6397ea7aae22fa7798d03a08d9ce0ceed412703d..9b15425a41402fa1d33a3c94d1d0fa7089ea3704 100644 (file)
@@ -238,7 +238,11 @@ You can simply calculate space usage by setting C<image> to C<undef>,
 or set C<savepos> to see how much text can fit within the given
 C<height>.
 
-=head1 OPTIONS
+=over
+
+=item wrap_text
+
+Draw word-wrapped text.
 
 =over
 
@@ -336,8 +340,6 @@ from $font->font_height.  Can be positive or negative.  Default 0.
 
 Any other parameters are passed onto Imager::Font->draw().
 
-=head1 RETURNS
-
 Returns a list:
 
   ($left, $top, $right, $bottom)
@@ -359,6 +361,8 @@ before doing it:
                                 width  => $xsize,
                                 image  => $image);
 
+=back
+
 =head1 BUGS
 
 Imager::Font can handle UTF8 encoded text itself, but this module
diff --git a/lib/Imager/Handy.pod b/lib/Imager/Handy.pod
new file mode 100644 (file)
index 0000000..73eeaa4
--- /dev/null
@@ -0,0 +1,50 @@
+=head1 NAME
+
+Imager::Handy - simple access to common functions
+
+=head1 SYNOPSIS
+
+  use Imager ':handy';
+  my $color = NC(255, 0, 0);
+  my $font = NF(1.0, 0, 0);
+
+=head1 DESCRIPTION
+
+If you use Imager with the C<:handy> import tag, it will export a
+number of functions that can shorter your code.
+
+=over
+
+=item NC
+
+=item newcolor
+
+=item newcolour
+
+Create a new Imager::Color object, supplying any parameters to the
+new() method.
+
+  my $color = NC('red');
+
+=item NF
+
+=item newfont
+
+Create a new Imager::Font object, supplying any parameters to the
+new() method.
+
+  my $font = NF(file => 'foo.ttf');
+
+=back
+
+=head1 BUGS
+
+NC() can be mostly replaced by supplying the color name or other
+description directly to the drawing method.
+
+=head1 AUTHOR
+
+Tony Cook <tony@imager.perl.org>
+
+=cut
+
index 90728f58c8d6bac0325339fbb0670fed75be5076..488f80b6d457f715fbc1ee7c8fede8bd43d23143 100644 (file)
@@ -932,6 +932,50 @@ color table.
 
 =back
 
+=head1 INITIALIZATION
+
+This documents the Imager initialization function, which you will
+almost never need to call.
+
+=over
+
+=item init
+
+This is a function, not a method.
+
+This function is a mess, it can take the following named parameters:
+
+=over
+
+=item *
+
+log - name of a log file to log Imager's actions to.  Not all actions
+are logged, but the debugging memory allocator does log allocations
+here.  Ignored if Imager has been built without logging support.
+
+=item *
+
+loglevel - the maximum level of message to log.  Default: 1.
+
+=item *
+
+warn_obsolete - if this is non-zero then Imager will warn when you
+attempt to use obsoleted parameters or functionality.  This currently
+only includes the old gif output options instead of tags.
+
+=item *
+
+t1log - if non-zero then T1lib will be configured to produce a log
+file.  This will fail if there are any existing T1lib font objects.
+
+=back
+
+Example:
+
+  Imager::init(log => 'trace.log', loglevel => 9);
+
+=back
+
 =head1 REVISION
 
 $Revision$
index 1ad34bd1e4186333dfddb56d8899b0b0534d35bb..1e952545e1c09410436944c751fd0864e8c43719 100644 (file)
@@ -6,22 +6,44 @@ use ExtUtils::Manifest qw(maniread);
 eval "use Test::Pod::Coverage 1.08;";
 # 1.08 required for coverage_class support
 plan skip_all => "Test::Pod::Coverage 1.08 required for POD coverage" if $@;
-plan tests => 1;
 
 # scan for a list of files to get Imager method documentation from
 my $manifest = maniread();
 my @pods = ( 'Imager.pm', grep /\.pod$/, keys %$manifest );
 
-my @private = ( '^io?_', '^DSO_', '^Inline$', '^yatf$', '^m_init_log$' );
-my @trustme = ( '^errstr$', '^open$' );
+my @private = 
+  ( 
+   '^io?_',
+   '^DSO_',
+   '^Inline$',
+   '^yatf$',
+   '^m_init_log$',
+   '^malloc_state$',
+   '^init_log$',
+   '^polybezier$', # not ready for public consumption
+  );
+my @trustme = ( '^open$',  );
 
-TODO: {
-  local $TODO = "Still working on method coverage";
+plan tests => 11;
+
+{
   pod_coverage_ok('Imager', { also_private => \@private,
                              pod_from => \@pods,
                              trustme => \@trustme,
-                             coverage_class => 'Pod::Coverage::Imager' },
-                 "Imager");
-                 
+                             coverage_class => 'Pod::Coverage::Imager' });
+  pod_coverage_ok('Imager::Font');
+  my @color_private = ( '^i_', '_internal$' );
+  pod_coverage_ok('Imager::Color', 
+                 { also_private => \@color_private });
+  pod_coverage_ok('Imager::Color::Float', 
+                 { also_private => \@color_private });
+  pod_coverage_ok('Imager::Color::Table');
+  pod_coverage_ok('Imager::ExtUtils');
+  pod_coverage_ok('Imager::Expr');
+  my $trust_parents = { coverage_class => 'Pod::Coverage::CountParents' };
+  pod_coverage_ok('Imager::Expr::Assem', $trust_parents);
+  pod_coverage_ok('Imager::Fill');
+  pod_coverage_ok('Imager::Font::BBox');
+  pod_coverage_ok('Imager::Font::Wrap');
 }