( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$points = shape(7,500);
$points2= translatePolygon($points,10,400);
$points = translatePolygon($points,100,100);
$img_height = 900;
$img_width=800;
$image = imagecreatetruecolor($img_width ,$img_height);
$white = imagecolorallocate($image,255,255,255);
$green = imagecolorallocate($image, 0, 255, 0);
imagefilledrectangle($image, 0, $img_height*8/10, $img_width, $img_height, $green);
imagefill($image,0,0,$white);
$red = imagecolorallocate($image,68,140,200);
$red2 = imagecolorallocate($image,154,154,154);
imagefilledpolygon($image,$points,(count($points)/2),$red);
imagefilledpolygon($image,$points2,(count($points)/2),$red2);
header("Content-type: image/jpeg");
imagejpeg($image);
imagedestroy($image);
function shape($number_of_edges,$radius=100) {
$p = array();
$degrees = 360/$number_of_edges;
for ($i=0;$i<$number_of_edges;$i++) {
$cos = cos(deg2rad($degrees*$i));
$sin = sin(deg2rad($degrees*$i));
$x = 0;
$y = $radius;
$p[] = round($cos*($x) - $sin*($y));
$p[] = round($sin*($x) + $cos*($y));
}
return $p;
}
function translatePolygon($points,$x=0,$y=0) {
for($i=0;$i<count($points);$i+=2) {
$points[$i] = $points[$i] + $x;
$points[$i+1] = $points[$i+1] + $y;
}
return $points;
}
?>
?>