Reputation: 133
I have two images and one goes on top of the other. The bottom one is a floor plan and the above image is the same image but all of the rooms have been coloured in with different colours. The top image is then made invisible. I want to get the colour of the area that was touched so that I know where users want to go.
I don't know if this can be done and if you know of another way to make an area clickable I'd love to hear it.
Upvotes: 1
Views: 900
Reputation: 136
Get pixel from view like this int pixel = bitmap.getPixel(x,y);
Now you can get each value of RGB like: int redValue = Color.red(pixel);
Upvotes: 2
Reputation: 18633
If you have access to the actual image, you can just compute the image coordinates of the pixel that was clicked and read the pixel from the image data, something like Bitmap.getPixel(int,int)
.
An alternative which wouldn't require you to store two images is something akin to an image map, where you'd be storing the polygons for the different regions.
Upvotes: 3