• Advertisement


This topic is now archived and is closed to further replies.


This topic is 6427 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Its kinda GDI question. I have a 16bpp bitmap and I want to copy it to a 24bpp bitmap? I tried this way but its not working, does anyone sees a problem? I get NULL as the bits of the second bitmap. (I have a source DC from which I create the original 16bpp bitmap) CDC l_oCompatibleDC; l_oCompatibleDC.CreateCompatibleDC(a_opSourceDC); CBitmap l_oBmp; l_oBmp.CreateCompatibleBitmap(a_opSourceDC,a_orDCSize.cx,a_orDCSize.cy); CBitmap* l_opOldBmp=l_oCompatibleDC.SelectObject(&l_oBmp); if (!l_oCompatibleDC.BitBlt(0,0,a_orDCSize.cx, a_orDCSize.cy,a_opSourceDC,0,0,SRCCOPY)) { return FALSE; } // now I want to copy the bitmap to a 24bpp bitmap CBitmap l_o24BppBitmap; l_o24BppBitmap.CreateBitmap(a_orDCSize.cx, a_orDCSize.cy,1,24,NULL); CDC l_oDC; l_oDC.CreateCompatibleDC(a_opSourceDC); CBitmap* l_opOldBmp1=l_oDC.SelectObject(&l_o24BppBitmap); l_oDC.BitBlt(0,0,a_orDCSize.cx, a_orDCSize.cy,&l_oCompatibleDC,0,0,SRCCOPY); l_oCompatibleDC.SelectObject(l_opOldBmp); l_oDC.SelectObject(l_opOldBmp1);

Share this post

Link to post
Share on other sites

  • Advertisement