Android Guides | Samples

Android.Graphics.Bitmap.HasAlpha Property

Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values.

Syntax

[get: Android.Runtime.Register("hasAlpha", "()Z", "GetHasAlphaHandler")]
[set: Android.Runtime.Register("setHasAlpha", "(Z)V", "GetSetHasAlpha_ZHandler")]
public Boolean HasAlpha { get; set; }

Remarks

Get method documentation[Android Documentation]
Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values. For some configs, this is always false (e.g. RGB_565), since they do not support per-pixel alpha. However, for configs that do, the bitmap may be flagged to be known that all of its pixels are opaque. In this case hasAlpha() will also return false. If a config such as ARGB_8888 is not so flagged, it will return true by default.

Set method documentation[Android Documentation]
Tell the bitmap if all of the pixels are known to be opaque (false) or if some of the pixels may contain non-opaque alpha values (true). Note, for some configs (e.g. RGB_565) this call is ignored, since it does not support per-pixel alpha values. This is meant as a drawing hint, as in some cases a bitmap that is known to be opaque can take a faster drawing case than one that may have non-opaque per-pixel alpha values.

Requirements

Namespace: Android.Graphics
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1