Board index » cppbuilder » "Cold to hot colors" pallete algorithm

"Cold to hot colors" pallete algorithm

Does anyone know of an algorithm that can return a color based on intensity,
where the "cold" color is blue and the "hot" color is red ? I don't mean a
gradient function from blue to red. As i have noticed, the middle colors are
yellowish - green.

TIA

 

Re:"Cold to hot colors" pallete algorithm


Quote
On Mon, 15 May 2000 18:00:33 +0300, "Pave" <p...@hotmail.com> wrote:
>Does anyone know of an algorithm that can return a color based on intensity,
>where the "cold" color is blue and the "hot" color is red ? I don't mean a
>gradient function from blue to red. As i have noticed, the middle colors are
>yellowish - green.

You mean RGB to HLS (Hue Luminance Saturation). Generally, red is cold
and blue is hotter, magenta is even hotter than blue. Red has a lower
frequency than blue. If you heat something, it starts at red. If you
turn up the heat, it gets purple (violet/magenta) eventually.

You may have a MS helpfile on your harddisk that has the answer. I
think I had it with all BCB version thus far, but anyways, for BCB5
PRO, you go to the Help - MS SDK Help Files in your Start menu. Now
pick the Windows SDK and OLE Knowledge Base. Switch to the Find tab
ans search for the word 'magic'. You'll then see a topic called
'Converting Colors between RGB and HLS (HBS)', which shows you how to
do what you want.

If you don't get it to work in BCB, I have turned it into a BCB5 VCL
component for personal use. Feel free to mail me if you want to
testdrive it...: h...@gmx.net

Hens Zimmerman

Re:"Cold to hot colors" pallete algorithm


Hi, and thanks

Right after i wrote the post, i fiddled around with the color property, and
found that, as you said, that as the Hue increases i get the "hotter"
effect. I openned up the MSDN and found a RGB->HSB function... It seemed
pretty complicated, i thought there was a better way...

Again, Thanks alot for the info!

Re:"Cold to hot colors" pallete algorithm


Quote
"Pave" <p...@hotmail.com> wrote in message news:39200eb4@dnews...
> Does anyone know of an algorithm that can return a color based on
intensity,
> where the "cold" color is blue and the "hot" color is red ? I don't mean a
> gradient function from blue to red. As i have noticed, the middle colors
are
> yellowish - green.

If you saw yellowish-green, you weren't seeing a "gradient" from blue to
red.

Perhaps you saw a "rainbow" that showed the colors as a function of
wavelength -- then you would see yellow and green.  Here's what a
"rainbow" should look like:
http://www.efg2.com/Lab/ScienceandEngineering/Spectra.htm

If you look at the base of the Maxwell triangle, the line from the blue
corner to the red corner is what a blue-red gradient should look like:
http://www.efg2.com/Lab/Graphics/Colors/MaxwellTriangle.htm
Perhaps a blue-red color gradient is really what you want.

In terms of color temperature, red is "cold" and blue is "hot."
Find a "blackbody" color graphic here:
http://www.physics.sfasu.edu/astro/color.html#blackbody

Find other Color Temperature links here:
http://www.efg2.com/Lab/Library/Color.htm
Perhaps the "False Color" links on that page will be useful.

--
efg

Earl F. Glynn     E-mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Re:"Cold to hot colors" pallete algorithm


i build a LUT

for(int cnt=0;cnt<1792;cnt++)
    {
    if (cnt<256)
        {
        LUT[0][cnt]=cnt;
        LUT[1][cnt]=0;
        LUT[2][cnt]=0;
        }
    if ((cnt>=256)&&(cnt<256*2))
        {
        LUT[0][cnt]=255;
        LUT[1][cnt]=cnt-256;
        LUT[2][cnt]=0;
        }
    if ((cnt>=256*2)&&(cnt<256*3))
        {
        LUT[0][cnt]=256*3-cnt-1;
        LUT[1][cnt]=255;
        LUT[2][cnt]=0;
        }
    if ((cnt>=256*3)&&(cnt<256*4))
        {
        LUT[0][cnt]=0;
        LUT[1][cnt]=255;
        LUT[2][cnt]=cnt-256*3;
        }
    if ((cnt>=256*4)&&(cnt<256*5))
        {
        LUT[0][cnt]=0;
        LUT[1][cnt]=256*5-cnt-1;
        LUT[2][cnt]=255;
        }
    if ((cnt>=256*5)&&(cnt<256*6))
        {
        LUT[0][cnt]=cnt-256*5;
        LUT[1][cnt]=0;
        LUT[2][cnt]=255;
        }
    if ((cnt>=256*6)&&(cnt<256*7))
        {
        LUT[0][cnt]=255;
        LUT[1][cnt]=cnt-256*6;
        LUT[2][cnt]=255;
        }
    }

i need this to visualize a large amount of cont. data

Pave schrieb:

Quote
> Does anyone know of an algorithm that can return a color based on intensity,
> where the "cold" color is blue and the "hot" color is red ? I don't mean a
> gradient function from blue to red. As i have noticed, the middle colors are
> yellowish - green.

> TIA

Other Threads