...master 2026-11-12 (1037e2069+unstaged)

StrokeState

A StrokeState controls the properties of how stroking operations are performed. Besides controlling the line width, it is also possible to control line cap style, line join style, and the miter limit.

Constructors

class StrokeState(template)

Create a new empty stroke state object.

The Javascript object used as template allows for setting the following attributes:

var strokeState = new mupdf.StrokeState({
        lineCap: "Square",
        lineJoin: "Bevel",
        lineWidth: 2.0,
        miterLimit: 1.414,
        dashPhase: 11,
        dashPattern: [ 2, 3 ]
})

Instance methods

StrokeState.prototype.getLineCap()

Get the line cap style.

var lineCap = strokeState.getLineCap()

StrokeState.prototype.getLineJoin()

Get the line join style.

var lineJoin = strokeState.getLineJoin()

StrokeState.prototype.getLineWidth()

Get the line line width.

var width = strokeState.getLineWidth()

StrokeState.prototype.getMiterLimit()

Get the miter limit.

var limit = strokeState.getMiterLimit()

StrokeState.prototype.getDashPhase()

Get the dash pattern phase (where in the dash pattern stroking starts).

var limit = strokeState.getDashPhase()

StrokeState.prototype.getDashPattern()

Get the dash pattern as an array of numbers specifying alternating lengths of dashes and gaps, or null if none set.

var dashPattern = strokeState.getDashPattern()