You are here: Re: Any Intelligent Thoughts On This? « All PHP « IT news, forums, messages
Re: Any Intelligent Thoughts On This?

Posted by Onideus Mad Hatter on 01/16/07 23:11

On 13 Jan 2007 03:48:29 GMT, jasen <jasen@free.net.nz> wrote:

>On 2007-01-12, Onideus Mad Hatter <usenet@backwater-productions.net> wrote:
>> On 12 Jan 2007 02:26:05 -0800, sl@f0r7r355.org wrote:
>
>> ...wow...even Wikipedia FAILS to explain it with anything other than
>> the most simplistic glazing jive of redundant incoherency. Tsch,
>> tsch, tsch...a simple formula/equation is just TOO MUCH to ask
>> apparently. Oh how the mighty web has fallen.
>>
>
>Binary RGB:
>
> RGB colours are represented in the low 24 bits of a 32-bit number
>
> 8bits for red
> 8bits for green
> 8bits for blue
>
> to convert 8-bit unsigned (0..255) R,G, and B values to an RGB value
> you need to shift the red 16 bits and the green 8 bits to the left
>
> this means multiplying red by 65536 and green by 256 and then adding
> them all up.
>
>one easy way to do this is to write them in hex.

So let's use the base numbers:
13
162
189

The formula you just gave: (r * 65536)+(g * 256)

The formula you gave before:
var rgb : String = "0x" + ((r*256+g)*256+b).toString(16);

In the first we get:
(13 * 65536)+(162 * 256) = 893440

In the second we get:
(13*256+162)*256+189 = 893629

Convert the two to hex:
0DA200
0DA2BD

And then convert the two digit hex codes back to decimal:
13,162,0
13,162,189

Ahhh, I see where you failed, you forgot to mention that you needed to
ADD the blue. So the formula should ACTUALLY be:
(r * 65536)+(g * 256)+b
or you can alternatively write it as:
(r*256+g)*256+b

So that's good, we have a formula now...we're still missing the
EXPLANATION however. You said:

> to convert 8-bit unsigned (0..255) R,G, and B values to an RGB value
> you need to shift the red 16 bits and the green 8 bits to the left

....but what you don't say is WHY. What ~exactly~ is the correlation
between the two? I mean I understand RGB, each represents a base
additive color with a range between 0 and 255. But what EXACTLY are
these multiplied values in relation to their original RGB values? Is
it just mathematical parlor tricks to shorten the amount of bits that
represent each color or is there some ACTUAL meaning behind the
numbers?

--

Onideus Mad Hatter
mhm ¹ x ¹
http://www.backwater-productions.net
http://www.backwater-productions.net/hatter-blog


Hatter Quotes
-------------
"You're only one of the best if you're striving to become one of the
best."

"I didn't make reality, Sunshine, I just verbally bitch slapped you
with it."

"I'm not a professional, I'm an artist."

"Your Usenet blinders are my best friend."

"Usenet Filters - Learn to shut yourself the fuck up!"

"Drugs killed Jesus you know...oh wait, no, that was the Jews, my
bad."

"There are clingy things in the grass...burrs 'n such...mmmm..."

"The more I learn the more I'm killing my idols."

"Is it wrong to incur and then use the hate ridden, vengeful stupidity
of complete strangers in random Usenet froups to further my art?"

"Freedom is only a concept, like race it's merely a social construct
that doesn't really exist outside of your ability to convince others
of its relevancy."

"Next time slow up a lil, then maybe you won't jump the gun and start
creamin yer panties before it's time to pop the champagne proper."

"Reality is directly proportionate to how creative you are."

"People are pretty fucking high on themselves if they think that
they're just born with a soul. *snicker*...yeah, like they're just
givin em out for free."

"Quible, quible said the Hare. Quite a lot of quibling...everywhere.
So the Hare took a long stare and decided at best, to leave the rest,
to their merry little mess."

"There's a difference between 'bad' and 'so earth shatteringly
horrible it makes the angels scream in terror as they violently rip
their heads off, their blood spraying into the faces of a thousand
sweet innocent horrified children, who will forever have the terrible
images burned into their tiny little minds'."

"How sad that you're such a poor judge of style that you can't even
properly gauge the artistic worth of your own efforts."

"Those who record history are those who control history."

"I am the living embodiment of hell itself in all its tormentive rage,
endless suffering, unfathomable pain and unending horror...but you
don't get sent to me...I come for you."

"Ideally in a fight I'd want a BGM-109A with a W80 250 kiloton
tactical thermonuclear fusion based war head."

"Tell me, would you describe yourself more as a process or a
function?"

"Apparently this group has got the market cornered on stupid.
Intelligence is down 137 points across the board and the forecast
indicates an increase in Webtv users."

"Is my .sig delimiter broken? Really? You're sure? Awww,
gee...that's too bad...for YOU!" `, )

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация