function star_polygon ($radius, $points, $skip, $color
{
// blank image
$image = image_create_alpha$radius*2+4, $radius*2+4);
// create the color
$r = hexdecsubstr$color, 0, 2));
$g = hexdecsubstr$color, 2, 2));
$b = hexdecsubstr$color, 4, 2));
$color = imagecolorallocate$image, $r, $g, $b);
// The fudge factor is only used to rotate the star so its points line
// up at the bottom.
if (($points%2)==0) {
if (($points/2%2)==0) {
$fudge = pi()*1/$points
} else {
$fudge = 0;
}
} else {
if ((($points-1)/2%2)==0) {
$fudge = pi()*1.5/$points
} else {
$fudge = pi()*0.5/$points
}
}
$xy = array();
// for the number of points...
for ($i=0; $i$points; $i++) {
// compute a point on the perimeter $i/$points from the beginning
$x = round$radiuscos(2*pi()*$i$points$fudge)+$radius+2);
$y = round$radiussin(2*pi()*$i$points$fudge)+$radius+2);
$xy[]=array$x$y);
}
for ($from=0; $fromcount$xy); $from++) {
// where to draw the line to
$to = ($from$skip+1) % (count$xy));
// draw the line
imageline$image, $xy$from][0], $xy$from][1], $xy$to][0], $xy$to][1], $color);
}
return $image
}