CGColorSpace.CreateIndexed(CGColorSpace, Int32, Byte[]) Method

Definition

Creates an indexed color space based on the specified colorspace.

public static CoreGraphics.CGColorSpace CreateIndexed (CoreGraphics.CGColorSpace baseSpace, int lastIndex, byte[] colorTable);
static member CreateIndexed : CoreGraphics.CGColorSpace * int * byte[] -> CoreGraphics.CGColorSpace

Parameters

baseSpace
CGColorSpace

The colorspace upon which the indexed color space is based

lastIndex
Int32

The maximum number of elements in the indexed colorspace (up to 255)

colorTable
Byte[]

The color table, one byte is allocated for each color component.

Returns

An indexed color space.

Remarks

An indexed color space allows developers to reprensent colors with a byte value, the actual color rendered is computed by looking up the value in the colortable array.

For example, in an 24-bit RGB colorspace, the color index 2 would be looked up as 3-byte values at index 6, 7 and 8 in the colorTable byte array.

The number of elements in this array is the value of lastIndex multiplied by the number of components in the baseSpace.

Applies to