A utility class that holds all properties of a Stroke.
Implements
Inheritance Hierarchy

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 strings

Valid 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

No filters for this type

Constructors

Initializes a new instance of the Stroke class using the given fill and thickness.

Parameters

fill?: Fill
conversion
The fill.
thickness?: number
The thickness.
Initializes a new instance of the Stroke class using the given rgba values and thickness.
The rgba values must be between 0 and 255.

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

Gets or sets the dash style for the Stroke.

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 LineCap.SQUARE and LineCap.ROUND. With LineCap.FLAT, the dashes might not look like expected, for example DashStyle.DOT will not be visible at all. Since LineCap.FLAT is the default value, you should explicitly set another value in this case.

conversionfinal

Property Value

The dash style. The values of a dash style are in terms of multiples of the thickness of this pen. This is different from the corresponding properties of a SVG stroke.
Gets or sets the fill for the Stroke.
conversionfinal

Property Value

The fill.
Gets or sets the dash cap.
conversionfinal

Property Value

The dash cap.
Gets or sets the line-join property.
conversionfinal

Property Value

The line join property.
Gets or sets the miter limit.
final

Property Value

The miter limit.
Gets or sets the thickness of the stroke.
final

Property Value

The thickness.

Methods

Assigns the stroke defined by this instance to the given SVG element.
This method is very similar in functionality to its static method counter part setStroke. However since this method is an instance method, it cannot be called on non-existing/null strokes. If you are unsure whether the reference actually points to an instance, use the static helper method instead.
final

Parameters

element: SVGElement
The element whose fill should be set.
context: ICanvasContext
The context.

See Also

API
setStroke
Clones this instance by returning a memberwise clone, or by returning this if this instance is frozen.
final

Return Value

Object
An instance of the same type as this instance.
Clones the current value of this instance to a new unfrozen Stroke.
final

Return Value

Stroke
A new unfrozen Stroke instance with the value of the current instance.
Freezes and returns this instance.
Freezing an object makes it immutable, which can result in performance enhancements.
final

Return Value

Stroke
This instance, made immutable.
Determines if this instance is frozen.
final

Return Value

boolean
true if this instance is frozen; otherwise, false.

Constants

Gets a frozen Stroke that uses Color.ALICE_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.ANTIQUE_WHITE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.AQUA as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.AQUAMARINE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.AZURE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BEIGE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BISQUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BLACK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BLANCHED_ALMOND as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BLUE_VIOLET as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BROWN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.BURLY_WOOD as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CADET_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CHARTREUSE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CHOCOLATE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CORAL as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CORNFLOWER_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CORNSILK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CRIMSON as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CURRENT_COLOR as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.CYAN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_CYAN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_GOLDENROD as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_KHAKI as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_MAGENTA as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_OLIVE_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_ORANGE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_ORCHID as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_RED as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_SALMON as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_SEA_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_SLATE_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_SLATE_GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_TURQUOISE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DARK_VIOLET as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DEEP_PINK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DEEP_SKY_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DIM_GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.DODGER_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.FIREBRICK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.FLORAL_WHITE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.FOREST_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.FUCHSIA as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GAINSBORO as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GHOST_WHITE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GOLD as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GOLDENROD as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.GREEN_YELLOW as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.HONEYDEW as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.HOT_PINK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.INDIAN_RED as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.INDIGO as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.IVORY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.KHAKI as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LAVENDER as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LAVENDER_BLUSH as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LAWN_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LEMON_CHIFFON as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_CORAL as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_CYAN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_GOLDENROD_YELLOW as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_PINK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_SALMON as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_SEA_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_SKY_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_SLATE_GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_STEEL_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIGHT_YELLOW as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIME as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LIME_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.LINEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MAGENTA as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MAROON as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_AQUAMARINE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_ORCHID as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_PURPLE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_SEA_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_SLATE_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_SPRING_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_TURQUOISE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MEDIUM_VIOLET_RED as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MIDNIGHT_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MINT_CREAM as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MISTY_ROSE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.MOCCASIN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.NAVAJO_WHITE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.NAVY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.OLD_LACE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.OLIVE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.OLIVE_DRAB as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.ORANGE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.ORANGE_RED as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.ORCHID as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PALE_GOLDENROD as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PALE_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PALE_TURQUOISE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PALE_VIOLET_RED as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PAPAYA_WHIP as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PEACH_PUFF as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PERU as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PINK as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PLUM as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.POWDER_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.PURPLE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.RED as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.ROSY_BROWN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.ROYAL_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SADDLE_BROWN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SALMON as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SANDY_BROWN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SEA_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SEA_SHELL as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SIENNA as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SILVER as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SKY_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SLATE_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SLATE_GRAY as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SNOW as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.SPRING_GREEN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.STEEL_BLUE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.TAN as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.TEAL as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.THISTLE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.TOMATO as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.TRANSPARENT as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.TURQUOISE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.VIOLET as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.WHEAT as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.WHITE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.WHITE_SMOKE as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.YELLOW as its fill and has a thickness of 1.
Gets a frozen Stroke that uses Color.YELLOW_GREEN as its fill and has a thickness of 1.

Static Methods

Creates a Stroke instance from the given stroke-like object by performing automatic type conversion.
static

Parameters

strokeLike: Stroke
conversion
The object to convert to a Stroke.

Return Value

Stroke
The given strokeLike if it is already a Stroke, or a new instance initialized to the values found in strokeLike.
Sets the Stroke on a given SVG element as the stroke.
This method is very similar in functionality to its instance method counter part applyTo. However being static, it also allows for the case where the stroke is null.
static

Parameters

stroke: Stroke
conversion
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 defs entries.

See Also

API
applyTo