StrokePaint

data class StrokePaint(var color: StyleValue<Color> = StyleValue.Constant(Color.Red), var opacity: StyleValue<Double> = StyleValue.Constant(1.0), var thickness: StyleValue<Double> = StyleValue.Constant(1.0), var lineJoin: StyleValue<LineJoin> = StyleValue.Constant(LineJoin.ROUND), var lineCap: StyleValue<LineCap> = StyleValue.Constant(LineCap.ROUND), var miterLimit: StyleValue<Double> = StyleValue.Constant(2.0)) : Paint

Stroke style shared by line-capable paint types (for example LineLayerPaint, FillLayerPaint.stroke, and CircleLayerPaint.stroke).

On FillLayerPaint, outline width is emitted on a companion line style layer ({layerId}::stroke) because Mapbox fill layers have no width property. thickness of 0 maps to a thin ~0.5px line (half of the old fill-outline-color edge). Larger values are scaled by FillLayerPaint.OUTLINE_WIDTH_SCALE.

Values are mapped to Mapbox-style line properties where applicable:

For GLES stencil line masks, lineJoin, lineCap, and miterLimit are also consumed by the ribbon mesh builder to approximate Mapbox/JS line appearance.

Example:

val stroke = StrokePaint().apply {
thickness = StyleValue.Constant(5.0)
lineJoin = StyleValue.Constant(LineJoin.MITER)
lineCap = StyleValue.Constant(LineCap.ROUND)
miterLimit = StyleValue.Constant(2.0)
}

Constructors

Link copied to clipboard
constructor(color: StyleValue<Color> = StyleValue.Constant(Color.Red), opacity: StyleValue<Double> = StyleValue.Constant(1.0), thickness: StyleValue<Double> = StyleValue.Constant(1.0), lineJoin: StyleValue<LineJoin> = StyleValue.Constant(LineJoin.ROUND), lineCap: StyleValue<LineCap> = StyleValue.Constant(LineCap.ROUND), miterLimit: StyleValue<Double> = StyleValue.Constant(2.0))

Properties

Link copied to clipboard

Stroke color.

Link copied to clipboard

Cap style used at the start and end of open line strings.

Link copied to clipboard

Join style used where connected line segments meet.

Link copied to clipboard

Mapbox-style line-miter-limit (ratio). Clamps miter extension for LineJoin.MITER on stencil ribbons and is emitted to Mapbox layout when the line layer is not stencil-only.

Link copied to clipboard

Stroke alpha in the range [0.0, 1.0].

Link copied to clipboard

Stroke width in screen pixels.