note 105038 modified in function.imageline by danbrown

From: Date: Mon, 25 Jul 2011 12:27:06 +0000
Subject: note 105038 modified in function.imageline by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181829@lists.php.net to get a copy of this message
The most bold-line-functions i found have problems with lines in a certian direction (they draw smaller lines with some angles). To do a real bold line just use this function: <?php function imageBoldLine($resource, $x1, $y1, $x2, $y2, $Color, $BoldNess=2, $func='imageLine') { $center = round($BoldNess/2); for($i=0;$i<$BoldNess;$i++) { $a = $center-$i; if($a<0){$a -= $a;} for($j=0;$j<$BoldNess;$j++) { $b = $center-$j; if($b<0){$b -= $b;} $c = sqrt($a*$a + $b*$b); if($c<=$BoldNess) { $func($resource, $x1 +$i, $y1+$j, $x2 +$i, $y2+$j, $Color); } } } } ?> --was-- The most bold-line-functions i found have problems with lines in a certian direction (they draw smaller lines with some angles). To do a real bold line just use this function: function imageBoldLine($resource, $x1, $y1, $x2, $y2, $Color, $BoldNess=2, $func='imageLine') { $center = round($BoldNess/2); for($i=0;$i<$BoldNess;$i++) { $a = $center-$i; if($a<0){$a -= $a;} for($j=0;$j<$BoldNess;$j++) { $b = $center-$j; if($b<0){$b -= $b;} $c = sqrt($a*$a + $b*$b); if($c<=$BoldNess) { $func($resource, $x1 +$i, $y1+$j, $x2 +$i, $y2+$j, $Color); } } } } http://php.net/manual/en/function.imageline.php

« previous php.notes (#181829) next »