From d91e670155aec1deaf3694d0f1e10f928c217660 Mon Sep 17 00:00:00 2001 From: vinot Date: Thu, 3 Jul 2003 14:33:08 +0000 Subject: correction bugs --- Perl/Zinc/Graphics.pm | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'Perl/Zinc') diff --git a/Perl/Zinc/Graphics.pm b/Perl/Zinc/Graphics.pm index 3db1b38..7eaf606 100644 --- a/Perl/Zinc/Graphics.pm +++ b/Perl/Zinc/Graphics.pm @@ -143,7 +143,8 @@ sub buildZincItem { if ($style->{'-contours'}) { my @contours = @{$style->{'-contours'}}; my $numcontours = scalar(@contours); - for (my $i = 0; $i < $numcontours; $i++) { + my $i; + for ($i = 0; $i < $numcontours; $i++) { # radius et corners peuvent être défini spécifiquement pour chaque contour my ($type, $way, $coords, $radius, $corners, $corners_radius) = @{$contours[$i]}; $radius = $style->{'-radius'} if (!defined $radius); @@ -338,7 +339,8 @@ sub roundedRectangleCoords { [[$xn, $y2],[$xn, $y1, 'c'],[$x4, $y0, 'c'],[$x3, $y0],]); my @pts = (); - for (my $i = 0; $i < 4; $i++) { + my $i; + for ($i = 0; $i < 4; $i++) { if ($corners->[$i]) { push(@pts, @{$roundeds[$i]}); @@ -429,7 +431,8 @@ sub polygonCoords { my @pts; # points du polygone - for (my $i = 0; $i < $numsides; $i++) { + my $i; + for ($i = 0; $i < $numsides; $i++) { my ($xp, $yp) = &rad_point($cx, $cy, $radius, $startangle + ($anglestep*$i)); push(@pts, ([$xp, $yp])); @@ -650,7 +653,8 @@ sub pathLineCoords { my $next = $coords->[1]; $linewidth /= 2 if ($shifting eq 'both'); - for (my $i = 0; $i < $numfaces; $i++) { + my $i; + for ($i = 0; $i < $numfaces; $i++) { my $pt = $coords->[$i]; if (!$previous) { @@ -951,8 +955,9 @@ sub tabBoxCoords { ($anchor eq 'w' and $alignment ne 'right')) { if (ref($len) eq 'ARRAY') { - for (my $i = 0; $i < $numpages; $i++) { - $len->[$i] *= -1; + my $p; + for ($p = 0; $p < $numpages; $p++) { + $len->[$p] *= -1; } } else { $len *= -1; @@ -999,8 +1004,8 @@ sub tabBoxCoords { $inverse = (($anchor eq 'n' and $alignment ne 'right') or ($anchor eq 's' and $alignment eq 'right')); } - - for (my $i = 0; $i < $numpages; $i++) { + my $i; + for ($i = 0; $i < $numpages; $i++) { my @pts = (); # décrochage onglet @@ -1026,7 +1031,7 @@ sub tabBoxCoords { @{$curvepts} = reverse @{$curvepts} if ($inverse); push (@shapes, $curvepts); } else { - reverse @pts if ($inverse); + @pts = reverse @pts if ($inverse); push (@shapes, \@pts); } @@ -1195,6 +1200,8 @@ sub pathGraduate { my $type = $style->{'-type'}; my $triangles_colors; + my $i; + if ($type eq 'linear') { return &createGraduate($zinc, $numcolors, $style->{'-colors'}, 2); @@ -1202,7 +1209,7 @@ sub pathGraduate { my $colors1 = &createGraduate($zinc, $numcolors/2+1, $style->{'-colors'}->[0]); my $colors2 = &createGraduate($zinc, $numcolors/2+1, $style->{'-colors'}->[1]); my @colors; - for (my $i = 0; $i <= $numcolors; $i++) { + for ($i = 0; $i <= $numcolors; $i++) { push(@colors, ($colors1->[$i], $colors2->[$i])); } @@ -1211,7 +1218,7 @@ sub pathGraduate { } elsif ($type eq 'transversal') { my ($c1, $c2) = @{$style->{'-colors'}}; my @colors = ($c1, $c2); - for (my $i = 0; $i < $numcolors; $i++) { + for ($i = 0; $i < $numcolors; $i++) { push(@colors, ($c1, $c2)); } @@ -1237,19 +1244,19 @@ sub createGraduate { } my $steps = ($numgraduates > 1) ? $totalsteps/($numgraduates -1) : $totalsteps; - - for (my $c = 0; $c < $numgraduates; $c++) { + my ($c, $k); + for ($c = 0; $c < $numgraduates; $c++) { my ($c1, $c2) = ($refcolors->[$c], $refcolors->[$c+1]); - for (my $i = 0 ; $i < $steps ; $i++) { + for ($i = 0 ; $i < $steps ; $i++) { my $color = computeColor($widget, $c1, $c2, $i/($steps-1)); - for (my $k = 0; $k < $repeat; $k++) { + for ($k = 0; $k < $repeat; $k++) { push (@colors, $color); } } if ($c < $numgraduates - 1) { - for (my $k = 0; $k < $repeat; $k++) { + for ($k = 0; $k < $repeat; $k++) { pop @colors; } } -- cgit v1.1