<?php
$bgr = 0;
$bgg = 0;
$bgb = 0;
if ($_GET['r']) $bgr = $_GET['r'];
if ($_GET['g']) $bgg = $_GET['g'];
if ($_GET['b']) $bgb = $_GET['b'];
$image = imagecreatetruecolor(302, 301);
$sphere = imagecreatefrompng("sphere.png");
do {
	$red = rand(0, 255);
	$green = rand(0, 255);
	$blue = rand(0, 255);
} while (abs($red - $green) < 80 && abs($green - $blue) < 80 && abs($blue - $red) < 80);
$color = imagecolorallocate($image, $red, $green, $blue);
$bg = imagecolorallocate($image, $bgr, $bgg, $bgb);
imagefill($image, 100, 100, $bg);
imagearc($image, 150, 150, 300, 300, 0, 360, $color);
imagefill($image, 100, 100, $color);
imageantialias($image, true);
imagecopy($image, $sphere, 1, 1, 0, 0, 302, 301);
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
