0

I am using the following example to get the pixels at the exact location that it is touched: http://android-er.blogspot.com/2013/08/get-bitmap-color-on-touched-position-in.html. What I am trying to do is also get the current RGB values individually so I am able to store them in a SQLite database table. So it would be once the correct color is selected using the onTouchListener then I would want to save those current values. Could anyone point me in the right direction?

tobes
  • 124
  • 1
  • 10
  • What **exactly** is the question? – Simon Nov 12 '14 at 20:36
  • I want to know how to get the current red, green, and blue values where the color is selected on the image and then be able to store those values. I really just need to know how to do the first part. – tobes Nov 12 '14 at 20:39

1 Answers1

2

There are special methods for that in Color class: android Bitmap getPixel

Pixel color is returned by getProjectedColor() in your code.

I think you also could get RGB parts by plain bitwise operations, such as

color = getProjectedColor(....);
red = (color >> 16) & 0xFF; 
green = (color >> 8) & 0xFF;
blue = (color >> 0) & 0xFF;
Community
  • 1
  • 1
Mixaz
  • 4,068
  • 1
  • 29
  • 55