Android Guides | Samples

Android.Graphics.Bitmap.ExtractAlpha Method

Returns a new bitmap that captures the alpha values of the original.

Syntax

[Android.Runtime.Register("extractAlpha", "(Landroid/graphics/Paint;[I)Landroid/graphics/Bitmap;", "")]
public Bitmap ExtractAlpha (Paint paint, Int32[] offsetXY)

Parameters

paint
Optional paint used to modify the alpha values in the resulting bitmap. Pass null for default behavior.
offsetXY
Optional array that returns the X (index 0) and Y (index 1) offset needed to position the returned bitmap so that it visually lines up with the original.

Remarks

Returns a new bitmap that captures the alpha values of the original. These values may be affected by the optional Paint parameter, which can contain its own alpha, and may also contain a MaskFilter which could change the actual dimensions of the resulting bitmap (e.g. a blur maskfilter might enlarge the resulting bitmap). If offsetXY is not null, it returns the amount to offset the returned bitmap so that it will logically align with the original. For example, if the paint contains a blur of radius 2, then offsetXY[] would contains -2, -2, so that drawing the alpha bitmap offset by (-2, -2) and then drawing the original would result in the blur visually aligning with the original.

The initial density of the returned bitmap is the same as the original's.

[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