marakr
asked on
Problems with bitmap and palette
Hello,
I'm developing an application using MSVC++ 4.0 and MFC. There should appear a picture when I run the application during some seconds. I've scanned two pictures: one of 16 colors and other one of 256 colors for each display configuration.
The code on the OnPaint routine is:
CPaintDC dc(this);
// get information about video mode
int i, j, k;
i = dc.GetDeviceCaps(BITSPIXEL );
j = dc.GetDeviceCaps(PLANES);
k = dc.GetDeviceCaps(NUMCOLORS );
UINT resource;
//deletes the resource used to initialize the CBitmap object
m_bitmap.DeleteObject( );
if ( (i==1) && (j==4) && (k==16) )
resource = IDB_SPLASH16; // 16 colors
else
resource = IDB_SPLASH; // 256+ colors
if (!m_bitmap.LoadBitmap(reso urce))
return;
CDC dcImage;
if (!dcImage.CreateCompatible DC(&dc))
return;
BITMAP bm;
m_bitmap.GetBitmap(&bm);
// Paint the image.
CBitmap* pOldBitmap = dcImage.SelectObject(&m_bi tmap);
dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
dcImage.SelectObject(pOldB itmap);
I'm having problems with the picture shown. The same picture that I visualize in the Photo Paint software looks different that when I visualize it as an open picture (it seems to loose colors). I don't know if I should initialize the palette or change its order. Is there any special configuration for the palette in order to make it work? Anyway, is it a problem with the palette? Else, is it an MFC problem or a graphical problem?
Thanks.
I'm developing an application using MSVC++ 4.0 and MFC. There should appear a picture when I run the application during some seconds. I've scanned two pictures: one of 16 colors and other one of 256 colors for each display configuration.
The code on the OnPaint routine is:
CPaintDC dc(this);
// get information about video mode
int i, j, k;
i = dc.GetDeviceCaps(BITSPIXEL
j = dc.GetDeviceCaps(PLANES);
k = dc.GetDeviceCaps(NUMCOLORS
UINT resource;
//deletes the resource used to initialize the CBitmap object
m_bitmap.DeleteObject( );
if ( (i==1) && (j==4) && (k==16) )
resource = IDB_SPLASH16; // 16 colors
else
resource = IDB_SPLASH; // 256+ colors
if (!m_bitmap.LoadBitmap(reso
return;
CDC dcImage;
if (!dcImage.CreateCompatible
return;
BITMAP bm;
m_bitmap.GetBitmap(&bm);
// Paint the image.
CBitmap* pOldBitmap = dcImage.SelectObject(&m_bi
dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
dcImage.SelectObject(pOldB
I'm having problems with the picture shown. The same picture that I visualize in the Photo Paint software looks different that when I visualize it as an open picture (it seems to loose colors). I don't know if I should initialize the palette or change its order. Is there any special configuration for the palette in order to make it work? Anyway, is it a problem with the palette? Else, is it an MFC problem or a graphical problem?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.