Skip to content

Documentation / spryte / RendererOptions

Interface: RendererOptions ​

Defined in: renderer.ts:6

Properties ​

backend? ​

optional backend?: "2d" | "webgl2" | "auto"

Defined in: renderer.ts:8

auto (default) uses WebGL2 and falls back to Canvas 2D; webgl2 throws where it's unavailable.


blendSpace? ​

optional blendSpace?: "srgb" | "linear"

Defined in: renderer.ts:33

Where ink meets paper. srgb (default) mixes the sRGB bytes, as CSS and Canvas 2D do: anti-aliased edges come out dark, so dark-on-light text and shapes look heavier and light-on-dark ones thinner. linear mixes in linear light, so swapping the two colours keeps the weight, and glows and soft edges add up like light. It draws into an sRGB framebuffer and copies it to the canvas at end(), one extra full-screen pass. Colour images are stored as sRGB; mark data images (MSDF atlases, lookup tables) with asData before their first draw. Custom shaders receive linear colours and convert their own colour uniforms with spryte_toLinear. WebGL2 only: the Canvas 2D fallback always mixes sRGB. Default srgb.


mipmaps? ​

optional mipmaps?: boolean

Defined in: renderer.ts:17

Build mip levels for every image on upload, so smooth images drawn well below their size (zoomed-out maps, charts, thumbnails) stay steady instead of shimmering. Costs a third more GPU memory per image and a little upload time. Sprite sheets need a few pixels of padding between frames, or neighbours bleed in at small sizes. WebGL2 only: Canvas 2D ignores it. Pixel-art (smooth: false) draws are unaffected. Default false.


smooth? ​

optional smooth?: boolean

Defined in: renderer.ts:10

Linear filtering for images by default. Pass false for pixel art. Default true.


transparent? ​

optional transparent?: boolean

Defined in: renderer.ts:23

See-through canvas: a clear colour with alpha (such as "#0000") lets the page, or another canvas, show through. For overlays, such as drawing particles over a PixiJS or DOM scene. Default false (opaque, which lets the compositor skip blending).