See for working example and code here
Note: this solution is made for libgdx, using Pixmap
Building a 2d strategy game could be useful to draw a world map, divide countries using a specific color and then let user select a country, then highlight it. But how to made this selection without store any information about countries geometry ?
Solution: use flood fill algorithm!
zeer0N1cj_Y
Solution is made with on the following steps:
- get player click point as (x,y)
- from (x,y) use flood fill algorithm to fill a specific area, delimited by border color
- draw a border around the resulting image, not used areas are transparent
- display image with border to the player