Stroke

Overview

Data type

A stroke defines the visual appearance of a line.

Attributes (data)

Name

Multiplicity

Type

Color

1

Color

DashStyle

1

DashStyle

Width

1

Double

Simplified Literals

Within this specification, a simplified type of literal is used to refer to a Stroke. This literal is composed of

The three components are separated by spaces.

For example, a Stroke with

is represented as 2mm #00ff00 Dot.

Mapping to SVG

A Stroke is mapped to a set of XML attributes, which are added to the SVG element (e.g., a svg:polygon or a svg:polyline element) that is drawn with the Stroke.

  • The Color of the Stroke is mapped to the stroke attribute. For the attribute value, see the SVG mapping for Color.

  • The DashStyle of the Stroke is mapped to the stroke-dasharray and stroke-dashoffset attributes as described in the SVG mapping for DashStyle. Note that these attribute values depend on the Width of the Stroke and on the linecap of the GraphicalPrimitive that uses the Stroke.

  • The Width of the Stroke is mapped to the stroke-width attribute. The attribute value is the concatenation of the string representation of the Width and the fixed string mm. That is, in terms of [CSS Values 4] we use an absolute length with the unit millimeters.

Example

For examples, see the SVG mapping sections of those subclasses of GraphicalPrimitive that have a Stroke attribute:

Color

Attribute (data)

The color of the Stroke.

Multiplicity: 1

Type: Color

DashStyle

Attribute (data)

The dash style of the Stroke.

Multiplicity: 1

Type: DashStyle

Width

Attribute (data)

The width of the Stroke in mm.

Multiplicity: 1

Type: Double