Sdílet prostřednictvím


Bitmap.GetPixels(Int32[], Int32, Int32, Int32, Int32, Int32, Int32) Method

Definition

Returns in pixels[] a copy of the data in the bitmap.

[Android.Runtime.Register("getPixels", "([IIIIIII)V", "")]
public void GetPixels (int[] pixels, int offset, int stride, int x, int y, int width, int height);
[<Android.Runtime.Register("getPixels", "([IIIIIII)V", "")>]
member this.GetPixels : int[] * int * int * int * int * int * int -> unit

Parameters

pixels
Int32[]

The array to receive the bitmap's colors

offset
Int32

The first index to write into pixels[]

stride
Int32

The number of entries in pixels[] to skip between rows (must be >= bitmap's width). Can be negative.

x
Int32

The x coordinate of the first pixel to read from the bitmap

y
Int32

The y coordinate of the first pixel to read from the bitmap

width
Int32

The number of pixels to read from each row

height
Int32

The number of rows to read

Attributes

Exceptions

if x, y, width, height exceed the bounds of the bitmap, or if abs(stride)

if 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 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 in the ColorSpace.Named#SRGB sRGB color space.

Java documentation for android.graphics.Bitmap.getPixels(int[], int, int, int, int, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to