Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: How do you make 'offscreen bitmaps'? Message-ID: <1991Apr9.042641.5677@eng.umd.edu> Date: 9 Apr 91 04:26:41 GMT References: <1553@babcock.cerc.wvu.wvnet.edu> Sender: news@eng.umd.edu (C-News) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 26 In article <1553@babcock.cerc.wvu.wvnet.edu> un020070@vaxa.wvnet.edu writes: >Whenever anyone posts a question on comp.sys.mac.programmer about >animation, the customary response is to use 'offscreen bitmaps'. >While I have no problem understanding this technique in theory, >I'm not sure exactly how to implement it in fact. > >Exactly what sort of 'offscreen' structure am I drawing into? >Is it the type actually defined as BitMap? If so, how do I SetPort >to draw in it, since SetPort accepts a GratPtr as its arguement? >Or is it a GrafPort I am drawing into? If so, how do I tell the >Toolbox that the GrafPort is off screen? > >I presume that CopyBits is the preferred way to put the offscreen >drawing on the screen. For black and white animation, you draw into a grafport. You create a BitMap structure of the appropriate size, create a port, and call SetPortBits to associate the bitmap with the port. Copybits can be used, but if you really want to be a speed demon, you can probably optimize each transfer by aligning things right and writing tight assembly code. My guess is that you would definitely want to bypass the trap dispatcher to get speed, if you do use CopyBits (or, perhaps, BlockMove). (call NGetTrapAddress to get the address of the routine into a function pointer, and call that function) -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu .sig under construction, like the rest of this campus.