I pretty much
just finished my drawing. I wouldn't consider it finished, though. I still want to improve it as much as I can. For one, I want to try switching the body from an ellipse to two square root modeled curves attached to two line segments. I should probably make the feet a bit bigger. Anyways, what do you think of it?
Code:
<?php
$im = imagecreate(300, 400);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
$orange = imagecolorallocate($im, 0xFD, 0x46, 0x00);
$thick = 10; //Border
//Feet
imageBorderedArc($im, 110, 330, 50, 50, 180, 0, $thick, $black, $white, false); //Left foot
imageBorderedArc($im, 200, 330, 50, 50, 180, 0, $thick, $black, $white, false); //Right foot
//Arms
//imageBorderedEllipse($im, 160, 220, 145, 80, $thick, $black, $white); One ellipse for the arm
imageBorderedEllipse($im, 120, 250, 60, 75, $thick, $black, $white); //Left arm
imageBorderedEllipse($im, 190, 250, 60, 75, $thick, $black, $white); //Right arm
//Body
//Try square root modelled line?
imageBorderedEllipse($im, 155, 260, 100, 165, $thick, $black, $white); //Body
//Antennae
imageThickLine($im, 155, 95, 177, 50, 5, $black, 0); //Head --> Second Antennae
imageThickLine($im, 177, 50, 230, 60, 5, $black); //First Antennae --> Bobble
imageBorderedEllipse($im, 230, 60, 35, 35, $thick, $black, $white); //Bobble
//Head
imageBorderedEllipse($im, 75, 130, 50, 50, $thick, $black, $white); //Left ear
imageBorderedEllipse($im, 235, 130, 50, 50, $thick, $black, $white); //Right ear
imageBorderedEllipse($im, 155, 155, 195, 125, $thick, $black, $white); //Head
imageFilledEllipse($im, 120, 150, 30, 30, $orange); //Left Eye
imageFilledEllipse($im, 195, 150, 30, 30, $orange); //Right Eye
imageBorderedEllipse($im, 160, 190, 80, 20, $thick, $black, $white); //Smile p1
imageFilledRectangle($im, 118, 175, 200, 189, $white); //Smile p2 CHEATING CHEATING CHEATING
//Cleanup
imageFilledRectangle($im, 94, 330, 232, 356, $white);
imageThickLine($im, 86, 330, 224, 330, 3, $black);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
function imageThickLine($image, $x1, $y1, $x2, $y2, $border, $colour, $toRight = -1){
if($y1 == $y2 || $toRight == 1){
for($i = 0; $i <= $border; $i++) imageline($image, $x1, $y1+$i, $x2, $y2+$i, $colour);
}elseif($x1 == $x2 || $toRight == 0){
for($i = 0; $i <= $border; $i++) imageline($image, $x1+$i, $y1, $x2+$i, $y2, $colour);
}else{
for($i = 0; $i <= $border; $i++) imageline($image, $x1+$i, $y1+$i, $x2+$i, $y2+$i, $colour);
}
}
function imageBorderedEllipse($image, $cx, $cy, $width, $height, $border, $borderColor, $fillColor){
imagefilledellipse($image, $cx, $cy, $width, $height, $borderColor);
imagefilledellipse($image, $cx, $cy, $width - $border, $height - $border, $fillColor);
}
function imageBorderedArc($image, $cx, $cy, $width, $height, $start, $end, $border, $borderColor, $fillColor, $fullBorder = true, $bitWise = IMG_ARC_PIE){
imagefilledarc($image, $cx, $cy, $width, $height, $start, $end, $borderColor, $bitWise);
imagefilledarc($image, $cx, $cy, $width-$border, $height-$border, $start, $end, $fillColor, $bitwise);
if($fullBorder){
$border /= 2;
for($i = 0; $i <= $border; $i++) imageline($image, $cx - ($width/2) + 1, $cy + 1 + $i, $cx + ($width/2) - 1, $cy + $i + 1, $borderColor);
}
}
?>