]> git.imager.perl.org - imager.git/blobdiff - Imager.pm
1.008 release
[imager.git] / Imager.pm
index c8d24365fd266baa052ac5278dfc63be84b76ee5..f2250684add77babb60f403ae5c419a06f78f10a 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -144,7 +144,7 @@ BEGIN {
   if ($ex_version < 5.57) {
     @ISA = qw(Exporter);
   }
-  $VERSION = '1.006';
+  $VERSION = '1.008';
   require XSLoader;
   XSLoader::load(Imager => $VERSION);
 }
@@ -3106,16 +3106,20 @@ sub polygon {
         return undef;
       }
     }
-    i_poly_aa_cfill_m($self->{IMG}, $opts{'x'}, $opts{'y'}, 
-                    $mode, $opts{'fill'}{'fill'});
+    unless (i_poly_aa_cfill_m($self->{IMG}, $opts{'x'}, $opts{'y'},
+                             $mode, $opts{'fill'}{'fill'})) {
+      return $self->_set_error($self->_error_as_msg);
+    }
   }
   else {
     my $color = _color($opts{'color'});
     unless ($color) { 
       $self->{ERRSTR} = $Imager::ERRSTR; 
-      return; 
+      return;
+    }
+    unless (i_poly_aa_m($self->{IMG}, $opts{'x'}, $opts{'y'}, $mode, $color)) {
+      return $self->_set_error($self->_error_as_msg);
     }
-    i_poly_aa_m($self->{IMG}, $opts{'x'}, $opts{'y'}, $mode, $color);
   }
 
   return $self;
@@ -4218,7 +4222,7 @@ sub _set_error {
 
 # Default guess for the type of an image from extension
 
-my @simple_types = qw(png tga gif raw ico cur xpm mng jng ilbm pcx psd eps);
+my @simple_types = qw(png tga gif raw ico cur xpm mng jng ilbm pcx psd eps webp xwd xpm dng ras);
 
 my %ext_types =
   (
@@ -4253,6 +4257,15 @@ sub def_guess_type {
   return $type;
 }
 
+sub add_type_extensions {
+  my ($class, $type, @exts) = @_;
+
+  for my $ext (@exts) {
+    exists $ext_types{lc $ext} or $ext_types{lc $ext} = lc $type;
+  }
+  1;
+}
+
 sub combines {
   return @combine_types;
 }
@@ -4732,6 +4745,10 @@ paletted image
 
 addtag() -  L<Imager::ImageTypes/addtag()> - add image tags
 
+add_type_extensions() -
+L<Imager::Files/add_type_extensions($type, $ext, ...)> - add extensions for
+new image file types.
+
 align_string() - L<Imager::Draw/align_string()> - draw text aligned on a
 point