LineComponent

open class LineComponent(color: Int, var thicknessDp: Float = Defaults.LINE_COMPONENT_THICKNESS_DP, val shape: Shape = Rectangle, val dynamicShader: DynamicShader? = null, val margins: Dimensions = Dimensions.Empty, val strokeWidthDp: Float = 0.0f, strokeColor: Int = Color.TRANSPARENT) : ShapeComponent

Draws a line.

Constructors

Link copied to clipboard
constructor(color: Int, thicknessDp: Float = Defaults.LINE_COMPONENT_THICKNESS_DP, shape: Shape = Rectangle, dynamicShader: DynamicShader? = null, margins: Dimensions = Dimensions.Empty, 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
open override val margins: Dimensions
Link copied to clipboard
Link copied to clipboard

color if it’s not Color.TRANSPARENT, and strokeColor otherwise.

Link copied to clipboard

The color of the stroke.

Link copied to clipboard
val strokeWidthDp: Float = 0.0f
Link copied to clipboard

the thickness of the line.

Functions

Link copied to clipboard

Removes this ShapeComponent’s drop shadow.

Link copied to clipboard
open fun copy(color: Int = this.color, thicknessDp: Float = this.thicknessDp, shape: Shape = this.shape, dynamicShader: DynamicShader? = this.dynamicShader, margins: Dimensions = this.margins, strokeWidthDp: Float = this.strokeWidthDp, strokeColor: Int = this.strokeColor): LineComponent

Creates a new LineComponent based on this one.

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
open fun drawHorizontal(context: DrawContext, left: Float, right: Float, centerY: Float, thicknessScale: Float = 1.0f, opacity: Float = 1.0f)

A convenience function for draw that draws the LineComponent horizontally.

Link copied to clipboard
open fun drawVertical(context: DrawContext, top: Float, bottom: Float, centerX: Float, thicknessScale: Float = 1.0f, opacity: Float = 1.0f)

A convenience function for draw that draws the LineComponent vertically.

Link copied to clipboard
open fun fitsInHorizontal(context: DrawContext, left: Float, right: Float, centerY: Float, boundingBox: RectF, thicknessScale: Float = 1.0f): Boolean

Checks whether the LineComponent fits horizontally within the given boundingBox with its current thicknessDp.

Link copied to clipboard
open fun fitsInVertical(context: DrawContext, top: Float, bottom: Float, centerX: Float, boundingBox: RectF, thicknessScale: Float = 1.0f): Boolean

Checks whether the LineComponent fits vertically within the given boundingBox with its current thicknessDp.

Link copied to clipboard
open fun intersectsVertical(context: DrawContext, top: Float, bottom: Float, centerX: Float, boundingBox: RectF, thicknessScale: Float = 1.0f): Boolean

Checks whether the LineComponent vertically intersects the given boundingBox with its current thicknessDp.

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

Applies a drop shadow.