Canvas.SaveLayerAlpha Method

Definition

Overloads

SaveLayerAlpha(RectF, Int32)

Convenience for #saveLayer(RectF, Paint) but instead of taking a entire Paint object it takes only the alpha parameter.

SaveLayerAlpha(RectF, Int32, SaveFlags)

This behaves the same as save(), but in addition it allocates and redirects drawing to an offscreen bitmap.

SaveLayerAlpha(Single, Single, Single, Single, Int32)

Convenience for #saveLayerAlpha(RectF, int) that takes the four float coordinates of the bounds rectangle.

SaveLayerAlpha(Single, Single, Single, Single, Int32, SaveFlags)

Helper for saveLayerAlpha() that takes 4 values instead of a RectF.

SaveLayerAlpha(RectF, Int32)

Convenience for #saveLayer(RectF, Paint) but instead of taking a entire Paint object it takes only the alpha parameter.

[Android.Runtime.Register("saveLayerAlpha", "(Landroid/graphics/RectF;I)I", "GetSaveLayerAlpha_Landroid_graphics_RectF_IHandler")]
public virtual int SaveLayerAlpha (Android.Graphics.RectF? bounds, int alpha);
[<Android.Runtime.Register("saveLayerAlpha", "(Landroid/graphics/RectF;I)I", "GetSaveLayerAlpha_Landroid_graphics_RectF_IHandler")>]
abstract member SaveLayerAlpha : Android.Graphics.RectF * int -> int
override this.SaveLayerAlpha : Android.Graphics.RectF * int -> int

Parameters

bounds
RectF

The maximum size the offscreen bitmap needs to be (in local coordinates)

alpha
Int32

The alpha to apply to the offscreen when it is drawn during restore()

Returns

Attributes

Remarks

Convenience for #saveLayer(RectF, Paint) but instead of taking a entire Paint object it takes only the alpha parameter.

Java documentation for android.graphics.Canvas.saveLayerAlpha(android.graphics.RectF, int).

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

SaveLayerAlpha(RectF, Int32, SaveFlags)

This behaves the same as save(), but in addition it allocates and redirects drawing to an offscreen bitmap.

[Android.Runtime.Register("saveLayerAlpha", "(Landroid/graphics/RectF;II)I", "GetSaveLayerAlpha_Landroid_graphics_RectF_IIHandler")]
public virtual int SaveLayerAlpha (Android.Graphics.RectF? bounds, int alpha, Android.Graphics.SaveFlags saveFlags);
[<Android.Runtime.Register("saveLayerAlpha", "(Landroid/graphics/RectF;II)I", "GetSaveLayerAlpha_Landroid_graphics_RectF_IIHandler")>]
abstract member SaveLayerAlpha : Android.Graphics.RectF * int * Android.Graphics.SaveFlags -> int
override this.SaveLayerAlpha : Android.Graphics.RectF * int * Android.Graphics.SaveFlags -> int

Parameters

bounds
RectF

The maximum size the offscreen bitmap needs to be (in local coordinates)

alpha
Int32

The alpha to apply to the offscreen when it is drawn during restore()

saveFlags
SaveFlags

see _SAVE_FLAG constants, generally #ALL_SAVE_FLAG is recommended for performance reasons.

Returns

value to pass to restoreToCount() to balance this call

Attributes

Remarks

This behaves the same as save(), but in addition it allocates and redirects drawing to an offscreen bitmap. <p class="note"><strong>Note:</strong> this method is very expensive, incurring more than double rendering cost for contained content. Avoid using this method, especially if the bounds provided are large. It is recommended to use a android.view.View#LAYER_TYPE_HARDWARE hardware layer on a View to apply an xfermode, color filter, or alpha, as it will perform much better than this method.

All drawing calls are directed to a newly allocated offscreen bitmap. Only when the balancing call to restore() is made, is that offscreen buffer drawn back to the current target of the Canvas (either the screen, it's target Bitmap, or the previous layer).

The alpha parameter is applied when the offscreen bitmap is drawn back when restore() is called.

As of API Level API level Build.VERSION_CODES#P the only valid saveFlags is #ALL_SAVE_FLAG. All other flags are ignored.

This member is deprecated. Use #saveLayerAlpha(RectF, int) instead.

Java documentation for android.graphics.Canvas.saveLayerAlpha(android.graphics.RectF, int, int).

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

SaveLayerAlpha(Single, Single, Single, Single, Int32)

Convenience for #saveLayerAlpha(RectF, int) that takes the four float coordinates of the bounds rectangle.

[Android.Runtime.Register("saveLayerAlpha", "(FFFFI)I", "GetSaveLayerAlpha_FFFFIHandler")]
public virtual int SaveLayerAlpha (float left, float top, float right, float bottom, int alpha);
[<Android.Runtime.Register("saveLayerAlpha", "(FFFFI)I", "GetSaveLayerAlpha_FFFFIHandler")>]
abstract member SaveLayerAlpha : single * single * single * single * int -> int
override this.SaveLayerAlpha : single * single * single * single * int -> int

Parameters

left
Single
top
Single
right
Single
bottom
Single
alpha
Int32

Returns

Attributes

Remarks

Convenience for #saveLayerAlpha(RectF, int) that takes the four float coordinates of the bounds rectangle.

Java documentation for android.graphics.Canvas.saveLayerAlpha(float, float, float, float, int).

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

SaveLayerAlpha(Single, Single, Single, Single, Int32, SaveFlags)

Helper for saveLayerAlpha() that takes 4 values instead of a RectF.

[Android.Runtime.Register("saveLayerAlpha", "(FFFFII)I", "GetSaveLayerAlpha_FFFFIIHandler")]
public virtual int SaveLayerAlpha (float left, float top, float right, float bottom, int alpha, Android.Graphics.SaveFlags saveFlags);
[<Android.Runtime.Register("saveLayerAlpha", "(FFFFII)I", "GetSaveLayerAlpha_FFFFIIHandler")>]
abstract member SaveLayerAlpha : single * single * single * single * int * Android.Graphics.SaveFlags -> int
override this.SaveLayerAlpha : single * single * single * single * int * Android.Graphics.SaveFlags -> int

Parameters

left
Single
top
Single
right
Single
bottom
Single
alpha
Int32
saveFlags
SaveFlags

Returns

Attributes

Remarks

Helper for saveLayerAlpha() that takes 4 values instead of a RectF.

As of API Level API level Build.VERSION_CODES#P the only valid saveFlags is #ALL_SAVE_FLAG. All other flags are ignored.

This member is deprecated. Use #saveLayerAlpha(float, float, float, float, int) instead.

Java documentation for android.graphics.Canvas.saveLayerAlpha(float, float, float, float, int, int).

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