Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights Reserved.

NSBitmapImageRep

Inherits From: NSImageRep : NSObject

Conforms To: NSCoding, NSCopying (NSImageRep) NSObject (NSObject)

Declared In: AppKit/NSBitmapImageRep.h

Class Description

An NSBitmapImageRep is an object that can render an image from bitmap data. The data can be in Tag Image File Format (TIFF), or it can be raw image data. If it's raw data, the object must be informed about the structure of the imageits size, the number of color components, the number of bits per sample, and so onwhen it's first initialized. If it's TIFF data, the object can get this information from the various TIFF fields included with the data.

Although NSBitmapImageReps are often used indirectly, through instances of the NSImage class, they can also be used directlyfor example to manipulate the bits of an image as you might need to do in a paint program.

Setting Up an NSBitmapImageRep

A new NSBitmapImageRep is passed bitmap data for an image when it's first initialized. An NSBitmapImageRep can also be created from bitmap data that's read from a specified rectangle of a focused NSView.

Although the NSBitmapImageRep class inherits NSImageRep methods that set image attributes, these methods shouldn't be used. Instead, you should either allow the object to find out about the image from the TIFF fields or use methods defined in this class to supply this information when the object is initialized.

TIFF Compression

TIFF data can be read and rendered after it has been compressed using any one of the four schemes briefly described below:

LZW Compresses and decompresses without information loss, achieving compression ratios up to 5:1. It may be somewhat slower to compress and decompress than the PackBits scheme.

PackBits Compresses and decompresses without information loss, but may not achieve the same compression ratios as LZW.

JPEG Compresses and decompresses with some information loss, but can achieve compression ratios anywhere from 10:1 to 100:1. The ratio is determined by a user-settable factor ranging from 1.0 to 255.0, with higher factors yielding greater compression. More information is lost with greater compression, but 15:1 compression is safe for publication quality. Some images can be compressed even more. JPEG compression can be used only for images that specify at least 4 bits per sample.

CCITTFAX Compresses and decompresses 1 bit grayscale images using international fax compression standards CCITT3 and CCITT4.

An NSBitmapImageRep can also produce compressed TIFF data for its image using any of these schemes.

Allocating and Initializing a New NSBitmapImageRep Object

Getting Image Data

Producing a TIFF Representation of the Image

Setting and Checking Compression Types