note 69212 added to function.imagefilledellipse

From: Date: Sun, 27 Aug 2006 12:57:29 +0000
Subject: note 69212 added to function.imagefilledellipse
Groups: php.notes 
Request: Send a blank email to php-notes+get-116384@lists.php.net to get a copy of this message
I quickly made a gradient ellipse function (i took some code from other gradient functions). It works like imageellipse or imagefilledellipse but with two color parameters: $ic is the inner color of the gradient ellipse and $oc is the outer color. <?php function imagegradientellipse($image, $cx, $cy, $w, $h, $ic, $oc){ $w = abs($w); $h = abs($h); $oc = array(0xFF & ($oc >> 0x10), 0xFF & ($oc >> 0x8), 0xFF & $oc); $ic = array(0xFF & ($ic >> 0x10), 0xFF & ($ic >> 0x8), 0xFF & $ic); $c0 = ($oc[0] - $ic[0]) / $w; $c1 = ($oc[1] - $ic[1]) / $w; $c2 = ($oc[2] - $ic[2]) / $w; $i = 0; $j = 0; $is = ($w<$h)?($w/$h):1; $js = ($h<$w)?($h/$w):1; while(1){ $r = $oc[0] - floor($i * $c0); $g = $oc[1] - floor($i * $c1); $b = $oc[2] - floor($i * $c2); $c = imagecolorallocate($image, $r, $g, $b); imagefilledellipse($image, $cx, $cy, $w-$i, $h-$j, $c); if($i < $w){ $i += $is; } if($j < $h){ $j += $js; } if($i >= $w && $j >= $h){ break; } } } ?> ---- Server IP: 217.13.201.10 Probable Submitter: 84.143.201.81 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.imagefilledellipse.php Edit -- https://master.php.net/note/edit/69212 Del: integrated -- https://master.php.net/note/delete/69212/integrated Del: useless -- https://master.php.net/note/delete/69212/useless Del: bad code -- https://master.php.net/note/delete/69212/bad+code Del: spam -- https://master.php.net/note/delete/69212/spam Del: non-english -- https://master.php.net/note/delete/69212/non-english Del: in docs -- https://master.php.net/note/delete/69212/in+docs Del: other reasons-- https://master.php.net/note/delete/69212 Reject -- https://master.php.net/note/reject/69212 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116384) next »