Geometrische Objekte
Code:
<?php
$img = @imagecreatetruecolor(350,350);
$black = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
$yellow= imagecolorallocate($img, 255,255, 0);
$corners = array(
0 => 190,
1 => 60,
2 => 210,
3 => 20,
4 => 230,
5 => 60,
);
imagefill($img, 0, 0, $yellow);
imagerectangle($img, 10, 10, 240, 70, $white);
imagefilledrectangle($img, 20, 20, 60, 60, $red);
imagerectangle($img, 20, 20, 60, 60, $black);
imagefilledellipse($img, 90, 40, 40, 40, $blue);
imagefilledellipse($img, 150, 40, 70, 40, $green);
imageellipse($img, 280, 40, 60, 40, $black);
imagefilledpolygon($img, $corners, 3, $white);
imagepolygon($img, $corners, 3, $black);
for ($x=10;$x<340;$x=$x+10){
imagesetpixel($img,$x,5,$black);
}
imageline($img,10,70,240,70,$red);
# Draw a dashed line, 5 red pixels, 5 white pixels
$style = array($red, $red, $red, $red, $red, $white, $white, $white, $white, $white);
imagesetstyle($img, $style);
imageline($img, 10, 80, 340, 80, IMG_COLOR_STYLED);
imagearc($img, 100, 100, 150, 150, 0, 180, $red);
header("Content-type: image/jpeg");
imagejpeg($img);
imagedestroy($img);
?>