Click here to Skip to main content
15,908,115 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I display current time in dialog static control Pin
SandipG 5-Jun-08 23:40
SandipG 5-Jun-08 23:40 
QuestionRe: How can I display current time in dialog static control Pin
Maximilien5-Jun-08 7:45
Maximilien5-Jun-08 7:45 
AnswerRe: How can I display current time in dialog static control Pin
amistry_petlad5-Jun-08 7:51
amistry_petlad5-Jun-08 7:51 
QuestionRe: How can I display current time in dialog static control Pin
messages5-Jun-08 5:35
messages5-Jun-08 5:35 
AnswerRe: How can I display current time in dialog static control Pin
amistry_petlad5-Jun-08 7:53
amistry_petlad5-Jun-08 7:53 
GeneralRe: How can I display current time in dialog static control Pin
Hamid_RT6-Jun-08 1:13
Hamid_RT6-Jun-08 1:13 
QuestionConvert to BW Pin
vandana75-Jun-08 5:03
vandana75-Jun-08 5:03 
AnswerRe: Convert to BW Pin
enhzflep5-Jun-08 17:06
enhzflep5-Jun-08 17:06 
To do that, you just need to de-saturate the image.
The RGB colour-space does not easily lend itself to this operation, and the HSL colour model is far more useful here.

In an entirely non optimized method, you would:

Repeat loop for all pixels in source image
(1) convert pixel RGB to HSL
(2) drop the S value to 0
(3) convert back to RGB
(4) dump the converted pixel back

Here's some routines for colour-space conversion:
// Input: h, s, v in range [0..1]
// Outputs: r, g, b in range [0..1]
void hsvToRgb(float h, float s, float v, float *r, float *g, float *b)
{
     int i;
     float aa, bb, cc, f;
     
     if (s == 0.0) // greyscale
        *r = *g = *b = v;
     else
     {
         if (h == 1.0) h = 0.0;
         h *= 6.0;
         i = floor(h);
         f = h - (float)i;
         aa = v * (1.0 - s);
         bb = v * (1.0 - (s * f));
         cc = v * (1.0 - (s * (1.0 - f)));
         switch(i)
         {
           case 0: *r = v; *g = cc; *b = aa; break;
           case 1: *r = bb; *g = v; *b = aa; break;
           case 2: *r = aa; *g = v; *b = cc; break;
           case 3: *r = aa; *g = bb; *b = v; break;
           case 4: *r = cc; *g = aa; *b = v; break;
           case 5: *r = v; *g = aa; *b = bb; break;
         }
     }
}
           
#define myMin(a,b) (a<b?a:b)>
#define myMax(a,b) (a>b?a:b)
#define noHue 0

// Inputs: r, g, b in range [0..1]
// Outputs: h, s, v in range [0..1]
void rgbToHsv(float r, float g, float b, float *h, float *s, float *v)
{
     float max = myMax(r, myMax(g, b)), min = myMin(r, myMin(g, b));
     float delta = max - min;
     
     *v = max;
     if (max != 0.0)
        *s = delta / max;
     else 
          *s = 0.0;
     if (*s == 0.0) *h = noHue;
     else
     {
         if (r == max)
            *h = (g - b) / delta;
         else if (g == max)
            *h = 2 + (b - r) / delta;
         else if (b == max)
            *h = 4 + (r - g) / delta;
         *h *= 60.0;
         if (*h < 0) *h += 360.0;
         *h /= 360.0;
     }
}
</b?a:b)>


I'll leave it to you to make them work with RGB values in the range [0..255]
GeneralRe: Convert to BW Pin
Nibu babu thomas5-Jun-08 17:19
Nibu babu thomas5-Jun-08 17:19 
GeneralRe: Convert to BW Pin
enhzflep5-Jun-08 17:35
enhzflep5-Jun-08 17:35 
GeneralRe: Convert to BW Pin
Nibu babu thomas5-Jun-08 17:37
Nibu babu thomas5-Jun-08 17:37 
QuestionBHO failing in Windows 2003 Server Pin
tony_Udz5-Jun-08 3:34
tony_Udz5-Jun-08 3:34 
AnswerRe: BHO failing in Windows 2003 Server Pin
led mike5-Jun-08 4:27
led mike5-Jun-08 4:27 
GeneralRe: BHO failing in Windows 2003 Server Pin
tony_Udz5-Jun-08 20:56
tony_Udz5-Jun-08 20:56 
GeneralRe: BHO failing in Windows 2003 Server Pin
led mike6-Jun-08 4:56
led mike6-Jun-08 4:56 
GeneralRe: BHO failing in Windows 2003 Server Pin
tony_Udz8-Jun-08 18:12
tony_Udz8-Jun-08 18:12 
GeneralRe: BHO failing in Windows 2003 Server Pin
tony_Udz8-Jun-08 23:53
tony_Udz8-Jun-08 23:53 
QuestionDate ?? Pin
Trupti Mehta5-Jun-08 3:07
Trupti Mehta5-Jun-08 3:07 
AnswerRe: Date ?? Pin
David Crow5-Jun-08 3:13
David Crow5-Jun-08 3:13 
GeneralRe: Date ?? Pin
Trupti Mehta5-Jun-08 3:57
Trupti Mehta5-Jun-08 3:57 
QuestionRe: Date ?? Pin
David Crow5-Jun-08 4:02
David Crow5-Jun-08 4:02 
AnswerRe: Date ?? Pin
Trupti Mehta5-Jun-08 4:40
Trupti Mehta5-Jun-08 4:40 
GeneralRe: Date ?? Pin
David Crow5-Jun-08 5:31
David Crow5-Jun-08 5:31 
QuestionCoding tools, precautions for Windows CE Pin
Kwanalouie5-Jun-08 3:01
Kwanalouie5-Jun-08 3:01 
QuestionDraw on view Pin
baerten5-Jun-08 2:35
baerten5-Jun-08 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.