Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ShapePath

public class ShapePath
extends Object

java.lang.Object
   ↳ com.google.android.material.shape.ShapePath


Represents the descriptive path of a shape. Path segments are stored in sequence so that transformations can be applied to them when the Path is produced by the MaterialShapeDrawable.

Summary

Nested classes

class ShapePath.PathArcOperation

Path arc operation. 

class ShapePath.PathLineOperation

Straight line operation. 

class ShapePath.PathOperation

Interface for a path operation to be appended to the operations list. 

class ShapePath.PathQuadOperation

Path quad operation. 

Fields

public float currentShadowAngle

This field is deprecated. Use the class methods to interact with this field so internal state can be * maintained.

public float endShadowAngle

This field is deprecated. Use the class methods to interact with this field so internal state can be * maintained.

public float endX

This field is deprecated. Use the class methods to interact with this field so internal state can be maintained.

public float endY

This field is deprecated. Use the class methods to interact with this field so internal state can be maintained.

public float startX

This field is deprecated. Use the class methods to interact with this field so internal state can be maintained.

public float startY

This field is deprecated. Use the class methods to interact with this field so internal state can be maintained.

Public constructors

ShapePath()
ShapePath(float startX, float startY)

Public methods

void addArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle)

Add an arc to the ShapePath.

void applyToPath(Matrix transform, Path path)

Apply the ShapePath sequence to a Path under a matrix transform.

void lineTo(float x, float y)

Add a line to the ShapePath.

void quadToPoint(float controlX, float controlY, float toX, float toY)

Add a quad to the ShapePath.

void reset(float startX, float startY)

Resets the ShapePath using a default shadow.

void reset(float startX, float startY, float shadowStartAngle, float shadowSweepAngle)

Resets fields given the provided assignment parameters.

Inherited methods

From class java.lang.Object

Fields

currentShadowAngle

float currentShadowAngle

This field is deprecated.
Use the class methods to interact with this field so internal state can be * maintained.

The angle of the start of the last drawn shadow. Changes internally. Do not change.

endShadowAngle

float endShadowAngle

This field is deprecated.
Use the class methods to interact with this field so internal state can be * maintained.

The angle at the end of the final shadow. Changes internally. Do not change.

endX

float endX

This field is deprecated.
Use the class methods to interact with this field so internal state can be maintained.

The x coordinate for the current end of the path given the previously applied transformation. Changes internally. Do not change.

endY

float endY

This field is deprecated.
Use the class methods to interact with this field so internal state can be maintained.

The y coordinate for the current end of the path given the previously applied transformation. Changes internally. Do not change.

startX

float startX

This field is deprecated.
Use the class methods to interact with this field so internal state can be maintained.

The x coordinate for the start of the path. Does not change. Do not change.

startY

float startY

This field is deprecated.
Use the class methods to interact with this field so internal state can be maintained.

The y coordinate for the start of the path. Does not change. Do not change.

Public constructors

ShapePath

ShapePath ()

ShapePath

ShapePath (float startX, 
                float startY)

Parameters
startX float

startY float

Public methods

addArc

void addArc (float left, 
                float top, 
                float right, 
                float bottom, 
                float startAngle, 
                float sweepAngle)

Add an arc to the ShapePath.

Parameters
left float: the X coordinate of the left side of the rectangle containing the arc oval.

top float: the Y coordinate of the top of the rectangle containing the arc oval.

right float: the X coordinate of the right side of the rectangle containing the arc oval.

bottom float: the Y coordinate of the bottom of the rectangle containing the arc oval.

startAngle float: start angle of the arc.

sweepAngle float: sweep angle of the arc.

applyToPath

void applyToPath (Matrix transform, 
                Path path)

Apply the ShapePath sequence to a Path under a matrix transform.

Parameters
transform Matrix: the matrix transform under which this ShapePath is applied

path Path: the path to which this ShapePath is applied

lineTo

void lineTo (float x, 
                float y)

Add a line to the ShapePath.

Parameters
x float: the x to which the line should be drawn.

y float: the y to which the line should be drawn.

quadToPoint

void quadToPoint (float controlX, 
                float controlY, 
                float toX, 
                float toY)

Add a quad to the ShapePath.

Parameters
controlX float: the control point x of the arc.

controlY float: the control point y of the arc.

toX float: the end x of the arc.

toY float: the end y of the arc.

reset

void reset (float startX, 
                float startY)

Resets the ShapePath using a default shadow. reset(float, float, float, float).

Parameters
startX float

startY float

reset

void reset (float startX, 
                float startY, 
                float shadowStartAngle, 
                float shadowSweepAngle)

Resets fields given the provided assignment parameters.

Parameters
startX float

startY float

shadowStartAngle float

shadowSweepAngle float