|
|
 |
Re: FN-FORUM the operator >>
date posted 15th January 2002 15:50
i've got some vague idea...does that mean each operation filters out the some segments of the binary digits?
marco
----Original Message Follows----
From: Ed Cole [EMAIL REMOVED]
Reply-To: [EMAIL REMOVED]
To: [EMAIL REMOVED]
Subject: Re: FN-FORUM the operator >>
Date: Tue, 15 Jan 2002 13:52:08 +0000
No java jockey, but this looks like binary shift operator
of other languages. i.e. return the vaule of colorval
shifted right x bits (towards least significant bit)
then binary AND with 0xff = binary 11111111 to gate out
anything that might have shifed in from the most
significant bit.
So this code here takes the 3 byte RGB number for color
and splits it into three integer components one for each
color, by shifting it 16 bits, 8 bits and zero bits ANDing
the results with 11111111
i.e. msb lsb
if
| |
colour = 0xrrggbb in hex or rrrrrrrr,gggggggg,bbbbbbbb in binary
then
hex Binary
r = 0xrr rrrrrrrr
g = 0xgg gggggggg
b = 0xbb bbbbbbbb
Hope this is clear.
marco polo wrote:
>hi there,
>
>i don't know where to ask this question in java newsgroups and i
>hope
>this mailing list will help.
>
>i'm a java newbie and have frequently come across codes like this:
>
>int r=(colorval >> 16) & 0xff;
>
>int g=(colorval >> 8) & 0xff;
>
>int b= colorval & 0xff;
>
>can anybody here explain how this operator work?
>
>marco
>
>
>------------------------------------------------------------------------
>Send and receive Hotmail on your mobile device: Click Here
>
>============================================================ * Free
>listing for freelancers * Free to advertise jobs * Free jobs
>distribution service * Free database of 5000 freelancers Freelancers
>and
>Freelance Jobs: http://www.freelancers.net Forum FAQs:
>http://freelancers.netrickery.com To unsubscribe please email:
[EMAIL REMOVED] If you
>have
>difficulties unsubscribing please email: [EMAIL REMOVED]
============================================================
* Free listing for freelancers
* Free to advertise jobs
* Free jobs distribution service
* Free database of 5000 freelancers
Freelancers and Freelance Jobs:
http://www.freelancers.net
Forum FAQs:
http://freelancers.netrickery.com
To unsubscribe please email:
[EMAIL REMOVED]
If you have difficulties unsubscribing please email:
[EMAIL REMOVED]
MSN Photos is the easiest way to share and print your photos: Click Here
|
 |
|