Dynamic colouring of areas of image

  • Thread starter Thread starter hvj
  • Start date Start date
H

hvj

Hi all,

Could the following be accomplished?


I have a image of a map of the world as the background image of a
form. The borders between countries are black lines. The countries
have no fill colour, the are white. Dependent on some data about a
countries I determine the fill colour of a country, say green. Is
there a way I can specify a coordinate one my image and have the area
(i.e. the country) in which that coordinate lies filled green? To
make
this work the area that is surrounded by black lines must be
recognized by the software as a closed shape, which is not trivial I
think. I have hopes that somewhere in .NET there is some pattern
recognition algorithm that does this trick for me.


Otherwise I probably will have to do a lot work defining all the
countries explicitly as polygons,,,,


Help would be very much appreciated!!


Regards,
Henk
 
You can create Regions from GraphicsPath. Then use Graphics.FillRegion. The problem is detecting all those closed line paths and converting them into GraphicsPaths.

If you could explode the world into individual closed line shapes you might be able to scan them one country at a time. Just hire someone to run PhotoShop for a week or so :+> Keep them all the same scale. Then you reassemble the country outlines as individual regions.

You have to create a region from a 2-color image.
http://forums.asp.net/p/1231528/2240411.aspx#2240411




-------- Original Message --------
 
Back
Top