]> git.imager.perl.org - imager.git/blobdiff - Imager.pm
quote a few hash keys to prevent warnings on 5.004
[imager.git] / Imager.pm
index 3bcee4f1dc8e7e71753d77ff5e84e625b4bc6908..2b283a4fe6288f1c8f8992363aaa92c9b7d195fe 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -147,7 +147,7 @@ BEGIN {
   require Exporter;
   require DynaLoader;
 
-  $VERSION = '0.39';
+  $VERSION = '0.40pre1';
   @ISA = qw(Exporter DynaLoader);
   bootstrap Imager $VERSION;
 }
@@ -396,6 +396,9 @@ sub init {
 #      i_init_fonts();
 #      $fontstate='ok';
 #    }
+  if (exists $parms{'t1log'}) {
+    i_init_fonts($parms{'t1log'});
+  }
 }
 
 END {
@@ -944,6 +947,11 @@ sub _get_writer_io {
       $self->_set_error("Handle in fh option not opened");
       return;
     }
+    # flush it
+    my $oldfh = select($input->{fh});
+    # flush anything that's buffered, and make sure anything else is flushed
+    $| = 1;
+    select($oldfh);
     return io_new_fd($fd);
   }
   elsif ($input->{file}) {
@@ -1196,8 +1204,8 @@ sub _fix_gif_positions {
   for my $pos (@$positions) {
     my ($x, $y) = @$pos;
     my $img = $imgs[$index++];
-    $img->settag(gif_left=>$x);
-    $img->settag(gif_top=>$y) if defined $y;
+    $img->settag(name=>'gif_left', value=>$x);
+    $img->settag(name=>'gif_top', value=>$y) if defined $y;
   }
   $$msg .= "replaced with the gif_left and gif_top tags";
 }
@@ -2191,7 +2199,7 @@ sub setpixel {
     or return undef;
   if (ref $x && ref $y) {
     unless (@$x == @$y) {
-      $self->{ERRSTR} = 'length of x and y mistmatch';
+      $self->{ERRSTR} = 'length of x and y mismatch';
       return undef;
     }
     if ($color->isa('Imager::Color')) {
@@ -2220,7 +2228,7 @@ sub setpixel {
 sub getpixel {
   my $self = shift;
 
-  my %opts = ( type=>'8bit', @_);
+  my %opts = ( "type"=>'8bit', @_);
 
   unless (exists $opts{'x'} && exists $opts{'y'}) {
     $self->{ERRSTR} = 'missing x and y parameters';
@@ -2235,7 +2243,7 @@ sub getpixel {
       return undef;
     }
     my @result;
-    if ($opts{type} eq '8bit') {
+    if ($opts{"type"} eq '8bit') {
       for my $i (0..$#{$opts{'x'}}) {
         push(@result, i_get_pixel($self->{IMG}, $x->[$i], $y->[$i]));
       }
@@ -2248,7 +2256,7 @@ sub getpixel {
     return wantarray ? @result : \@result;
   }
   else {
-    if ($opts{type} eq '8bit') {
+    if ($opts{"type"} eq '8bit') {
       return i_get_pixel($self->{IMG}, $x, $y);
     }
     else {
@@ -2722,15 +2730,13 @@ Helper for making gradient profiles.
 
 =head2 Basic Overview
 
-An Image object is created with C<$img = Imager-E<gt>new()> Should
-this fail for some reason an explanation can be found in
-C<$Imager::ERRSTR> usually error messages are stored in
-C<$img-E<gt>{ERRSTR}>, but since no object is created this is the only
-way to give back errors.  C<$Imager::ERRSTR> is also used to report
-all errors not directly associated with an image object. Examples:
+An Image object is created with C<$img = Imager-E<gt>new()>.
+Examples:
 
-  $img=Imager->new(); # This is an empty image (size is 0 by 0)
-  $img->open(file=>'lena.png',type=>'png'); # initializes from file
+  $img=Imager->new();                         # create empty image
+  $img->open(file=>'lena.png',type=>'png') or # read image from file
+     die $img->errstr();                      # give an explanation
+                                              # if something failed
 
 or if you want to create an empty image:
 
@@ -2739,6 +2745,14 @@ 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()>.
+
+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.
+
 =head1 SUPPORT
 
 You can ask for help, report bugs or express your undying love for
@@ -2751,6 +2765,7 @@ To subscribe send a message with C<subscribe> in the body to:
 or use the form at:
 
    http://www.molar.is/en/lists/imager-devel/
+   (annonymous is temporarily off due to spam)
 
 where you can also find the mailing list archive.
 
@@ -2764,14 +2779,21 @@ Bugs are listed individually for relevant pod pages.
 
 =head1 AUTHOR
 
-Arnar M. Hrafnkelsson (addi@umich.edu) and Tony Cook
+Arnar M. Hrafnkelsson (addi@imager.perl.org) and Tony Cook
 (tony@imager.perl.org) See the README for a complete list.
 
 =head1 SEE ALSO
 
-perl(1), Imager::Color(3), Imager::Font(3), Imager::Matrix2d(3),
+perl(1), Imager::ImageTypes(3), Imager::Files(3), Imager::Draw(3),
+Imager::Color(3), Imager::Fill(3), Imager::Font(3),
+Imager::Transformations(3), Imager::Engines(3), Imager::Filters(3),
+Imager::Expr(3), Imager::Matrix2d(3), Imager::Fountain(3)
 
 Affix::Infix2Postfix(3), Parse::RecDescent(3)
 http://www.eecs.umich.edu/~addi/perl/Imager/
 
 =cut
+
+
+
+