home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!diva.Berkeley.EDU!bchen
- From: bchen@diva.Berkeley.EDU (Benjamin Chen)
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Combining Regions in MFC (gripe)
- Date: 2 Sep 1992 18:34:17 GMT
- Organization: University of California, Berkeley
- Lines: 36
- Distribution: usa
- Message-ID: <1831f9INN68k@agate.berkeley.edu>
- NNTP-Posting-Host: diva.berkeley.edu
-
- I was trying to do the following to combine a circular and rectangular
- region:
-
- CRect bbox;
- CRgn circle, rect, combine;
- int status;
-
- status = circle.CreateEllipticRgnIndirect( bbox );
- status = rect.CreateRectRgn(top, left, right, bottom);
- status = combine.CombineRgn(&circle, &rect, RGN_DIFF);
-
- This did not work by itself. CombineRgn() returned ERROR.
- I needed to add the following statement beforehand:
-
- status = combine.CreateRectRgn(0, 0, 0, 0);
-
- in order for the CombineRgn() to work, apparently to initialize the
- destination CRgn to some arbitrary dummy region. This info is nowhere
- in the MFC docs. I only tried this after reading the API docs
- (Programmer Reference, Vol 2., p 63) where it states:
-
- To use CombineRgn MOST EFFCIENTLY, hrgnDest should be a
- trivial region ....
-
- So it probably isn't MFC's "fault". Still, the note should be reflected
- in the MFC docs. Also, "MOST EFFICIENTLY" should be deleted from the text
- since it doesn't work AT ALL if you don't create a trivial region (which
- seems to be a little hacky anyway). Oh, well, just venting some frustration.
-
- BC
-
- --
- Benjamin Chen
- Office: 550-A4 Cory Hall, 2-4332
- UUCP: !ucbvax!diva!bchen
- HEPNET: LBL::"bchen@diva.Berkeley.EDU"
-