A type of CGContext that you can use for drawing bits to memory.


The number of components for each pixel in a bitmap graphics context is specified by a color space, defined by a CGColorSpace. The bitmap graphics context specifies whether the bitmap should contain an alpha channel, and how the bitmap is generated.


Getting Information About Bitmap Contexts

These functions return the values of attributes specified when a bitmap context is created.

var bitmapInfo: CGBitmapInfo

Obtains the bitmap information associated with a bitmap graphics context.

var alphaInfo: CGImageAlphaInfo

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

var bitsPerComponent: Int

Returns the bits per component of a bitmap context.

var bitsPerPixel: Int

Returns the bits per pixel of a bitmap context.

var bytesPerRow: Int

Returns the bytes per row of a bitmap context.

var colorSpace: CGColorSpace?

Returns the color space of a bitmap context.

var data: UnsafeMutableRawPointer?

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

var height: Int

Returns the height in pixels of a bitmap context.

var width: Int

Returns the width in pixels of a bitmap context.

Data Types


A callback function used to release data associate with the bitmap context.