C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-29-2002, 03:05 PM   #1
Registered User
 
Join Date: Oct 2002
Posts: 4
Unhappy MSVC Tutorial problem - Monochrome Palette

The exercise states:
"Modify the CBmpPalette class used in the Dib example so that it is monochromatic, with only various shades of one color selected for the palette instead of colors from the bitmap."

In my naiveté I had presume I simply set all of the RGB's to one - thus...
From..
Code:
    for( int ndx = 0; ndx < cPaletteEntries; ndx++ )
    {
        pPal->palPalEntry[ndx].peRed   = pColorTab[ndx].rgbRed;
        pPal->palPalEntry[ndx].peGreen = pColorTab[ndx].rgbGreen;
        pPal->palPalEntry[ndx].peBlue  = pColorTab[ndx].rgbBlue;
        pPal->palPalEntry[ndx].peFlags = NULL;
    }
to....
Code:
        pPal->palPalEntry[ndx].peRed   = pColorTab[ndx].rgbRed;
        pPal->palPalEntry[ndx].peGreen = pColorTab[ndx].rgbRed;
        pPal->palPalEntry[ndx].peBlue  = pColorTab[ndx].rgbRed;
        pPal->palPalEntry[ndx].peFlags = NULL;
or maybe
Code:
 
        pPal->palPalEntry[ndx].peRed   = pColorTab[ndx].rgbRed;
        pPal->palPalEntry[ndx].peGreen = 0;
        pPal->palPalEntry[ndx].peBlue  = 0;
        pPal->palPalEntry[ndx].peFlags = NULL;
but this still ends up with a full 256-colour image.
The text as you can see does not clarify how it could be done. Can anyone show where I may be going wrong?
If you simply quote the class/procedure and whre I amy make changes it would help tremendrously.

Many thanks,

-Colkai
colinH is offline   Reply With Quote
Old 10-29-2002, 05:11 PM   #2
UNBANNED
 
OneStiffRod's Avatar
 
Join Date: Jan 2002
Posts: 669
It looks like what you've tried should have worked, maybe try a different colour.

Try Blue or Green instead of Red, I think red holds most of the information in an image so you may not see much of a diff in pic quality. You should see the same pic, only shaded the colour you have selected.
__________________
My Avatar says: "Stay in School"

Rocco is the Boy!
"SHUT YOUR LIPS..."
OneStiffRod is offline   Reply With Quote
Old 10-29-2002, 05:33 PM   #3
Registered User
 
Join Date: Sep 2002
Posts: 417
What compiler are you using? I want to look into 256 colors for Microsoft Visual C++ 6.0's dos consoles.... I don't think there is anything that simple.
Trauts is offline   Reply With Quote
Old 10-30-2002, 03:52 AM   #4
Registered User
 
Join Date: Oct 2002
Posts: 4
I am using the MSVC++ 4.0 developer studion standard.

I obviously am new to this, but I would have thought setting just one colour would work. I just wonder if, for some reason, the wrong palette is being selected or overwritten. However, I have to assume the code in the tutorial is correct.
I've looked through the sample programs but cannot find anything of help.
FYI i'm running the software on a NT4.0 SP6a
colinH is offline   Reply With Quote
Old 10-30-2002, 03:57 AM   #5
Registered User
 
Join Date: Oct 2002
Posts: 4
Actually, it gets more confusing, I just modified the section to this...
Code:
for( int ndx = 0; ndx < cPaletteEntries; ndx++ )
    {
     pPal->palPalEntry[ndx].peRed   = 12;
     pPal->palPalEntry[ndx].peGreen = 0;
     pPal->palPalEntry[ndx].peBlue  = 0;
     pPal->palPalEntry[ndx].peFlags = NULL;
    }
and I still got a full 256-colour display of the image. I would have expected to get just a solid block of dark grey, (assuming of course that the palette items reflect the colour of the pixel).

If anyone can clear this up I'd really be grateful.
colinH is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem running a Cboard C++ tutorial! Monkey Liar C++ Programming 6 02-15-2002 03:32 AM
MSVC and ATL problem Unregistered Windows Programming 1 01-22-2002 07:07 AM
MSVC problem just started Eber Kain C++ Programming 2 11-30-2001 04:32 PM
problem with output Garfield C Programming 2 11-18-2001 08:34 PM
SDI Menu problem - Windows MSVC 6.0 Brown Drake C++ Programming 0 10-13-2001 06:04 AM


All times are GMT -6. The time now is 07:29 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22