skia
    Preparing search index...

    Interface PathConstructorAndFactory

    Contains the ways to create a Path.

    interface PathConstructorAndFactory {
        new PathConstructorAndFactory(): Path;
        CanInterpolate(path1: Path, path2: Path): boolean;
        MakeFromCmds(cmds: InputCommands): Path | null;
        MakeFromOp(one: Path, two: Path, op: EmbindEnumEntity): Path | null;
        MakeFromPathInterpolation(
            start: Path,
            end: Path,
            weight: number,
        ): Path | null;
        MakeFromSVGString(str: string): Path | null;
        MakeFromVerbsPointsWeights(
            verbs: VerbList,
            points: InputFlattenedPointArray,
            weights?: WeightList,
        ): Path;
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Returns true if the two paths contain equal verbs and equal weights.

      Parameters

      • path1: Path

        first path to compate

      • path2: Path

        second path to compare

      Returns boolean

      true if Path can be interpolated equivalent

    • Interpolates between Path with point array of equal size. Copy verb array and weights to result, and set result path to a weighted average of this path array and ending path.

      weight is most useful when between zero (ending path) and one (this path); will work with values outside of this range.

      interpolate() returns undefined if path is not the same size as ending path. Call isInterpolatable() to check Path compatibility prior to calling interpolate().

      Parameters

      • start: Path

        path to interpolate from

      • end: Path

        path to interpolate with

      • weight: number

        contribution of this path, and one minus contribution of ending path

      Returns Path | null

      Path replaced by interpolated averages or null if not interpolatable

    • Creates a new path from the provided SVG string. If this fails, null will be returned instead.

      Parameters

      • str: string

      Returns Path | null

    • Creates a new path using the provided verbs and associated points and weights. The process reads the first verb from verbs and then the appropriate number of points from the FlattenedPointArray (e.g. 2 points for moveTo, 4 points for quadTo, etc). If the verb is a conic, a weight will be read from the WeightList. If the data is malformed (e.g. not enough points), the resulting path will be empty. If memory is passed in with Malloced TypedArrays, modifying the data after creating the path will result in undefined behavior.

      Parameters

      • verbs: VerbList

        the verbs that create this path, in the order of being drawn.

      • points: InputFlattenedPointArray

        represents n points with 2n floats.

      • Optionalweights: WeightList

        used if any of the verbs are conics, can be omitted otherwise.

      Returns Path