{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

CornerBasedShape

public abstract class CornerBasedShape implements Shape

Known direct subclasses
AbsoluteCutCornerShape

A shape describing the rectangle with cut corners.

AbsoluteRoundedCornerShape

A shape describing the rectangle with rounded corners.

CutCornerShape

A shape describing the rectangle with cut corners.

RoundedCornerShape

A shape describing the rectangle with rounded corners.


Base class for Shapes defined by four CornerSizes.

See also
RoundedCornerShape

for an example of the usage.

Summary

Public constructors

CornerBasedShape(
    @NonNull CornerSize topStart,
    @NonNull CornerSize topEnd,
    @NonNull CornerSize bottomEnd,
    @NonNull CornerSize bottomStart
)

Public methods

final @NonNull CornerBasedShape

Creates a copy of this Shape with a new corner size.

abstract @NonNull CornerBasedShape
copy(
    @NonNull CornerSize topStart,
    @NonNull CornerSize topEnd,
    @NonNull CornerSize bottomEnd,
    @NonNull CornerSize bottomStart
)

Creates a copy of this Shape with a new corner sizes.

final @NonNull Outline
createOutline(
    @NonNull Size size,
    @NonNull LayoutDirection layoutDirection,
    @NonNull Density density
)

Creates Outline of this shape for the given size.

abstract @NonNull Outline
createOutline(
    @NonNull Size size,
    float topStart,
    float topEnd,
    float bottomEnd,
    float bottomStart,
    @NonNull LayoutDirection layoutDirection
)

Creates Outline of this shape for the given size.

final @NonNull CornerSize

a size of the bottom end corner

final @NonNull CornerSize

a size of the bottom start corner

final @NonNull CornerSize

a size of the top end corner

final @NonNull CornerSize

a size of the top start corner

Public constructors

CornerBasedShape

public CornerBasedShape(
    @NonNull CornerSize topStart,
    @NonNull CornerSize topEnd,
    @NonNull CornerSize bottomEnd,
    @NonNull CornerSize bottomStart
)
Parameters
@NonNull CornerSize topStart

a size of the top start corner

@NonNull CornerSize topEnd

a size of the top end corner

@NonNull CornerSize bottomEnd

a size of the bottom end corner

@NonNull CornerSize bottomStart

a size of the bottom start corner

Public methods

copy

public final @NonNull CornerBasedShape copy(@NonNull CornerSize all)

Creates a copy of this Shape with a new corner size.

Parameters
@NonNull CornerSize all

a size to apply for all four corners

copy

public abstract @NonNull CornerBasedShape copy(
    @NonNull CornerSize topStart,
    @NonNull CornerSize topEnd,
    @NonNull CornerSize bottomEnd,
    @NonNull CornerSize bottomStart
)

Creates a copy of this Shape with a new corner sizes.

Parameters
@NonNull CornerSize topStart

a size of the top start corner

@NonNull CornerSize topEnd

a size of the top end corner

@NonNull CornerSize bottomEnd

a size of the bottom end corner

@NonNull CornerSize bottomStart

a size of the bottom start corner

createOutline

public final @NonNull Outline createOutline(
    @NonNull Size size,
    @NonNull LayoutDirection layoutDirection,
    @NonNull Density density
)

Creates Outline of this shape for the given size.

Parameters
@NonNull Size size

the size of the shape boundary.

@NonNull LayoutDirection layoutDirection

the current layout direction.

@NonNull Density density

the current density of the screen.

Returns
@NonNull Outline

Outline of this shape for the given size.

createOutline

public abstract @NonNull Outline createOutline(
    @NonNull Size size,
    float topStart,
    float topEnd,
    float bottomEnd,
    float bottomStart,
    @NonNull LayoutDirection layoutDirection
)

Creates Outline of this shape for the given size.

Parameters
@NonNull Size size

the size of the shape boundary.

float topStart

the resolved size of the top start corner

float topEnd

the resolved size for the top end corner

float bottomEnd

the resolved size for the bottom end corner

float bottomStart

the resolved size for the bottom start corner

@NonNull LayoutDirection layoutDirection

the current layout direction.

getBottomEnd

public final @NonNull CornerSize getBottomEnd()

a size of the bottom end corner

getBottomStart

public final @NonNull CornerSize getBottomStart()

a size of the bottom start corner

getTopEnd

public final @NonNull CornerSize getTopEnd()

a size of the top end corner

getTopStart

public final @NonNull CornerSize getTopStart()

a size of the top start corner