Do you mean the conversion of binary to decimal?

>From RIGHT to LEFT, each binary digit (bit) ON position represents a power
of 2, starting with 0. And bits are generally represented in bytes - eight
bits each. Thus a byte's max value is 255 - all bits ON.

A dark blue, 0,0,0,51 (alpha,red,green,blue channels)is
00000000,00000000,00000000,00110011 in bits.

The 00110011 represents (from RIGHT to LEFT, remember)
(1 * 2^0) + (1 * 2^1) + (1 * 2^4) + (1 * 2^5) = 51

Or to cut out all the bit nonsense.
32 bit number = blue + (green * 256) + (red * 65536) + (alpha * 16777216)




-----Original Message-----
From: Rick Root [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 12, 2006 2:40 PM
To: CF-Talk
Subject: Struggling with math!


I've been trying to do a freakin' blur all day long and i'm having some
trouble with math conversions.

Java stores RGB values in an image as a 32 bit integer, containing the
alpha, red, green, and blue values in each 8 bits.

In my world, the alpha is always non-transparent, ie 255...

For example...

255,255,0,0 = a red pixel
255,255,255,0 = a yellow pixel
255,0,0,255 = a white pixel.

The problem is I'm having trouble grasping conversion between 4 sets of
8 bit numbers and a 32 bit number.


I know it involves bit shifting and stuff like that but .. I'm just not
getting it.

Could someone explain it to me like I'm a 6 year old?  (apologiez to
Denzel Washington for that)

Rick



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263831
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to