Bitmap.GetPixel Method

Gets the color of the specified pixel in this Bitmap.

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

Syntax

C#
public Color GetPixel(
	int x,
	int y
)

Parameters

x

Type: System.Int32

The x-coordinate of the pixel to retrieve.
y

Type: System.Int32

The y-coordinate of the pixel to retrieve.

Return Value

A Color that represents the color of the specified pixel. The actual type of the returned object depends on color space of the bitmap. E.g. if the bitmap is RGB, actual type will be RgbColor, etc.

Remarks

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

Examples

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

See Also

Reference