note 52464 added to function.imageline

From: Date: Mon, 02 May 2005 18:50:27 +0000
Subject: note 52464 added to function.imageline
Groups: php.notes 
Request: Send a blank email to php-notes+get-88869@lists.php.net to get a copy of this message
// Here's a function for drawing a rotated gradient Rectangle (based on a previous note) // Create An Image 255x255 $img = ImageCreateTrueColor(255, 255); GradientRect($img,50,50,80,80,30); ImagePng($img,"test.png"); ImageDestroy($img); echo "<br><img src=\"test.png\">"; function GradientRect($img, $x1, $y1, $x2, $y2, $wdt) { $alpha = atan2($y2-$y1,$x2-$x1); $real_wdt = $wdt*sin($alpha); $real_hgt = $wdt*cos($alpha); echo "real wdt:".$real_wdt; echo "<br>real hgt:".$real_hgt; echo "<br>angle: ".($angle*180/pi()); $plotD = 0; $i=0; $dy = $real_hgt/$wdt; $dx = $real_wdt/$wdt; $drgb= 256/$wdt; while($i++ < $wdt) { // Draw a line and move it down and make it lighter to get the gradient effect ImageLine($img, $x1-$i*$dx, $y1+$i*$dy, $x2-$i*$dx, $y2+$i*$dy, ImageColorAllocate($img, $i*$drgb, 0, 0)); ImageLine($img, $x1-$i*$dx+1, $y1+$i*$dy, $x2-$i*$dx+1, $y2+$i*$dy, ImageColorAllocate($img, $i*$drgb, 0, 0)); } } ---- Manual Page -- http://www.php.net/manual/en/function.imageline.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52464 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52464&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52464&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52464&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52464&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52464&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52464&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88869) next »