Android Guides | Samples

Android.Graphics.Bitmap.SetPixel Method

Syntax

[Android.Runtime.Register("setPixel", "(III)V", "")]
public Void SetPixel (Int32 x, Int32 y, Color color)

Parameters

x
The x coordinate of the pixel to replace (0...width-1)
y
The y coordinate of the pixel to replace (0...height-1)
color
The ARGB color to write into the bitmap

Exceptions

TypeReason
IllegalStateExceptionif the bitmap is not mutable
IllegalArgumentExceptionif x, y are outside of the bitmap's bounds.

Remarks

Write the specified _Color into the bitmap (assuming it is mutable) at the x,y coordinate. The color must be a non-premultiplied ARGB value.

[Android Documentation]

Requirements

Namespace: Android.Graphics
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1