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

Definition

Replace pixels in the bitmap with the colors in the array.

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

Parameters

pixels
Int32[]

The colors to write to the bitmap

offset
Int32

The index of the first color to read from pixels[]

stride
Int32

The number of colors in pixels[] to skip between rows. Normally this value will be the same as the width of the bitmap, but it can be larger (or negative).

x
Int32

The x coordinate of the first pixel to write to in the bitmap.

y
Int32

The y coordinate of the first pixel to write to in the bitmap.

width
Int32

The number of colors to copy from pixels[] per row

height
Int32

The number of rows to write to the bitmap

Attributes

Exceptions

if the bitmap is not mutable

if x, y, width, height are outside of the bitmap's bounds.

if the pixels array is too small to receive the specified number of pixels.

Remarks

Replace pixels in the bitmap with the colors in the array. Each element in the array is a packed int representing a non-premultiplied ARGB Color in the ColorSpace.Named#SRGB sRGB color space.

Java documentation for android.graphics.Bitmap.setPixels(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