Android Guides | Samples

Android.Graphics.Bitmap.CreateScaledBitmap Method

Creates a new bitmap, scaled from an existing bitmap, when possible.

Syntax

[Android.Runtime.Register("createScaledBitmap", "(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;", "")]
public static Bitmap CreateScaledBitmap (Bitmap src, Int32 dstWidth, Int32 dstHeight, Boolean filter)

Parameters

src
The source bitmap.
dstWidth
The new bitmap's desired width.
dstHeight
The new bitmap's desired height.
filter
true if the source should be filtered.

Exceptions

TypeReason
IllegalArgumentExceptionif width is <= 0, or height is <= 0

Remarks

Creates a new bitmap, scaled from an existing bitmap, when possible. If the specified width and height are the same as the current width and height of the source bitmap, the source bitmap is returned and no new bitmap is created.

[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