IWritableBitmapDataRowSetColor Method

Sets the color of the pixel in the current row at the specified x coordinate from a Color value.


Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.0.0-preview.1
void SetColor(
	int x,
	Color color


x  Int32
The x-coordinate of the pixel to set.
color  Color
A Color value that represents the color to assign to the specified pixel.


The color parameter represents a non-premultiplied color with 8 bits per channel in the sRGB color space, regardless of the underlying PixelFormat. The indexer and the SetColor32 method work with the same range of colors and have a slightly better performance than this method.

To access the actual PixelFormat-dependent raw value use the WriteRaw method.

If the color to be set cannot be represented precisely by the owner IWritableBitmapData, then it will be quantized to a supported color value.


ArgumentOutOfRangeExceptionx is less than zero or is greater than or equal to the Width of the parent IWritableBitmapData.

See Also