Idk if this is a good place to ask, but how would i cut out a shape like this http://i1094.photobucket.com/albums/i442/kiavoldemort/Coal-1.png from another image?
Two ways, I can immediately come up with:
(1) Either make all the interior (preferred), or all the exerior a specific color, and then for each pixel, if it is (or is not) that color, change the color of the current pixel inside to the color of the same pixel in the other image.
(2) refer to Clipping images
The easiest way is to have an initial integer for the number of points and then either (1) all the x-coordinates followed by all the y-coordinates, or (2) alternate x-coordinate and y-coordinate for each point in the polygon.
This way, when reading the file back, after the first integer is read back in, it can be used to determine how many more integer values need to be read back in for the polygon coodinates.
There is a Polygon class, which is a subset of the Shape class, that has all of your polygon functionality built in. Shapes are also compatible with Graphics2D, making it easy to draw polygons of your own.