Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

CutCornerTreatment

public class CutCornerTreatment
extends CornerTreatment

java.lang.Object
   ↳ com.google.android.material.shape.CornerTreatment
     ↳ com.google.android.material.shape.CutCornerTreatment


A corner treatment which cuts or clips the original corner of a shape with a straight line.

Summary

Public constructors

CutCornerTreatment(float size)

Instantiates a cut corner treatment of a given size.

Public methods

void getCornerPath(float angle, float interpolation, ShapePath shapePath)

Generates a ShapePath for this corner treatment.

Inherited methods

From class com.google.android.material.shape.CornerTreatment
From class java.lang.Object

Public constructors

CutCornerTreatment

CutCornerTreatment (float size)

Instantiates a cut corner treatment of a given size. A cut corner treatment introduces two new corners to a shape, produced by a straight line drawn between two points pixels away, on the vertical and horizontal axes, from the rectilinear (original) corner of the shape. Stated another way, if the rectilinear (original) corner of the shape was at co-ordinates (0, 0), the new corners are at co-ordinates (size, 0) and (0, size), and a straight line is drawn between them.

Public methods

getCornerPath

void getCornerPath (float angle, 
                float interpolation, 
                ShapePath shapePath)

Generates a ShapePath for this corner treatment.

CornerTreatments are assumed to have an origin of (0, 0) (i.e. they represent the top-left corner), and are automatically rotated and scaled as necessary when applied to other corners.

Parameters
angle float: the angle of the corner, typically 90 degrees.

interpolation float: the interpolation of the corner treatment. Ranges between 0 (none) and 1 (fully) interpolated. Custom corner treatments can implement interpolation to support shape transition between two arbitrary states. Typically, a value of 0 indicates that the custom corner treatment is not rendered (i.e. that it is a 90 degree angle), and a value of 1 indicates that the treatment is fully rendered. Animation between these two values can "heal" or "reveal" a corner treatment.

shapePath ShapePath: the ShapePath that this treatment should write to.