Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!rosie!king From: king (Peter King) Newsgroups: comp.sys.next Subject: Re: Caching Images for Views .... Message-ID: <744@rosie.NeXT.COM> Date: 16 May 91 19:14:37 GMT References: <1991May15.183632.22391@agate.berkeley.edu> Sender: news@NeXT.COM Lines: 52 Nntp-Posting-Host: palantir.next.com In article <1991May15.183632.22391@agate.berkeley.edu> izumi@mindseye.berkeley.edu (Izumi Ohzawa) writes: > > ... > > Bitmap object is obsolete. Its functionality has been > expanded by NXImage object. > > This is what I do with NXImage and compositing, > it may not be exactly what you need, but should contain > most of the steps needed. > > .... If you want to display Encapsulated PostScript (EPS) files, the code is simpler: NXStream *myStream; id myImage; /* Open the NXStream so that it contains the EPS (file, memory, whatever) myStream = NXMapFile(someFileName, NX_READONLY); /* Create the NXImage */ myImage = [[NXImage alloc] initFromStream:myStream]; /* Close the stream */ NXClose(myStream); NXImage can spot whether the data in an NXStream is EPS or TIFF and will do the right thing. Also, you don't need to hassle with specifying the size of the image. NXImage gets that from the NXStream as well. > > ..... In your compositing section, in another method... > > [myImage composite: NX_COPY toPoint: &myRect.origin ]; > A small performance nit: it is better to use NX_SOVER than NX_COPY. If there is an alpha channel in your NXImage, you don't want the compositing to create on alpha channel in your on-screen window. This causes some performance degradation, and the window's backing store might double in size. NX_COPY will copy all bits (alpha included). NX_SOVER does not copy the alpha bits, it only uses them during the compositing. Peter ----------Disclaimers? No such thing. Everything's the truth---------- Peter F. King Developer Trainer NeXT Computer, Inc. USPS: 900 Chesapeake Dr. Redwood City, CA 94063 Internet: Peter_King@NeXT.COM