]> git.imager.perl.org - imager.git/blobdiff - Imager.pm
- handle UTF8 strings passed to T1 low-level functions
[imager.git] / Imager.pm
index 9286dfcea34068cae8f208faafe77f4b17b6ecff..34960712b8091edca414e61379f1ca4864e59d72 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -35,7 +35,7 @@ use Imager::Font;
                i_img_setmask
                i_img_getmask
 
-               i_draw
+               i_line
                i_line_aa
                i_box
                i_box_filled
@@ -147,7 +147,7 @@ BEGIN {
   require Exporter;
   require DynaLoader;
 
-  $VERSION = '0.40';
+  $VERSION = '0.41';
   @ISA = qw(Exporter DynaLoader);
   bootstrap Imager $VERSION;
 }
@@ -2015,29 +2015,34 @@ sub arc {
   return $self;
 }
 
-# Draws a line from one point to (but not including) the destination point
+# Draws a line from one point to the other
+# the endpoint is set if the endp parameter is set which it is by default.
+# to turn of the endpoint being set use endp=>0 when calling line.
 
 sub line {
   my $self=shift;
   my $dflcl=i_color_new(0,0,0,0);
-  my %opts=(color=>$dflcl,@_);
+  my %opts=(color=>$dflcl,
+           endp => 1,
+           @_);
   unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
 
   unless (exists $opts{x1} and exists $opts{y1}) { $self->{ERRSTR}='missing begining coord'; return undef; }
   unless (exists $opts{x2} and exists $opts{y2}) { $self->{ERRSTR}='missing ending coord'; return undef; }
 
   my $color = _color($opts{'color'});
-  unless ($color) { 
-    $self->{ERRSTR} = $Imager::ERRSTR; 
-    return; 
+  unless ($color) {
+    $self->{ERRSTR} = $Imager::ERRSTR;
+    return;
   }
+
   $opts{antialias} = $opts{aa} if defined $opts{aa};
   if ($opts{antialias}) {
-    i_line_aa($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2}, 
-              $color);
+    i_line_aa($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2},
+              $color, $opts{endp});
   } else {
-    i_draw($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2}, 
-           $color);
+    i_line($self->{IMG},$opts{x1}, $opts{y1}, $opts{x2}, $opts{y2},
+           $color, $opts{endp});
   }
   return $self;
 }
@@ -2069,14 +2074,14 @@ sub polyline {
   if ($opts{antialias}) {
     for $pt(@points) {
       if (defined($ls)) { 
-        i_line_aa($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color);
+        i_line_aa($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color, 1);
       }
       $ls=$pt;
     }
   } else {
     for $pt(@points) {
       if (defined($ls)) { 
-        i_draw($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color);
+        i_line($self->{IMG},$ls->[0],$ls->[1],$pt->[0],$pt->[1],$color,1);
       }
       $ls=$pt;
     }
@@ -2161,6 +2166,7 @@ sub polybezier {
 sub flood_fill {
   my $self = shift;
   my %opts = ( color=>Imager::Color->new(255, 255, 255), @_ );
+  my $rc;
 
   unless (exists $opts{'x'} && exists $opts{'y'}) {
     $self->{ERRSTR} = "missing seed x and y parameters";
@@ -2176,18 +2182,17 @@ sub flood_fill {
         return;
       }
     }
-    i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
+    $rc = i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
   }
   else {
     my $color = _color($opts{'color'});
-    unless ($color) { 
-      $self->{ERRSTR} = $Imager::ERRSTR; 
-      return; 
+    unless ($color) {
+      $self->{ERRSTR} = $Imager::ERRSTR;
+      return;
     }
-    i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $color);
+    $rc = i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $color);
   }
-
-  $self;
+  if ($rc) { $self; } else { $self->{ERRSTR} = $self->_error_as_msg(); return (); }
 }
 
 sub setpixel {
@@ -2703,7 +2708,7 @@ This document - Synopsis Example, Table of Contents and Overview.
 
 Direct type/virtual images, RGB(A)/paletted images, 8/16/double
 bits/channel, color maps, channel masks, image tags, color
-quantization.
+quantization.  Also discusses basic image information methods.
 
 =item Imager::Files