Bitmap.HasAlpha Property

Definition

Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values. -or- 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).

public bool HasAlpha { [Android.Runtime.Register("hasAlpha", "()Z", "")] get; [Android.Runtime.Register("setHasAlpha", "(Z)V", "")] set; }
[<get: Android.Runtime.Register("hasAlpha", "()Z", "")>]
[<set: Android.Runtime.Register("setHasAlpha", "(Z)V", "")>]
member this.HasAlpha : bool with get, set

Property Value

Attributes

Remarks

Property getter 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.

Java documentation for android.graphics.Bitmap.hasAlpha().

Property setter 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.

Java documentation for android.graphics.Bitmap.setHasAlpha(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