IWritableBitmapDataRowSetColorIndex Method

If the owner IWritableBitmapData has an indexed pixel format, then sets the color index of the pixel in the current row at the specified x coordinate.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 7.0.0-preview.3
C#
void SetColorIndex(
	int x,
	int colorIndex
)

Parameters

x  Int32
The x-coordinate of the color index to set.
colorIndex  Int32
A palette index that represents the color to be set.

Remarks

This method can be used only if the PixelFormat property of the parent IWritableBitmapData returns an indexed format (which are Format8bppIndexed, Format4bppIndexed and Format1bppIndexed). Otherwise, this method throws an InvalidOperationException.

To set the actual color of the pixel at the x coordinate you can use the SetColor method or the indexer.

Exceptions

ArgumentOutOfRangeExceptionx is less than zero or is greater than or equal to the Width of the parent IWritableBitmapData.
InvalidOperationExceptionThis IWritableBitmapDataRow does not belong to a row of an indexed IWritableBitmapData.

See Also