note 9055 added to ImageArc

From: Date: Fri, 13 Oct 2000 10:38:37 +0000
Subject: note 9055 added to ImageArc
Groups: php.notes 
Request: Send a blank email to php-notes+get-6443@lists.php.net to get a copy of this message
Hello. Here you have a function to fill an arc: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Function a26: drawFilledArc ($image, $diagramWidth, $diagramHeight, $cx, $cy, $lx, $ly, $a1, $a2, $color, $BorderColor) // affichage d'une portion d'un cerc // Param: $image = l'identificateur de l'image genere // $diagramWidth = la longueur de l'image // $diagramHeight = la hauteur de l'image // $cx $cy= le centre de l'arc de cerc // $lx, $ly = les diametres de l'arc de cerc // $a1, $a2 = angles // $color = array with colors // $BorderColor = surrounding color function drawFilledArc ($image, $diagramWidth, $diagramHeight, $cx, $cy, $lx, $ly, $a1, $a2, $color, $BorderColor) { imagearc($image, $cx, $cy, $lx, $ly, $a1, $a2, $BorderColor); $px1 = $cx + ($lx* cos(($a1/180)*pi()) ) /2; $py1 = $cy + ($ly* sin(($a1/180)*pi()) ) /2; $px2 = $cx + ($lx* cos(($a2/180)*pi()) ) / 2; $py2 = $cy + ($ly* sin(($a2/180)*pi()) ) / 2; imageline($image, $cx, $cy, $px1, $py1, $BorderColor); imageline($image, $cx, $cy, $px2, $py2, $BorderColor); $mx = ($px1 + $px2) / 2; $my = ($py1 + $py2) / 2; // imageString($image, 3, 10, $diagramHeight - rand(10,100)*10, "cx=$cx,cy=$cy,px1=$px1,py1=$py1,px2=$px2,py2=$py2,mx=$mx,my=$my", $color); if ( ($a2-$a1 >180) || ($a1-$a2 >180) ) { //oppose to cx, cy $mx = $cx - ($mx - $cx) /2; $my = $cy - ($my - $cy) /2; } else { //sameto cx, cy $mx = $cx + ($mx - $cx) /2; $my = $cy + ($my - $cy) /2; } imagefill($image, $mx, $my, $color); } http://www.php.net/manual/function.imagearc.php

« previous php.notes (#6443) next »