GIDForums  

Go Back   GIDForums > Computer Programming Forums > .NET Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Apr-2009, 08:12
yummy yummy is offline
New Member
 
Join Date: Apr 2009
Posts: 1
yummy is on a distinguished road
Lightbulb

Grayscale along a gradient


Hi there,

I am using visual C++, using visual studio windows forms.

I have a bitmap which shows different colours which relate to different temperatures ranging from blue(cold) through green yellow orange and finally red (hottest).

How can I make a grayscale function/algorithm to mimick this to grayscale, keeping the linear gradient - so that the greyscale will go from lighter to darker???

The range of grayscales will be important to ensure a reasonably good visual resolution.

Any help, ideas?

Thanks

Yummy

(I believe this is the right forum for this post)
  #2  
Old 15-Apr-2009, 08:50
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 713
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: Grayscale along a gradient


Every shade of gray has the same value for Red, Blue, and Green. So, if you had a scale from 0.0 (Black) to 1.0 (White), you could have a function like:

CPP / C++ / C Code:
// Assuming there is a class called Color who's constructor takes 3 doubles between 0.0 and 1.0 for Red, Blue, and Green

// Scale is a value between 0.0 and 1.0
Color GetGrayScale( double Scale )
{
   return Color(Scale,Scale,Scale);
}
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the pixels' value of a bmp image? (Pelles C) Soundzz C++ Forum 51 29-Jun-2009 08:53
BMP image on matrix load nemo C++ Forum 21 18-Dec-2007 00:04

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:33.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.