note 102762 deleted from function.imagearc by cmb

From: Date: Fri, 15 Jul 2016 17:26:56 +0000
Subject: note 102762 deleted from function.imagearc by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206032@lists.php.net to get a copy of this message
Note Submitter: Michael ---- Hi, this is a function that replaces "imagearc" to solve the thickness-problem. it does not use the global value set by imagesetthickness, so you have to pass it along. "connecting" the arc to lines is still a problem, it sometimes shifts by 1px, but so does the original function. Theres still alot to improve ... <?php function myimagearc($im,$mid_x,$mid_y,$rad,$w1,$w2,$col,$thickness){ global $cols; $rad+=$thickness/2; // to calculate outer edge $th_fact = 1-((($thickness-1)/$rad)); $pts = 36*$rad; // adjust density $fact = $pts/360; $w1 = $w1*$fact; $w2 = $w2*$fact; if($thickness > 2) // to make sure we have neither gaps nor ugly looking artefacts imagesetthickness($handle,2); else imagesetthickness($handle,1); $winkel = (2*pi())/$pts; for($i=$w1+1;$i< $w2;$i++){ $x = (cos($i*$winkel)*($rad)); $y = (sin($i*$winkel)*($rad)); $x1 = $x+$mid_x; $y1 = $y+$mid_y; $x2 = $th_fact*$x+$mid_x; $y2 = $th_fact*$y+$mid_y; imageline($im, $x1,$y1,$x2,$y2,$col); } imagesetthickness($handle,1); // just to reset } ?>

« previous php.notes (#206032) next »