ShapeComponent

open class ShapeComponent(val shape: Shape = Shapes.rectShape, color: Int = Color.BLACK, val dynamicShader: DynamicShader? = null, margins: Dimensions = emptyDimensions(), val strokeWidthDp: Float = 0.0f, strokeColor: Int = Color.TRANSPARENT) : Component

ShapeComponent is a Component that draws a shape.

Parameters

shape

the Shape that will be drawn.

color

the color of the shape.

dynamicShader

an optional Shader provider used as the shape’s background.

margins

the Component’s margins.

strokeWidthDp

the width of the shape’s stroke (in dp).

strokeColor

the color of the stroke.

Inheritors

Constructors

Link copied to clipboard
constructor(shape: Shape = Shapes.rectShape, color: Int = Color.BLACK, dynamicShader: DynamicShader? = null, margins: Dimensions = emptyDimensions(), strokeWidthDp: Float = 0.0f, strokeColor: Int = Color.TRANSPARENT)

Properties

Link copied to clipboard
var color: Int

The color of the shape.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The color of the stroke.

Link copied to clipboard
val strokeWidthDp: Float = 0.0f

Functions

Link copied to clipboard

Removes this ShapeComponent’s drop shadow.

Link copied to clipboard
open override fun draw(context: DrawContext, left: Float, top: Float, right: Float, bottom: Float, opacity: Float)

Instructs the Component to draw itself at the given coordinates.

Link copied to clipboard
fun setShadow(radius: Float, dx: Float = 0.0f, dy: Float = 0.0f, color: Int = DEF_SHADOW_COLOR, applyElevationOverlay: Boolean = false): ShapeComponent

Applies a drop shadow.