note 102762 added to function.imagearc

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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 ...

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
	}
----
Server IP: 69.147.83.197
Probable Submitter: 213.160.28.110
----
Manual Page -- http://www.php.net/manual/en/function.imagearc.php
Edit        -- https://master.php.net/note/edit/102762
Del: integrated  -- https://master.php.net/note/delete/102762/integrated
Del: useless     -- https://master.php.net/note/delete/102762/useless
Del: bad code    -- https://master.php.net/note/delete/102762/bad+code
Del: spam        -- https://master.php.net/note/delete/102762/spam
Del: non-english -- https://master.php.net/note/delete/102762/non-english
Del: in docs     -- https://master.php.net/note/delete/102762/in+docs
Del: other reasons-- https://master.php.net/note/delete/102762
Reject      -- https://master.php.net/note/reject/102762
Search      -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.