AlexAndro
AlexAndro

Reputation: 1928

How to detect which part of an image has been touched, when image is rotated?

I have an image like this one. I can rotate it using this code. Now I would like to know, which color has been touched, independently of the wheel's position. For example, whatever of the following positions the wheel is in, I should be able to detect what color I have touched ...red, yellow, green,blue,pink or grey.

Is it possible? How can I do it?

Is there any other possibility instead of using a single picture?(solution I would prefer to avoid...)

enter image description here or enter image description here or enter image description here or whatever...

UPDATE: I post some colors because I wanted to be more clear, and I got a solution for this, but how could I do if I have different images instead of a color.

Upvotes: 3

Views: 715

Answers (1)

amb
amb

Reputation: 335

Decode the x & y position of the touch event then call getPixel on the Bitmap: http://developer.android.com/reference/android/graphics/Bitmap.html

Upvotes: 4

Related Questions