For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface ImageAtlas

A single tile's packed copy of the icons and patterns its features reference, built in the worker so that the symbol layout can bake the positions within it straight into the vertex buffers. Each tile owns one, along with the texture it is uploaded to - as opposed to ImageManager, which owns the images of the whole style.

interface ImageAtlas {
    haveRenderCallbacks: string[];
    iconPositions: Record<string, ImagePosition>;
    image: RGBAImage;
    patchedUpdateVersion: number;
    patternPositions: Record<string, ImagePosition>;
    uploaded: boolean;
    addImages(
        images: { [_: string]: StyleImage },
        positions: { [_: string]: ImagePosition },
        bins: Rect[],
    ): void;
    patchUpdatedImage(
        position: ImagePosition,
        image: StyleImage,
        texture: Texture,
    ): void;
    patchUpdatedImages(imageManager: ImageManager, texture: Texture): void;
}
Index

Properties

haveRenderCallbacks: string[]
iconPositions: Record<string, ImagePosition>
image: RGBAImage
patchedUpdateVersion: number

The ImageManager.updateVersion this atlas' texture was last patched against. Starts out at -1 so that a freshly transferred atlas always patches once: images may have been updated between the moment the worker snapshotted them and the moment the atlas arrives.

patternPositions: Record<string, ImagePosition>
uploaded: boolean

Methods

  • Brings this atlas' texture back in sync with the images it was built from, re-uploading the ones that were replaced in the meantime.

    This runs for every in-view tile on every frame, so the common case of nothing having changed has to cost nothing: a single comparison against ImageManager.updateVersion ends the call. When something did change, only the images this atlas actually holds are looked at - a handful per tile - and ImageAtlas.patchUpdatedImage then skips the ones whose version still matches, leaving just the genuinely stale ones to upload.

    The render callbacks are dispatched first because they may update images themselves, and those updates have to be part of the version this call catches up with - otherwise an animated image would always be uploaded a frame late.

    Parameters

    Returns void

Was this helpful?