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

点点圈 提交于 2019-12-10 18:30:13

问题


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? Please help me, because I have no idea. Is there any other possibility instead of using a single picture?(solution I would prefer to avoid...)

or

or

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.


回答1:


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



来源:https://stackoverflow.com/questions/10933130/how-to-detect-wich-part-of-an-image-has-been-touched-when-image-is-rotated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!