Grabber the program: by Ali Ozer, NeXT Software Group Overview This example shows how to create a TIFF file by reading the bits of a rectangular region from the screen. This is accomplished using methods of the NXBitmapImageRep class. To run Grabber: position and re-size the window so that it covers the screen area you wish to TIFFify. Select "Grab" from the menu. A TIFF file called "/tmp/screenshot.tiff" will be created. You may continue to select "Grab" and each time the screenshot.tiff file will be overwritten. [Note: a good enhancement to this example would be to replace this mechanism with a SavePanel.] Program Organization How to build the nib files The nib file for Grabber consists of the main window 'Grabber' and the main menu. The 'grabberWindow' outlet of the Grabber class is connected to the window via the File's Owner icon in the project window. This is possible since the Grabber class is a subclass of Application. Likewise the "Grab" menu button is connected to the grab: method of the Grabber class via the File's Owner icon. How does all this grab ya? :-) Class[es] in the Application Grabber Subclass of Application and only class in the example. There are two methods in this class: The setGrabberWindow: method is a good example of how to perform an explicit outlet initialization -- in this case the window used to define the region of interest for grabbing. The grab: method, called when the user selects "Grab" from the menu, will get the rectangle of the grabberWindow and read the information underneath that window into an instance of NXBitmapImageRep with the initData:forRect: method. This data is written to a stream and then to disk. Topics Of Interest How to create a TIFF file using NXBitmapImageRep and streams. NXBitmapImageRep is an image representation class used to manage TIFF and pixel-oriented images. To create a TIFF file using this class, the data is first written to a stream and then the stream is written to a file. Other Files Grabber.nib The main nib file, the user-interface of the application. Grabber_main.m, Created by Interface Builder. Makefile, Grabber.iconheader PB.project Valid for 3.0