Bitmap.SetPixel Method

Sets the color of the specified pixel in this Bitmap.

Namespace: Aurigma.GraphicsMill
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public void SetPixel(
	int x,
	int y,
	Color color
)

Parameters

x

Type: System.Int32

The x-coordinate of the pixel to set.
y

Type: System.Int32

The y-coordinate of the pixel to set.
color

Type: Aurigma.GraphicsMill.Color

A Color that represents the color to assign to the specified pixel. It is recommended to make sure that this object has the same color space as the bitmap itself. If color spaces are not match (e.g. the bitmap is CMYK and this color is RGB), color will be automatically converted, but no color management will be applied.

Remarks

This method was implemented for easy but slow access to pixels. It works ideally if you need to set one pixel value, for example, when you implement pencil tool.

Examples

C#
bitmap.SetPixel(120, 100, RgbColor.Red);
var color = (RgbColor)(bitmap.GetPixel(100, 80));

See Also

Reference