Android Guides | Samples

Android.Graphics.Bitmap.Reconfigure Method

Syntax

[Android.Runtime.Register("reconfigure", "(IILandroid/graphics/Bitmap$Config;)V", "")]
public Void Reconfigure (Int32 width, Int32 height, Bitmap+Config config)

See Also

Parameters

width
height
config

Remarks

Modifies the bitmap to have a specified width, height, and NoType:android/graphics/Bitmap$Config;Href=../../../reference/android/graphics/Bitmap.Config.html, without affecting the underlying allocation backing the bitmap. Bitmap pixel data is not re-initialized for the new configuration.

This method can be used to avoid allocating a new bitmap, instead reusing an existing bitmap's allocation for a new configuration of equal or lesser size. If the Bitmap's allocation isn't large enough to support the new configuration, an IllegalArgumentException will be thrown and the bitmap will not be modified.

The result of Bitmap.ByteCount will reflect the new configuration, while Bitmap.AllocationByteCount will reflect that of the initial configuration.

Note: This may change this result of hasAlpha(). When converting to 565, the new bitmap will always be considered opaque. When converting from 565, the new bitmap will be considered non-opaque, and will respect the value set by setPremultiplied().

WARNING: This method should NOT be called on a bitmap currently used by the view system. It does not make guarantees about how the underlying pixel buffer is remapped to the new config, just that the allocation is reused. Additionally, the view system does not account for bitmap properties being modifying during use, e.g. while attached to drawables.

[Android Documentation]

Requirements

Namespace: Android.Graphics
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0