BitmapFactory.Options.InPremultiplied Property

Definition

If true (which is the default), the resulting bitmap will have its color channels pre-multipled by the alpha channel.

[Android.Runtime.Register("inPremultiplied")]
public bool InPremultiplied { get; set; }
[<Android.Runtime.Register("inPremultiplied")>]
member this.InPremultiplied : bool with get, set

Property Value

Attributes

Remarks

If true (which is the default), the resulting bitmap will have its color channels pre-multipled by the alpha channel.

This should NOT be set to false for images to be directly drawn by the view system or through a Canvas. The view system and Canvas assume all drawn images are pre-multiplied to simplify draw-time blending, and will throw a RuntimeException when un-premultiplied are drawn.

This is likely only useful if you want to manipulate raw encoded image data, e.g. with RenderScript or custom OpenGL.

This does not affect bitmaps without an alpha channel.

Setting this flag to false while setting #inScaled to true may result in incorrect colors.

Java documentation for android.graphics.BitmapFactory.Options.inPremultiplied.

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