This is a demo I wrote using JavaScript and the Canvas element.
Notice that a star is carved out of a circle. Given an angle, you can find the position of that point on a circle with a radius of 1. Get the x-coordinate with cosine and the y-coordinate with sine. Multiply by your desired radius. Decide how many points you want the star to have. Divide the full angle of a circle (2π) by twice the number of points. Decide on an inner and outer radius for the star, as in how far apart to make the points and how far to go back in. Now, draw lines between the points and use the magical flood fill command.