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 endX

public float endY

public float startX

public float startY

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)

Inherited methods

From class java.lang.Object

Fields

endX

float endX

endY

float endY

startX

float startX

startY

float startY

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)

Parameters
startX float

startY float