🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.ms-windows.programmer.misc
1 messages
1 total messages Started by Timothy Alan Anderson Thu, 28 Jan 1993 02:08
Strange BitBlt problem
#2425
Author: Timothy Alan Anderson
Date: Thu, 28 Jan 1993 02:08
92 lines
2745 bytes
My goal is to take two bitmaps, one 'mask' and one 'picture' and
stuff it onto the screen so that you can leave the original screen
colors alone (ala icons). In the process of trying to do that, I have been 
unable to get a rather simple code section (a portion of what I was
trying to work on) to work correctly. If anyone can give me a hint,
I would be much appreciative...

Lets say that global_hdc is the 'global HDC' and hmono_bitmap is
the handle to a monochrome bitmap. Assume these are set up correctly.
Example code section follows:

HDC global_hdc;
HBITMAP global_hmono_bitmap;

WindowsIsStupid(void)
{
   BITMAP bm;
   HDC hdc_temp;
   HDC hdc_mask;

   /* coupla compatible dc's */
   hdc_temp = CreateCompatibleDC(global_hdc);
   hdc_mask = CreateCompatibleDC(global_hdc);

   /* So that the mono bitmap comes in as */
   /* WHITE background and BLACK forground*/
   SetTextColor(hdc_mask, RGB(0,0,0));
   SetBkColor(hdc_mask, RGB(255,255,255));

   /* standard windows garbage */
   GetObject(global_hmono_bitmap, sizeof(BITMAP), &bm);
   SelectObject(hdc_temp, global_hmono_bitmap);

#if 1

   /* this section doesn't work */

   BitBlt(hdc_mask,
      0,
      0,
      bm.bmWidth,
      bm.bmHeight,
      hdc_temp,
      0,
      0,
      SRCCOPY);

   /* hdc_mask should have a color converted copy of the afore */
   /* mentioned monochrome bitmap. */

   BitBlt(global_hdc,
      0,
      0,
      bm.bmWidth,
      bm.bmHeight,
      hdc_mask,
      0,
      0,
      SRCCOPY);

   /* global_hdc should have an exact copy of the above */
   /* but it doesn't display anything at all.... */

#else

   /* this does work, so hdc_temp is OK after SelectObject */

   /* So that the mono bitmap comes in as */
   /* WHITE background and BLACK forground*/
   SetTextColor(global_hdc, RGB(0,0,0));
   SetBkColor(global_hdc, RGB(255,255,255));

   BitBlt(global_hdc,
      0,
      0,
      bm.bmWidth,
      bm.bmHeight,
      hdc_temp,
      0,
      0,
      SRCCOPY);

#endif

   DeleteDC(hdc_temp);
   DeleteDC(hdc_mask);

}

What is going on?

tima@sequent.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads