DisplayShapeCompat

Compatibility class for representing the physical shape of a display.

This class can be used to obtain a Path representing the display's shape, which can be useful for drawing or layout purposes, especially on devices with non-rectangular displays (e.g., circular or displays with rounded corners).

Instances of DisplayShapeCompat can be created in a few ways:

  • Using create to parse an SVG path data string. This is suitable for custom or complex display shapes.
  • Using create to define a common shape, such as a circle or a rectangle with specified corner radii.
The Path representing the shape can be retrieved using getPath.

Functions

Link copied to clipboard
@NonNull
open fun create(@NonNull spec: @NonNull String, physicalPixelDisplaySizeRatio: Float, displayWidth: Int, displayHeight: Int): @NonNull DisplayShapeCompat
Creates a DisplayShapeCompat from an SVG path specification string.
@NonNull
open fun create(displayWidth: Int, displayHeight: Int, isCircular: Boolean, topLeftRadius: Int, topRightRadius: Int, bottomRightRadius: Int, bottomLeftRadius: Int): @NonNull DisplayShapeCompat
Creates a DisplayShapeCompat representing a rectangle with potentially rounded corners or a circular shape.
Link copied to clipboard
open fun equals(@Nullable o: @Nullable Any): Boolean
Link copied to clipboard
@NonNull
open fun getPath(): @NonNull Path
Returns a Path of the display shape.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
@NonNull
open fun toString(): @NonNull String