home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!hri.com!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!kth.se!dront.nada.kth.se!d88-jwa
- From: d88-jwa@dront.nada.kth.se (Jon Wtte)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Help with Bitmaps
- Message-ID: <1993Jan9.222626.20281@kth.se>
- Date: 9 Jan 93 22:26:26 GMT
- References: <104096@netnews.upenn.edu>
- Sender: usenet@kth.se (Usenet)
- Organization: Royal Institute of Technology, Stockholm, Sweden
- Lines: 47
- Nntp-Posting-Host: dront.nada.kth.se
-
- In <104096@netnews.upenn.edu> patchen@eniac.seas.upenn.edu (Michael Patchen) writes:
-
- >I am programming in Pascal and I have a BITMAP and I need to coerce the bitmap
- >into a PICTURE (via a pichandle, etc. ) which can be put in the clipboard and
- >then brought into a word processing document, for instance.
-
- You can't just "coerce" it; you have to make a picture
- by drawing the bitMap and recording it into a pict handle.
- Something like:
-
- long
- PutBitmapAsScrap ( BitMap * bitMap )
- {
- long ret ;
- Rect r = bitMap -> bounds ;
- PicHandle h = OpenPicture ( & r ) ;
-
- if ( ! h ) {
-
- return MemError ( ) ? MemError ( ) : -108 ;
- }
- CopyBits ( bitMap , & ( thePort -> portBits ) , & r , & r ,
- srcCopy , NULL ) ;
- ClosePicture ( ) ;
-
- SystemEdit ( 1 ) ; // This is really weird; but if you
- // haven't called SystemEdit already
- // when you get here, MultiFinder won't
- // see your new scrap!
-
- ret = ZeroScrap ( ) ;
- if ( ret ) {
-
- KillPicture ( h ) ;
- return ret ;
- }
-
- HLock ( ( Handle ) h ) ;
- ret = PutScrap ( GetHandleSize ( h ) , 'PICT' , ( void * ) * h ) ;
- KillPicture ( h ) ;
-
- return ret ;
- }
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
-
- NCC-1701
-