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: 10.0.0-rc.1
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 Indexed is set in the PixelFormat of the parent IWritableBitmapData. Otherwise, this method throws an InvalidOperationException.

To set the actual color of the pixel at the x coordinate you can use the SetColor.../SetPColor... methods 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