API

Interface SpriteAtlasPackOptions

Options for createSpriteAtlasFromFrames.

interface SpriteAtlasPackOptions {
    capacityPx?: readonly [number, number];
    maxWidthPx?: number;
    paddingPx?: number;
    premultipliedAlpha?: boolean;
    sampling?: SpriteSampling;
    srgb?: boolean;
}
Index
capacityPx?: readonly [number, number]

Pre-allocate the atlas texture at this [width, height] regardless of initial-content size, leaving headroom for later appendSpriteAtlasFrames calls (which never grow the texture). Required when sources is empty. Defaults to the size required by the initial sources (no append headroom).

maxWidthPx?: number

Shelf width (px) before wrapping to a new row. Default 1024.

paddingPx?: number

Transparent gap (px) between packed frames; guards against bilinear bleed. Default 1.

premultipliedAlpha?: boolean
sampling?: SpriteSampling

Min/mag filter for the packed texture. Default "nearest".

srgb?: boolean

Pack into an sRGB texture (rgba8unorm-srgb) so the GPU decodes the stored sRGB-encoded RGB to linear on sample. Use when the frame pixels are sRGB color (the common case for glyph/UI atlases) and the renderer composites in linear space (i.e. an sRGB render target). Alpha is unaffected. Default false — raw rgba8unorm, matching straight-bytes blending.