I have the integer pixel I got from getRGB(x,y), but I don’t have any clue about how to convert it to RGBA format. For example, -16726016 should be Color(0,200,0,255). Any tips?
I have the integer pixel I got from getRGB(x,y) , but I don’t have
Share
If I’m guessing right, what you get back is an unsigned integer of the form
0xAARRGGBB, sowould extract the color components. However, a quick look at the docs says that you can just do
or
if you want the alpha component in the Color as well.
UPDATE
Red and Blue components are inverted in original answer, so the right answer will be:
updated also in the first piece of code