Class

NSBitmapImageRep

An object that renders an image from bitmap data.

Declaration

@interface NSBitmapImageRep : NSImageRep

Overview

Supported bitmap data formats include GIF, JPEG, TIFF, PNG, and various permutations of raw bitmap data.

Alpha Premultiplication and Bitmap Formats

When creating a bitmap using a premultiplied format, if a coverage (alpha) plane exists, the bitmap’s color components are premultiplied with it. In this case, if you modify the contents of the bitmap, you are therefore responsible for premultiplying the data. Note that premultiplying generally has negligible effect on output quality. For floating-point image data, premultiplying color components is a lossless operation, but for fixed-point image data, premultiplication can introduce small rounding errors. In either case, more rounding errors may appear when compositing many premultiplied images; however, such errors are generally not readily visible.

For this reason, you should not use an NSBitmapImageRep object if you want to manipulate image data. To work with data that is not premultiplied, use the Core Graphics framework instead. (Specifically, create images using the CGImageCreate function and kCGImageAlphaLast parameter.) Alternatively, include the NSAlphaNonpremultipliedBitmapFormat flag when creating the bitmap.

Topics

Creating an NSBitmapImageRep Object

imageRepWithData:

Creates and returns an NSBitmapImageRep object initialized with the first image in the supplied data.

imageRepsWithData:

Creates and returns an array of initialized NSBitmapImageRep objects corresponding to the images in the supplied data.

initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:

Initializes the receiver, a newly allocated NSBitmapImageRep object, so it can render the specified image.

initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:

Initializes the receiver, a newly allocated NSBitmapImageRep object, so it can render the specified image.

initWithCGImage:

Returns an NSBitmapImageRep object created from a Core Graphics image object.

initWithCIImage:

Returns an NSBitmapImageRep object created from a Core Image object.

initWithData:

Initializes a newly allocated NSBitmapImageRep from the provided data.

initWithFocusedViewRect:

Initializes the receiver, a newly allocated NSBitmapImageRep object, with bitmap data read from a rendered image.

Deprecated
initForIncrementalLoad

Initializes and returns the receiver, a newly allocated NSBitmapImageRep object, for incremental loading.

Getting Information About the Image

bitmapFormat

The format of the bitmap image representation.

NSBitmapFormat

Constants representing the various bitmap component formats.

bitsPerPixel

The number of bits allocated for each pixel in each plane of data.

bytesPerPlane

The number of bytes in each plane or channel of data.

bytesPerRow

The minimum number of bytes required to specify a scan line in each data plane.

planar

A Boolean value indicating whether the image data is in a planar configuration.

numberOfPlanes

The number of separate planes into which the image data is organized.

samplesPerPixel

The number of components for each pixel.

Getting Image Data

bitmapData

A pointer to the bitmap data.

getBitmapDataPlanes:

Returns by indirection bitmap data of the receiver separated into planes.

Producing Representations of the Image

TIFFRepresentationOfImageRepsInArray:

Returns a TIFF representation of the given images

TIFFRepresentationOfImageRepsInArray:usingCompression:factor:

Returns a TIFF representation of the given images using a specified compression scheme and factor.

TIFFRepresentation

A TIFF representation of the bitmap image data.

TIFFRepresentationUsingCompression:factor:

Returns a TIFF representation of the image using the specified compression.

representationOfImageRepsInArray:usingType:properties:

Formats the specified bitmap images using the specified storage type and properties and returns them in a data object.

representationUsingType:properties:

Formats the receiver’s image data using the specified storage type and properties and returns it in a data object.

NSDrawBitmap

Draws a bitmap image.

Managing Compression Types

getTIFFCompressionTypes:count:

Returns by indirection an array of all available compression types that can be used when writing a TIFF image.

localizedNameForTIFFCompressionType:

Returns an autoreleased string containing the localized name for the specified compression type.

canBeCompressedUsing:

Tests whether the receiver can be compressed by the specified compression scheme.

setCompression:factor:

Sets the receiver’s compression type and compression factor.

getCompression:factor:

Returns by indirection the receiver’s compression type and compression factor.

setProperty:withValue:

Sets the image’s property to value.

valueForProperty:

Returns the value for the specified property.

NSTIFFCompression

Constants representing the supported TIFF data-compression schemes.

Loading Image Incrementally

incrementalLoadFromData:complete:

Loads the current image data into an incrementally-loaded image representation and returns the current status of the image.

Managing Pixel Values

setColor:atX:y:

Changes the color of the pixel at the specified coordinates.

colorAtX:y:

Returns the color of the pixel at the specified coordinates.

setPixel:atX:y:

Sets the receiver's pixel at the specified coordinates to the specified raw pixel values.

getPixel:atX:y:

Returns by indirection the pixel data for the specified location in the receiver.

Getting a Core Graphics Image

CGImage

A Core Graphics image object based on the bitmap image rep’s data.

Managing ColorSpaces

bitmapImageRepByConvertingToColorSpace:renderingIntent:

Converts the image rep to the specified colorspace

bitmapImageRepByRetaggingWithColorSpace:

Changes the colorSpace tag of the receiver.

colorSpace

The color space of the bitmap.

Constants

NSImageRepLoadStatus

The various status values returned by incrementalLoadFromData:complete:.

NSBitmapImageFileType

Constants for specifying the bitmap file types.

Relationships

Inherits From

Conforms To

See Also

Bitmap Formats

NSCachedImageRep

An object that stores image data in a form that can be readily transferred to the screen.

Deprecated
NSCIImageRep

An object that can render an image from a Core Image object.

NSPICTImageRep

An object that renders an image from a PICT format data stream of version 1, version 2, and extended version 2.