Android Guides | Samples

Android.Graphics.Bitmap.CopyPixelsToBuffer Method


[Android.Runtime.Register("copyPixelsToBuffer", "(Ljava/nio/Buffer;)V", "")]
public Void CopyPixelsToBuffer (Buffer dst)




Copy the bitmap's pixels into the specified buffer (allocated by the caller). An exception is thrown if the buffer is not large enough to hold all of the pixels (taking into account the number of bytes per pixel) or if the Buffer subclass is not one of the support types (ByteBuffer, ShortBuffer, IntBuffer).

The content of the bitmap is copied into the buffer as-is. This means that if this bitmap stores its pixels pre-multiplied (see Bitmap.IsPremultiplied, the values in the buffer will also be pre-multiplied.

After this method returns, the current position of the buffer is updated: the position is incremented by the number of elements written in the buffer.

[Android Documentation]


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