Android在接触点下获得颜色

时间:2012-02-27 14:43:11

标签: android image-processing

如何在imageview中获取沙发点下的图像颜色?

到目前为止我有这个代码:

String image_overlay = 
    Environment.getExternalStorageDirectory() + "/" + 
    s(R.string.APP_NAME) + "/overlay.jpg";
String visible_image = 
    Environment.getExternalStorageDirectory() + "/" + 
    s(R.string.APP_NAME) + "/visible.jpg";

ImageView image = (ImageView)findViewById(R.id.visible_image);
Bitmap bm = BitmapFactory.decodeFile(visible_image);
image.setImageBitmap(bm);

ImageView overlayimage = (ImageView)findViewById(R.id.colormap_overlay);
Bitmap bm2 = BitmapFactory.decodeFile(image_overlay);
overlayimage.setAlpha(0);
overlayimage.setImageBitmap(bm2);

final LinearLayout parent = (LinearLayout) findViewById(R.id.pageimageview);
parent.setOnTouchListener(new OnTouchListener() {
  public boolean onTouch(View v, MotionEvent ev) {
    // Get the color of the transparent layer under the touch point here
    // Send an intent with the color to do something based on the color touched
    return true;
  }
});

但我没有看到任何返回颜色的MotionEvent方法。具体来说,我想要透明层的触摸点“颜色”(参见上面的代码)。

0 个答案:

没有答案