Android Guides | Samples

Android.Graphics.Bitmap.CreateBitmap Method

Returns an immutable bitmap from the specified subset of the source bitmap.

Syntax

[Android.Runtime.Register("createBitmap", "(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;", "")]
public static Bitmap CreateBitmap (Bitmap source, Int32 x, Int32 y, Int32 width, Int32 height)

Parameters

source
The bitmap we are subsetting
x
The x coordinate of the first pixel in source
y
The y coordinate of the first pixel in source
width
The number of pixels in each row
height
The number of rows

Exceptions

TypeReason
IllegalArgumentExceptionif the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0

Remarks

Returns an immutable bitmap from the specified subset of the source bitmap. The new bitmap may be the same object as source, or a copy may have been made. It is initialized with the same density as the original bitmap.

[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