Converting Images to Shapes
Hello,
If I had a monochrome bitmap of the u.k. (including islands etc.) is there a way I can import it into Java and convert it to an object that implements 'shape' or something similar?
So for example, I could tell if the cursor was over any part of the land but not the water. Currently I can only find ways to work with regular shapes.
Thanks for the help - it is appreciated.
Ian
Re: Converting Images to Shapes
I'm not sure there is a way to do this through the java API, so you may need to manually do it. The first possibility that pops into my head is to create several 'masks' of the image (binary type images) from which you can analyze and create a shape from (making the masks could be relatively easy if you have something like photoshop). To create the shapes you can use a variety of algorithms such as marching squares (for speed you may wish to do this once to save the shapes using Serializable from which you can load during runtime).
Re: Converting Images to Shapes