home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!charon.amdahl.com!amdahl!rtech!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!gaia.ucs.orst.edu!sequent!muncher.sequent.com!tima
- From: tima@sequent.com (Timothy Alan Anderson)
- Subject: Strange BitBlt problem
- Message-ID: <1993Jan28.020801.20702@sequent.com>
- Sender: usenet@sequent.com (usenet )
- Nntp-Posting-Host: family.sequent.com
- Organization: Sequent Computer Systems Inc.
- Date: Thu, 28 Jan 93 02:08:01 GMT
- Lines: 93
-
- 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
-
-