home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 21090 < prev    next >
Encoding:
Internet Message Format  |  1993-01-09  |  1.6 KB

  1. 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
  2. From: d88-jwa@dront.nada.kth.se (Jon Wtte)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Help with Bitmaps
  5. Message-ID: <1993Jan9.222626.20281@kth.se>
  6. Date: 9 Jan 93 22:26:26 GMT
  7. References: <104096@netnews.upenn.edu>
  8. Sender: usenet@kth.se (Usenet)
  9. Organization: Royal Institute of Technology, Stockholm, Sweden
  10. Lines: 47
  11. Nntp-Posting-Host: dront.nada.kth.se
  12.  
  13. In <104096@netnews.upenn.edu> patchen@eniac.seas.upenn.edu (Michael Patchen) writes:
  14.  
  15. >I am programming in Pascal and I have a BITMAP and I need to coerce the bitmap
  16. >into a PICTURE (via a pichandle, etc. ) which can be put in the clipboard and
  17. >then brought into a word processing document, for instance.
  18.  
  19. You can't just "coerce" it; you have to make a picture
  20. by drawing the bitMap and recording it into a pict handle.
  21. Something like:
  22.  
  23. long
  24. PutBitmapAsScrap ( BitMap * bitMap )
  25. {
  26.     long ret ;
  27.     Rect r = bitMap -> bounds ;
  28.     PicHandle h = OpenPicture ( & r ) ;
  29.  
  30.     if ( ! h ) {
  31.  
  32.         return MemError ( ) ? MemError ( ) : -108 ;
  33.     }
  34.     CopyBits ( bitMap , & ( thePort -> portBits ) , & r , & r ,
  35.         srcCopy , NULL ) ;
  36.     ClosePicture ( ) ;
  37.  
  38.     SystemEdit ( 1 ) ;    // This is really weird; but if you
  39.                 // haven't called SystemEdit already
  40.                 // when you get here, MultiFinder won't
  41.                 // see your new scrap!
  42.  
  43.     ret = ZeroScrap ( ) ;
  44.     if ( ret ) {
  45.  
  46.         KillPicture ( h ) ;
  47.         return ret ;
  48.     }
  49.  
  50.     HLock ( ( Handle ) h ) ;
  51.     ret = PutScrap ( GetHandleSize ( h ) , 'PICT' , ( void * ) * h ) ;
  52.     KillPicture ( h ) ;
  53.  
  54.     return ret ;
  55. }
  56. -- 
  57.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  58.  
  59.    NCC-1701
  60.