- I
Remarks
The stroke that is defined by instances of this type can be applied to an SVG element using either the static helper setStroke or the instance method applyTo.
This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.
The strings applying to this scheme are converted to Strokes:
'[thickness] [type] color'
thickness = thickness in px|thin|medium|thick
type = solid|dashed|dotted
color = CSS color stringsValid color strings are the same as for Color. Square brackets mark optional declarations.
Examples:
'3px dashed blue'
'thick blue'
'dotted blue'See Also
Developer's Guide
API
- setStroke
Members
Constructors
Initializes a new instance of the Stroke class using the given rgba values and thickness.
Parameters
- r: number
- The red value.
- g: number
- The green value.
- b: number
- The blue value.
- a?: number
- The alpha value, 255 by default.
- thickness?: number
- The thickness, 1 by default.
Properties
The visual appearance of the 'dashes' and 'gaps' specified by this property depends on the value of the property lineCap, too.
The predefined dash styles are designed for dash caps that extend into the 'gaps' like SQUARE and ROUND. With FLAT, the dashes might not look like expected, for example DOT will not be visible at all. Since FLAT is the default value, you should explicitly set another value in this case.
Property Value
Gets or sets the dash cap.
Property Value
Gets or sets the line-join property.
Property Value
Methods
Assigns the stroke defined by this instance to the given SVG element.
element.null strokes. If you are unsure whether the reference actually points to an instance, use the static helper method instead.Parameters
- element: SVGElement
- The element whose fill should be set.
- context: ICanvasContext
- The context.
See Also
API
- setStroke
Freezes and returns this instance.
Return Value
- Stroke
- This instance, made immutable.
Constants
See Also
Developer's Guide
Static Methods
Sets the Stroke on a given SVG element as the stroke.
stroke is null.Parameters
- stroke: Stroke
- The stroke that should be applied. If
null, the element's stroke is removed. - element: SVGElement
- The element whose stroke should be set.
- context: ICanvasContext
- The context to use for managing possible
defsentries.
See Also
API
- applyTo