note 98191 added to function.imageline

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Function drawing of a line by a brush uses midpoint circle algorithm..., if dullness I agree to remove :))) 

<?php
//function drawLine(resource$image,int $x0,int $y0,int $x1,int $y1,int $lineWidth,int $color)
function drawLine($image,$x0, $y0,$x1, $y1,$radius,$color)
{
  $f = 1 - $radius;
  $ddF_x= 1;
  $ddF_y = -2 * $radius;
  $x= 0;
  $y = $radius;
	imageline($image,$x0, $y0 + $radius,$x1, $y1 + $radius,$color);
 	imageline($image,$x0, $y0 - $radius,$x1, $y1 - $radius,$color);
	imageline($image,$x0 + $radius, $y0,$x1 + $radius, $y1,$color);
	imageline($image,$x0 - $radius, $y0,$x1 - $radius, $y1,$color);

  while($x< $y)
  {
    if($f >= 0)
    {
      $y--;
      $ddF_y += 2;
      $f += $ddF_y;
    }
    $x++;
    $ddF_x+= 2;
    $f += $ddF_x;
	imageline($image,$x0 + $x, $y0 + $y,$x1 + $x, $y1+ $y,$color);
   	imageline($image,$x0 - $x, $y0 + $y,$x1 - $x, $y1 + $y,$color);
   	imageline($image,$x0 + $x, $y0 - $y,$x1 + $x, $y1 - $y,$color);
   	imageline($image,$x0 - $x, $y0 - $y,$x1 - $x, $y1 - $y,$color);
   	imageline($image,$x0 + $y, $y0 + $x,$x1 + $y, $y1 + $x,$color);
   	imageline($image,$x0 - $y, $y0 + $x,$x1 - $y, $y1 + $x,$color);
   	imageline($image,$x0 + $y, $y0 - $x,$x1 + $y, $y1 - $x,$color);
   	imageline($image,$x0 - $y, $y0 - $x,$x1 - $y, $y1 - $x,$color);

  }
}
header ('Content-type: image/png');
$img = imagecreatetruecolor(600,600);
$col = imagecolorallocate($img,0,255,252);
//use the function
rasterCircle($img,50, 50,540,540,40,$col);
imagepng($img);
imagedestroy($img);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 90.191.203.99
----
Manual Page -- http://www.php.net/manual/en/function.imageline.php
Edit        -- https://master.php.net/note/edit/98191
Del: integrated  -- https://master.php.net/note/delete/98191/integrated
Del: useless     -- https://master.php.net/note/delete/98191/useless
Del: bad code    -- https://master.php.net/note/delete/98191/bad+code
Del: spam        -- https://master.php.net/note/delete/98191/spam
Del: non-english -- https://master.php.net/note/delete/98191/non-english
Del: in docs     -- https://master.php.net/note/delete/98191/in+docs
Del: other reasons-- https://master.php.net/note/delete/98191
Reject      -- https://master.php.net/note/reject/98191
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.