Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!bbn.com!levin From: levin@bbn.com (Joel B Levin) Newsgroups: comp.sys.mac.programmer Subject: Re: Offscreen Bitmap / MultiFinder Message-ID: <42913@bbn.COM> Date: 18 Jul 89 21:18:06 GMT References: <14226@swan.ulowell.edu> <3427@ncsuvx.ncsu.edu> Sender: news@bbn.COM Reply-To: levin@BBN.COM (Joel B Levin) Organization: BBN Communications Corporation Lines: 30 In article <3427@ncsuvx.ncsu.edu> jnh@ecemwl.UUCP (Joseph N. Hall) writes: |In article <14226@swan.ulowell.edu> jkeegan@hawk.ulowell.edu (Jeff Keegan) writes: |Well, you CAN allocate your own GrafPtr if you want, but you can also use |your window's GrafPtr ... | And how exactly do |> I obtain the offscreen bitmap? I imagine that I must have to allocate |> enough memory for the bitmap (with NewPtr most likely) and have the |> baseAddr field of the bitmap point at that.. But how do I determine |> exactly how bit that NewPtr value must be? I know that I want my |> big-bitmap to have 7200 pixels across and a "n" pixels down.. | |Well, first of all, look up SetPortBits in IM vol. 1. You can use the window's |own GrafPtr; just save the value of its portBits and then |SetPortBits(yourBits). Well, no; I've been bitten by this. You get into trouble with following IM I's advice here. Tech Note 41 is up-to-date and the sample code in it helped me. In short, you need a new GrafPort, for which you allocate a new bitmap. Just draw in the offscreen port. Then you CopyBits from the offscreen port into the window -- that's also your update routine. (This is the simple model.) My experience with trying to use SetPortBits to swap bitmaps gave me trouble because the offscreen bitmap got clipped (it was in the background under multifinder). See tech note 41 (and 120 for the equivalent with CGrafPorts and pixel maps). /JBL UUCP: levin@bbn.com (new) or {backbone}!bbn!levin (old) INTERNET: levin@bbn.com POTS: (617) 873-3463 "The night was"