Function

CGBitmapContextGetData

Returns a pointer to the image data associated with a bitmap context.

Declaration

void * CGBitmapContextGetData(CGContextRef context);

Parameters

context

The bitmap context to examine.

Return Value

A pointer to the specified bitmap context’s image data, or NULL if the context is not a bitmap context.

Discussion

If you provided the memory for the bitmap data, you can use this method to get that data pointer. If you passed NULL for the data pointer when creating your bitmap context, it is safe to get the data pointer in iOS 4.0 and later and macOS 10.6 and later only. In earlier versions of the operating system, passing NULL for the data parameter is not supported and may lead to crashes when attempting to access this data using this function.

See Also

Getting Information About Bitmap Contexts

CGBitmapContextGetBitmapInfo

Obtains the bitmap information associated with a bitmap graphics context.

CGBitmapContextGetAlphaInfo

Returns the alpha information associated with the context, which indicates how a bitmap context handles the alpha component.

CGBitmapContextGetBitsPerComponent

Returns the bits per component of a bitmap context.

CGBitmapContextGetBitsPerPixel

Returns the bits per pixel of a bitmap context.

CGBitmapContextGetBytesPerRow

Returns the bytes per row of a bitmap context.

CGBitmapContextGetColorSpace

Returns the color space of a bitmap context.

CGBitmapContextGetHeight

Returns the height in pixels of a bitmap context.

CGBitmapContextGetWidth

Returns the width in pixels of a bitmap context.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software