Break RGB Colours

Hello, i'm working with pixels, and i used the function getRGB from the class BufferedImage to get the value of the pixel.
Is there anyway to break the value that the function returns into 3new values: Red, Green and Blue?
Thanks.
[248 byte] By [YaKa] at [2007-11-20 8:12:50]
# 1 Re: Break RGB Colours
getRGB() returns an int with which, you can create a Color instance. Then you can ask the red green and blue from that Color instance.
Londbrok at 2007-11-10 2:15:33 >
# 2 Re: Break RGB Colours
Hi. Suppose rgb is the int returned by .getRGB() method. In order to retrieve each coordinate of the rgb space do the following:

int r = (rgb >> 16) & 0xFF;
int g = (rgb >> 8) & 0xFF;
int b = rgb & 0xFF;


:wave:
yiannakop at 2007-11-10 2:16:33 >