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.


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


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


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.


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