LineComponent

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

Draws lines.

Parameters

color

the fill color.

shape

the Shape.

margins

the margins.

strokeColor

the stroke color.

strokeThicknessDp

the stroke thickness (in dp).

shader

applied to the fill.

shadow

stores the shadow properties.

Constructors

Link copied to clipboard
constructor(color: Int, thicknessDp: Float = Defaults.LINE_COMPONENT_THICKNESS_DP, shape: Shape = Shape.Rectangle, margins: Dimensions = Dimensions.Empty, strokeColor: Int = Color.TRANSPARENT, strokeThicknessDp: Float = 0.0f, shader: DynamicShader? = null, shadow: Shadow? = null)

Properties

Link copied to clipboard

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

Link copied to clipboard

the line thickness (in dp).

Functions

Link copied to clipboard
open override fun copy(color: Int, shape: Shape, margins: Dimensions, strokeColor: Int, strokeThicknessDp: Float, shader: DynamicShader?, shadow: Shadow?): LineComponent
open fun copy(color: Int = this.color, thicknessDp: Float = this.thicknessDp, shape: Shape = this.shape, margins: Dimensions = this.margins, strokeColor: Int = this.strokeColor, strokeThicknessDp: Float = this.strokeThicknessDp, shader: DynamicShader? = this.shader, shadow: Shadow? = this.shadow): LineComponent

Creates a new LineComponent based on this one.

Link copied to clipboard
open fun drawHorizontal(context: DrawingContext, left: Float, right: Float, centerY: Float, thicknessScale: Float = 1.0f)

A convenience function for draw that draws the LineComponent horizontally.

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

A convenience function for draw that draws the LineComponent vertically.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open fun fitsInHorizontal(context: DrawingContext, 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: DrawingContext, 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 override fun hashCode(): Int
Link copied to clipboard
open fun intersectsVertical(context: DrawingContext, 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.