iOS Guides | Samples

CoreGraphics.CGBitmapContext Constructor

Creates a bitmap-based CGContext that renders into the specified array.

Syntax

public CGBitmapContext (Byte[] data, CGColorSpace colorSpace, CGBitmapFlags bitmapInfo, nint width, nint height, nint bitsPerComponent, nint bytesPerRow)

Parameters

data
Byte array where the CGContext will render, this value can be null, in which case the size of the data will be computed based on the other parameters and the data allocated.
width
The width of the image
height
The height of the image
bitsPerComponent
Bits per component (bpc).
bytesPerRow

Number of bytes per row, a number greather or equal that the number of bytes used by a row of pixels.   

Typically is the width multiplied by the number of bytes per pixel, with some extra padding.   This is called the image stride.   

While this does not affect the rendering of the image, it can improve the performance of image rendering by aligning the first pixel to the natural processor alignment.

colorSpace
The color space to use for the bitmap (it can not be an indexed color space).
bitmapInfo
Configuration options for the bitmap, including options to render into an alpha transparent buffer.

Requirements

Namespace: CoreGraphics
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0