如何检测的图像的至极部分已被触摸,当图像旋转? [英] How to detect wich part of an image has been touched, when image is rotated?

查看:188
本文介绍了如何检测的图像的至极部分已被触摸,当图像旋转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有像这样的图像。我可以用旋转<一个href=\"http://stackoverflow.com/questions/4414819/android-rotating-an-imageview-with-finger-moves-other-views-around\">this code 。现在,我想知道,哪种颜色有所触动,独立车轮的位置。例如,无论以下职位的车轮是,我应该能够探测到什么颜色我都感动......红色,黄色,绿色,蓝色,粉红色或灰色。可能吗?我该怎么办呢?请帮助我,因为我不知道。是否有任何其他的可能性,而不是使用一个单一的照片吗?(解决方案,我想preFER避免...)

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.

推荐答案

德code的X&放大器;触摸事件的y位置然后调用getPixel的位图:
http://developer.android.com/reference/android/graphics/Bitmap.html

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

这篇关于如何检测的图像的至极部分已被触摸,当图像旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆