Android.Graphics.Bitmap.GetPixels Method
Returns in pixels[] a copy of the data in the bitmap.

Syntax

[Android.Runtime.Register("getPixels", "([IIIIIII)V", "")]
public void GetPixels (int[] pixels, int offset, int stride, int x, int y, int width, int height)

Parameters

pixels
The array to receive the bitmap's colors
offset
The first index to write into pixels[]
stride
The number of entries in pixels[] to skip between rows (must be >= bitmap's width). Can be negative.
x
The x coordinate of the first pixel to read from the bitmap
y
The y coordinate of the first pixel to read from the bitmap
width
The number of pixels to read from each row
height
The number of rows to read

Exceptions

TypeReason
Java.Lang.IllegalArgumentExceptionif x, y, width, height exceed the bounds of the bitmap, or if abs(stride)
Java.Lang.ArrayIndexOutOfBoundsExceptionif the pixels array is too small to receive the specified number of pixels.

Remarks

Returns in pixels[] a copy of the data in the bitmap. Each value is a packed int representing a Android.Graphics._Color. The stride parameter allows the caller to allow for gaps in the returned pixels array between rows. For normal packed results, just pass width for the stride value. The returned colors are non-premultiplied ARGB values.

[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