we one point to access mask
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 19 May 2010 22:20:33 +0000 (00:20 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 19 May 2010 22:20:33 +0000 (00:20 +0200)
trace-path.pl

index 6239d13..3611481 100755 (executable)
@@ -83,6 +83,12 @@ sub reset_path { @path = () }
 
 sub curve {
 
+       if ( $#path < 1 ) {
+               warn "path too short ", dump @path;
+               reset_path;
+               return;
+       }
+       
        my $mask_col = $mask->pixel( $path[-2], $path[-1] );
        my $mask_hex = sprintf '%02x%02x%02x', $mask_col->r, $mask_col->g, $mask_col->b;
        warn "mask $path[-2] $path[1] $mask_hex\n";