On Oct 2, 5:56 pm, Zhao Lin <[email protected]> wrote:
> Hi Java people
>
> Please help me.
>
> public synchronized int getRGB() {
> return ((red << 16) | (green << 8) | blue);
> }
>
> I do not understand how this or | works to return which value? Please help.
> Thank you.
Each color may be approximated for human beings with a combination of
the three red, blue, green colors.
On graphical displays, each of those colors may be represented by a 8-
bit unsigned integer.
Then to obtain a given variant of red, you may shift the RED color by
a given amount of bit.
The same for green and the same for blue, eventually.
Then you combine those particular colors or'ing them to compose the
resulting color.
An excellent article on Wikipedia on this:
http://en.wikipedia.org/wiki/RGB_color_model
and the Color class in Java:
http://java.sun.com/javase/6/docs/api/java/awt/Color.html#red
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---