meo-skia-canvas
    Preparing search index...

    Interface CanvasFillStrokeStyles

    What fills and strokes are painted with -- a colour, a gradient, a pattern or a texture -- and the factories that build them.

    interface CanvasFillStrokeStyles {
        fillStyle:
            | CanvasPattern
            | CanvasGradient
            | Color4fInput
            | CanvasTexture
            | Shader;
        strokeStyle: | CanvasPattern
        | CanvasGradient
        | Color4fInput
        | CanvasTexture
        | Shader;
        createConicGradient(
            startAngle: number,
            x: number,
            y: number,
            endAngle?: number,
        ): CanvasGradient;
        createLinearGradient(
            x0: number,
            y0: number,
            x1: number,
            y1: number,
        ): CanvasGradient;
        createPattern(
            image: CanvasPatternSource,
            repetition: string | null,
        ): CanvasPattern | null;
        createRadialGradient(
            x0: number,
            y0: number,
            r0: number,
            x1: number,
            y1: number,
            r1: number,
        ): CanvasGradient;
        createTexture(
            spacing: Offset,
            options?: CreateTextureOptions,
        ): CanvasTexture;
    }

    Hierarchy (View Summary)

    Index
    fillStyle:
        | CanvasPattern
        | CanvasGradient
        | Color4fInput
        | CanvasTexture
        | Shader

    Solid color, gradient, pattern, or texture used for fills.

    Color inputs follow the [Color4fInput] convention:

    • A CSS string ("#ff8800", "rgb(...)", named colors) is parsed as sRGB-gamma.
    • A [r, g, b, a] array carries premultiplied linear-light floats interpreted in the surface's working color space; pass these to avoid the lossy sRGB-encoding round-trip used by the CSS form (the shape mirrors TextStyleInput.color and CanvasKit's Paint.setColor).

    MDN Reference

    strokeStyle:
        | CanvasPattern
        | CanvasGradient
        | Color4fInput
        | CanvasTexture
        | Shader

    Solid color, gradient, pattern, texture, or shader used for strokes. See fillStyle for the color-input contract.

    MDN Reference

    • MDN Reference

      The optional fourth argument is this library's own: the Canvas API always sweeps a full turn, and Skia can sweep any arc. Omitting it draws exactly what a browser draws.

      Parameters

      • startAngle: number
      • x: number
      • y: number
      • OptionalendAngle: number

      Returns CanvasGradient

    • Parameters

      • x0: number
      • y0: number
      • r0: number
      • x1: number
      • y1: number
      • r1: number

      Returns CanvasGradient