用户单击图像时获取图像的rgb值

问题描述:

我正在创建地图应用程序。我需要获得RGB用户点击图像时的图像值。 图片是在ImageView用户单击图像时获取图像的rgb值

请帮忙。

+1

-1代表的研究工作并没有什么试穿自己。 – 2012-03-14 11:27:20

+0

@alextsc他今天只加入SO。他需要通过http://*.com/faq – 2012-03-14 11:30:41

int ColorCode = imageView.getDrawingCache().getPixel(x, y); 

//这里的x,y坐标是

这里是一个link

+0

谢谢....但我需要用户点击图像时的rgb值。 – 2012-03-14 11:36:45

+0

您是否检查我提供的链接? – 2012-03-14 11:43:00

+0

我检查....代码是好的,但不是我的目的。在我的应用程序用户点击图像该特定像素的rgb值是需要切换案例。(没有固定的位置和颜色) – 2012-03-14 12:13:37

Bitmap bitmap = ((BitmapDrawable)imageView.getBackground()).getBitmap(); 
int pixel = bitmap.getPixel(xCordinate,yCordinate); 
int redValue = Color.red(pixel); 
int blueValue = Color.blue(pixel); 
int greenValue = Color.green(pixel);