IWritableBitmapDataRowSetColor Method

Sets the color 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 SetColor(
	int x,
	Color color
)

Parameters

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

Remarks

If you don't really need to set the pixel color from a 20 byte wide Color structure (16 bytes on 32-bit targets), then you can use the indexer for a slightly better performance, which uses the more compact 4-byte Color32 structure.

The specified color represents a straight (non-premultiplied) color with gamma correction γ = 2.2, regardless of the underlying KnownPixelFormat. To access the actual KnownPixelFormat-dependent raw data use the WriteRaw method.

If the color to be set is not supported by owner IWritableBitmapData, then it will be quantized to a supported color value.

Exceptions

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

See Also