IWritableBitmapDataRowSetColor Method

KGy SOFT Drawing Libraries Help
Sets the color of the pixel in the current row at the specified x coordinate.
See the Remarks section for details.

Namespace:  KGySoft.Drawing.Imaging
Assembly:  KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 5.1.0
Syntax

void SetColor(
	int x,
	Color color
)

Parameters

x
Type: SystemInt32
The x-coordinate of the pixel to set.
color
Type: System.DrawingColor
A Color instance that represents the color of the specified pixel.
Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionx is less than zero or is greater than or equal to the Width of the parent IWritableBitmapData.
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 PixelFormat. To access the actual PixelFormat-dependent raw data use the WriteRaw method.

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

Note Note
For information about the possible usable PixelFormats on different platforms see the Remarks section of the ConvertPixelFormat method.
See Also

Reference