- CGrafPtr origPort = NULL ;
- GDHandle origDev = NULL ;
- GWorldPtr wp = NULL ;
- GWorldPtr mask = NULL ;
- int height = GetHeight() ;
- int width = GetWidth() ;
-
- Rect rect = { 0 , 0 , height , width } ;
- RgnHandle clipRgn = NULL ;
-
- GetGWorld( &origPort , &origDev ) ;
- wp = GetHBITMAP( &mask ) ;
-
- if ( mask )
- {
- GWorldPtr monoworld ;
- clipRgn = NewRgn() ;
- OSStatus err = NewGWorld( &monoworld , 1 , &rect , NULL , NULL , 0 ) ;
- verify_noerr(err) ;
- LockPixels( GetGWorldPixMap( monoworld ) ) ;
- LockPixels( GetGWorldPixMap( mask ) ) ;
- SetGWorld( monoworld , NULL ) ;
-
- RGBColor white = { 0xffff , 0xffff , 0xffff } ;
- RGBColor black = { 0x0000 , 0x0000 , 0x0000 } ;
- RGBForeColor( &black ) ;
- RGBBackColor( &white ) ;
-
- CopyBits(GetPortBitMapForCopyBits(mask),
- GetPortBitMapForCopyBits(monoworld),
- &rect,
- &rect,
- srcCopy, NULL);
- BitMapToRegion( clipRgn , (BitMap*) *GetGWorldPixMap( monoworld ) ) ;
-
- UnlockPixels( GetGWorldPixMap( monoworld ) ) ;
- UnlockPixels( GetGWorldPixMap( mask ) ) ;
- DisposeGWorld( monoworld ) ;
- }
-
- SetGWorld( wp , NULL ) ;
- Rect portRect ;
- GetPortBounds( wp , &portRect ) ;
- m_pictHandle = OpenPicture(&portRect);
-
- if (m_pictHandle)