Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!elroy!peregrine!ccicpg!cci632!ph From: ph@cci632.UUCP (Pete Hoch) Newsgroups: comp.sys.mac.programmer Subject: Re: Have you used NewGDevice? Summary: Forget the GDevice and use a GrafPort Keywords: newGDevice, refNum, devices Message-ID: <27131@cci632.UUCP> Date: 14 Mar 89 20:29:56 GMT References: <1240@mmm.UUCP> Distribution: usa Organization: CCI, Communications Systems Division, Rochester, NY Lines: 43 In article <1240@mmm.UUCP>, mbrady@mmm.UUCP (Mark W. Brady) writes: > > I am attempting to create a graphics device for use with an off screen > pixMap on a mac II. According to Inside Mac V, one should begin with a > call to NewGDevice( refNum: INTEGER; mode: LONGINT ). Since I would have > no driver, IM V says to use -1 for the mode. However, I have no idea as to > what to use for refNum. > > If you can tell me, please do. Unless you need a GDevice with characteristics other than the real device that te screen is using forget anout making an offscreen GDevice. All you really need to do is set up an offscreen GrafPort. Then when you want to use your offscreen PixMap all you need to do is a SetPort to the offscreen GrafPort and use quick draw to do it's thing. The only time I needed to set up an offscreen GDevice was when I wanted the offscreen device to have a greater pixel depth than the real device. However this case does not come up often. As to refNum. NewGDevice is looking for the refNum of the GDevice's driver code. Since your offscreen device does not have a driver this value can be zero. Actualy I have never used NewGDevice. I usualy set one up loke so: gDevHand = (GDHandle)NewHandle( sizeof( GDevice)); /* then I zero out most of the fields. */ SetDeviceAttribute( gDevHand, noDriver, true); /* Other fields of interest. */ .gdITable; .gdType; .gdResPref; .gdPMap /* Lastly I call InitGDevice. */ InitGDevice( 0, -1, gDevHand); This is the frame work without all of the code. I hope this helps. Pete Hoch