Date: Jan 6, 2013 2:25 AM
Author: Jennifer Murphy
Subject: Re: Help with algorithm for adjusting RGB colors
On Sat, 5 Jan 2013 21:56:22 +0000, Dr J R Stockton
>In sci.math message <email@example.com>, Fri, 4
>Jan 2013 15:08:19, Jennifer Murphy <JenMurphy@jm.invalid> posted:
>>I have a little Word macro that will assign a random color from the
>>entire 16M color palette to each letter in a text string. It does this
>>by selecting a random number on (0,255) for each of the RGB colors.
>I believe that Rnd() returns a number X of type Single such that 0 <= X
>< 1.0. A Single is essentially a 24-bit value, and is therefore only
>just sufficient to cover the *entire* palette. Therefore the quoted
>assertion can be true, but only if everything else is done either
>properly or near enough so not to matter. Your part appeared
>satisfactory, but the assertion does rely on the nature and quality of
>the implementation of Rnd().
Jeez. Is it a full moon or something? ;-)
If you must be terminally literal, you really should note that I didn't
say that my macro "covered" the entire palette. I said it selected
*from* the entire 16M color palette.
In any case, my macro absolutely does "cover" the entire palette with
lots of number space to spare. If you had actually read and comprehended
the code, you would have seen that it generates three random numbers,
each of which are then converted to an integer from 0-255. I'm pretty
sure that "a single" has enough resolution to "cover" all 256 numbers.
These three numbers are then combined by the RGB function into an
integer on 0-16M.
RGB(R,G,B) = R*256^2 + G*256 + B
>A modern machine is easily fast enough to check hoe many calls of Rnd()
>are necessary until it repeats, and whether is has a regular cycle.
>The answer to the question you actually asked, about the visual
>appearance, is that much depends on the quality of your "graphics card",
>your display hardware, and your eyes.
This reminds me of the old joke about the helicopter tour pilot in
Seattle. The pilot was lost in the dense fog and running out of gas.
Suddenly, he noticed a building poking out of the fog. He maneuvered
close enough to see the people in the office building. He scribbled
something on a piece of paper and held it up to the window. Someone in
the office building scribbled something on another piece of paper and
held it up to their window. The pilot waved and flew to the heliport and
Relieved, the passengers asked the pilot what he asked the office
workers. He said he wrote, "Where am I?". To which they replied, "You're
in a helicopter".
"But how did that help you?", asked the passengers. The pilot said that
he realized that the building had to be on the Microsoft campus, which
gave him the orientation he needed.
"But I still don't understand", said the passengers. The pilot replied,
"The answer, as is typical of computers nerds, was technically accurate,
but totally useless".
My question was whether my algorithm, with the darkening adjustment,
would produce a visually balanced mix of colors and whether there might
be a better way to do that. It had nothing whatsoever to do with with
the graphics card, the display, or my eyes.