Android Question Finding a colour on the screen

AlexOfOz

Active Member
Licensed User
Longtime User
Is there a way I can get the colour that is on the screen?
I am showing a photo in an imageview and want to be able to identify the colour at any spot on that photo.

Thanks.
Alex
 
If the image is a Bitmap you could use the Bitmap.GetPixel method.
Place a Transparent Panel over the image and use Touch Event to get the co-ordinates .
Just be sure the panel is resized to match image size.

Code: Copy
Private Sub Panel1_Touch (Action As Int, X As Float, Y As Float)
    GetPixelColour(X, Y)
End Sub

Private Sub GetPixelColour(x As Int, y As Int)
    Dim pixel As Int = bmpTestImage.GetPixel(x, y)
    Label1.Color = pixel
    '............

There is more info availiable ... Search Results


A basic example is attached ...
 

Attachments

Upvote 0
If the image is a Bitmap you could use the Bitmap.GetPixel method.
Place a Transparent Panel over the image and use Touch Event to get the co-ordinates .
Just be sure the panel is resized to match image size.

Code: Copy
Private Sub Panel1_Touch (Action As Int, X As Float, Y As Float)
    GetPixelColour(X, Y)
End Sub

Private Sub GetPixelColour(x As Int, y As Int)
    Dim pixel As Int = bmpTestImage.GetPixel(x, y)
    Label1.Color = pixel
    '............

There is more info availiable ... Search Results


A basic example is attached ...
Thank-you very much. I expected there would be a way, and now I know.

Alex
 
Upvote 0
Back
Top