RoundedRectBlurRegion


public final class RoundedRectBlurRegion
extends BlurRegion

java.lang.Object
   ↳ android.view.BlurRegion
     ↳ android.view.RoundedRectBlurRegion


Defines a rounded rectangular blur region on the SurfaceView.

Summary

Public constructors

RoundedRectBlurRegion()

Constructs a new RoundedRectBlurRegion with the default parameters.

RoundedRectBlurRegion(RectF rect, float[] cornerRadii, float alpha, float blurRadius)

Constructs a new RoundedRectBlurRegion with the specified rounded rectangle coordinates and corner radii.

Public methods

RoundedRectBlurRegion copy()

Returns a deep copy of this blur region.

RectF getBounds()

Returns the bounds of the blur region.

float[] getCornerRadii()

Returns the corner radii for the blur region.

void setBounds(RectF rect)

Sets the bounds of the blur region.

void setCornerRadii(float[] cornerRadii)

Sets the corner radii for the blur region.

void setCornerRadii(float cornerRadius)

Sets the corner radius for all corners of the blur region.

Inherited methods

Public constructors

RoundedRectBlurRegion

Added in API level 37
public RoundedRectBlurRegion ()

Constructs a new RoundedRectBlurRegion with the default parameters.

The default bounds and all corner radii are 0.0f.

The default alpha is 1.0f and the default blur radius is 0.0f.

RoundedRectBlurRegion

Added in API level 37
public RoundedRectBlurRegion (RectF rect, 
                float[] cornerRadii, 
                float alpha, 
                float blurRadius)

Constructs a new RoundedRectBlurRegion with the specified rounded rectangle coordinates and corner radii.

The cornerRadii values are ordered [topLeftX, topLeftY, topRightX, topRightY, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY].

Parameters
rect RectF: bounds of the blur region.
This value cannot be null.

cornerRadii float: array of 8 floats representing the corner radii.
This value cannot be null.

alpha float: alpha value of the region [0.0 - 1.0].
Value is between 0.0f and 1.0f inclusive

blurRadius float: the blur radius in pixels

Throws
IllegalArgumentException if cornerRadii is null or its length is not 8 or rect is null

Public methods

copy

Added in API level 37
public RoundedRectBlurRegion copy ()

Returns a deep copy of this blur region.

Returns
RoundedRectBlurRegion This value cannot be null.

getBounds

Added in API level 37
public RectF getBounds ()

Returns the bounds of the blur region.

Returns
RectF RectF containing the bounds.
This value cannot be null.

getCornerRadii

Added in API level 37
public float[] getCornerRadii ()

Returns the corner radii for the blur region.

Returns
float[] array of 8 floats representing the corner radii.
This value cannot be null.

setBounds

Added in API level 37
public void setBounds (RectF rect)

Sets the bounds of the blur region.

The default value is an empty rectangle.

Parameters
rect RectF: the bounds of the blur region.
This value cannot be null.

Throws
IllegalArgumentException if rect is null

setCornerRadii

Added in API level 37
public void setCornerRadii (float[] cornerRadii)

Sets the corner radii for the blur region.

The cornerRadii values are ordered [topLeftX, topLeftY, topRightX, topRightY, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY].

The default value is all zeros.

Parameters
cornerRadii float: array of 8 floats representing the corner radii.
This value cannot be null.

Throws
IllegalArgumentException if cornerRadii is null or its length is not 8

setCornerRadii

Added in API level 37
public void setCornerRadii (float cornerRadius)

Sets the corner radius for all corners of the blur region.

Parameters
cornerRadius float: radius in pixels.