Preparing search index...

    Class VectorStrokeBuilder

    A mutable builder for an immutable VectorStroke style. Start one with VectorStrokeBuilder.create, optionally refine with VectorStrokeBuilder#setCap, VectorStrokeBuilder#setJoin, VectorStrokeBuilder#setMiterLimit, and VectorStrokeBuilder#setDash, then call VectorStrokeBuilder#build to produce the stroke. The builder remains usable after build().

    Lens Scripting Version 370

    // A dashed round-capped stroke, reusable across multiple stroked paths.
    var sb = VectorStrokeBuilder.create(6);
    sb.setCap(VectorComposite.LineCap.Round);
    sb.setJoin(VectorComposite.LineJoin.Round);
    sb.setDash([24, 12], 0);
    var stroke = sb.build();

    Hierarchy (View Summary)

    Index

    Methods

    • Returns a new immutable VectorStroke that snapshots the current builder state. The builder remains usable afterward; the returned stroke is an independent snapshot.

      Returns VectorStroke

      Lens Scripting Version 370

    • Creates a builder for a stroke with the given width. Throws if width is not greater than 0, or if width is not finite.

      Parameters

      • width: number

        The stroke width (Number, must be > 0), in composite coordinate space.

      Returns VectorStrokeBuilder

      Lens Scripting Version 370

    • Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

      Returns string

      Lens Scripting Version 370

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Sets the VectorComposite.LineCap — how the ends of open sub-paths and dash segments are rendered. Defaults to Butt (the SVG default).

      Parameters

      Returns void

      Lens Scripting Version 370

    • Sets an optional dash pattern. pattern is an array of finite, non-negative Numbers defining alternating on/off segment lengths; an empty array (the default) means a continuous stroke. offset is a finite phase offset into the pattern. An odd-length pattern is valid — ThorVG/SVG repeat it to an even length internally. Throws if any pattern entry is negative or not finite, or if offset is not finite.

      Parameters

      • pattern: number[]

        An array of alternating on/off lengths (each >= 0, finite); empty = no dashing.

      • offset: number

        Phase offset into the pattern (Number, finite).

      Returns void

      Lens Scripting Version 370

    • Sets the VectorComposite.LineJoin — how corners between connected path segments are rendered. Defaults to Miter (the SVG default).

      Parameters

      Returns void

      Lens Scripting Version 370

    • Sets the miter limit — the ratio at which a Miter join falls back to a bevel. Must be finite and >= 1. Defaults to 4 (the SVG default). Throws if limit is less than 1, or if limit is not finite.

      Parameters

      • limit: number

        The miter limit (Number, must be >= 1).

      Returns void

      Lens Scripting Version 370