Class Canvas
Hierarchy
- Cell<V>
- Canvas (View Summary)
Methods
blur
Gaussian blur (reactive
radius). The backward pass runs an iterated Richardson–Lucy deconvolution seeded from the source (x ← x · H(target / H(x))), so untouched regions stay fixed. PutGet, not exact GetPut.Parameters
- radius: Val<number>
Returns this
brighterThan
brightness
Multiply RGB by reactive
k(alpha preserved). Invertible while k ≠ 0.Parameters
- k: Val<number>
Returns this
chroma
crop
derive
downsample
flipH
Horizontal flip.
Returns this
grayscale
invert
Per-channel invert (alpha preserved).
Returns this
lens
- lens(
this: Cell<Raster>,
fwd: (v: Raster) => Raster,
bwd: (target: Raster, current: Raster) => Raster,
): thisEndomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Parameters
Returns this
Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Returns this
Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Type Parameters
- V1
Returns Writable<Cell<V1>>
- lens<Os extends AnyOptics>(
this: Cell<Raster>,
...optics: Os,
): Writable<Cell<ChainResult<Raster, Os>>>Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Type Parameters
- Os extends AnyOptics
Returns Writable<Cell<ChainResult<Raster, Os>>>
meanColor
merge
peek
Returns Raster
spring
GPU per-pixel spring driver seeded from this value's texture. The host steps it and writes
current()back each frame.Parameters
Optionalopts: SpringOpts
Returns Spring
Staticcoerce
Staticderive
Staticis
Staticlens
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
fwd: (v: P) => Inner<InstanceType<C>>,
bwd: (target: Inner<InstanceType<C>>, v: P) => P,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
fwd: (vals: ReadValues<P>) => Inner<InstanceType<C>>,
bwd: (
target: Inner<InstanceType<C>>,
vals: ReadValues<P>,
) => BackUpdates<ReadValuesOrSkip<P>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
optic: AppliedOptic<P, Inner<InstanceType<C>>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
optic: AppliedOptic<ReadValues<P>, Inner<InstanceType<C>>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P, Os extends AnyOptics>(
this: C,
parent: Read<P>,
...optics: Os,
): ChainResult<P, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: neverWritable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
- Os extends AnyOptics
Returns ChainResult<P, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: never - lens<
C extends AnyCellCtor,
P extends readonly Read<unknown>[],
Os extends AnyOptics,
>(
this: C,
parents: P,
...optics: Os,
): ChainResult<ReadValues<P>, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: neverWritable lens, typed to this class.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N (a 2-argbwdreads the source, a 1-argbwdreconstructs it);Cls.lens(parent(s), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
- Os extends AnyOptics
Returns ChainResult<ReadValues<P>, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: never
Dimensions
(w, h)as a read-onlyVec.