Condividi tramite


Bitmap.CreateScaledBitmap(Bitmap, Int32, Int32, Boolean) Method

Definition

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

[Android.Runtime.Register("createScaledBitmap", "(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;", "")]
public static Android.Graphics.Bitmap CreateScaledBitmap (Android.Graphics.Bitmap src, int dstWidth, int dstHeight, bool filter);
[<Android.Runtime.Register("createScaledBitmap", "(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;", "")>]
static member CreateScaledBitmap : Android.Graphics.Bitmap * int * int * bool -> Android.Graphics.Bitmap

Parameters

src
Bitmap

The source bitmap.

dstWidth
Int32

The new bitmap's desired width.

dstHeight
Int32

The new bitmap's desired height.

filter
Boolean

Whether or not bilinear filtering should be used when scaling the bitmap. If this is true then bilinear filtering will be used when scaling which has better image quality at the cost of worse performance. If this is false then nearest-neighbor scaling is used instead which will have worse image quality but is faster. Recommended default is to set filter to 'true' as the cost of bilinear filtering is typically minimal and the improved image quality is significant.

Returns

The new scaled bitmap or the source bitmap if no scaling is required.

Attributes

Exceptions

if 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.

Java documentation for android.graphics.Bitmap.createScaledBitmap(android.graphics.Bitmap, int, int, boolean).

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