Returns true
if stroke style is invalid (eg. no color) or scaledWidth is <= zero.
If the width unit type is relative (%) then returns the defined width multiplied by widthScale. Otherwise just returns the actual defined width.
If the width unit type is relative (%) then returns a copy of the lineDash array with each member multiplied by widthScale. Otherwise just returns lineDash unmodified.
If the width unit type is relative (%) then returns the dashOffset value multiplied by widthScale. Otherwise just returns dashOffset unmodified.
Optional
init: PartialDeep<StrokeStyle | { width?: string | number; color?: string }>Applies current stroke styling properties to the given canvas ctx
. rect
size is used to scale relative-sized stroke width.
Optional
rect: RectangleSize of the stroke in pixels or % of final drawing size.
Scaling factor for the stroke size when a relative (%) unit is used.
This affects return values from scaledWidth
, scaledLineDash
and scaledDashOffset
properties.
The value is always re-computed inside the render method if a rect
argument is passed to it.
Style (color/gradient/pattern/texture) for the stroke.
Context lineCap
property to apply. Default is 'butt'.
Context lineJoin
property to apply. Default is 'miter'.
Context miterLimit
property to apply. Default is 10
.
Optional array to pass to context's setLineDash()
method. Default is an empty array (solid line).
Context lineDashOffset
property to apply when specifying a dash pattern. Default is 0.
Stores stroke (line) canvas context property definitions, which includes stroke ("pen") style, line width, cap, join, miter, and dash array properties. Line width can be defined as a relative % and scaled automatically in the render method.