Skip to main content
Module

x/canvas/mod.ts>RuntimeEffect

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Latest
interface RuntimeEffect
import { type RuntimeEffect } from "https://deno.land/x/canvas@v1.4.1/mod.ts";

See SkRuntimeEffect.h for more details.

Methods

makeShader(
uniforms: Float32Array | number[],
isOpaque?: boolean,
localMatrix?: InputMatrix,
): Shader

Returns a shader executed using the given uniform data.

makeShaderWithChildren(
uniforms: Float32Array | number[],
isOpaque?: boolean,
children?: Shader[],
localMatrix?: InputMatrix,
): Shader

Returns a shader executed using the given uniform data and the children as inputs.

getUniform(index: number): SkSLUniform

Returns the nth uniform from the effect.

getUniformCount(): number

Returns the number of uniforms on the effect.

getUniformFloatCount(): number

Returns the total number of floats across all uniforms on the effect. This is the length of the uniforms array expected by makeShader. For example, an effect with a single float3 uniform, would return 1 from getUniformCount(), but 3 from getUniformFloatCount().

getUniformName(index: number): string

Returns the name of the nth effect uniform.