Voting

: min(six, nine)?
(Example: nine)

The Note You're Voting On

Tyron
20 years ago
// 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));

}
}

<< Back to user notes page

To Top