Stroke 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:
color ->
line-color(fill outlines use companion::strokeline layer)opacity ->
line-opacitythickness ->
line-width(fill outlines scaled by FillLayerPaint.OUTLINE_WIDTH_SCALE)lineJoin ->
line-joinlineCap ->
line-capmiterLimit ->
line-miter-limit
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
Properties
Stroke color.
Cap style used at the start and end of open line strings.
Join style used where connected line segments meet.
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.
Stroke alpha in the range [0.0, 1.0].
Stroke width in screen pixels.