import type { ImageErrorCode } from '@forgeax/engine-types'; /** * Decoded image input for shelfPack. `pixels` length must equal * `width * height * 4` (RGBA8); the field is carried so the caller can * blit into the atlas buffer without re-decoding inside this module. */ export interface AtlasImageInput { readonly name: string; readonly width: number; readonly height: number; readonly pixels: Uint8Array; } /** * One placed sprite inside the packed atlas. `(x, y)` is the top-left * corner in pixel coordinates; `(w, h)` mirrors the source dimensions. */ export interface AtlasRegion { readonly name: string; readonly x: number; readonly y: number; readonly w: number; readonly h: number; } export interface ShelfPackResult { readonly atlasWidth: number; readonly atlasHeight: number; readonly regions: ReadonlyArray; } /** * Detail shape used by both `atlas-empty-input` and `atlas-size-exceeded` * branches. Fields are optional because the two codes carry different * subsets; the caller projects each branch onto the matching * `ImageErrorDetail` variant before emitting the structured error. */ export interface ShelfPackError { readonly code: Extract; readonly detail: { readonly name?: string; readonly width?: number; readonly height?: number; readonly maxAtlasSize?: number; readonly receivedCount?: number; }; } export type ShelfPackOutcome = { readonly ok: true; readonly value: ShelfPackResult; } | { readonly ok: false; readonly error: ShelfPackError; }; export declare function shelfPack(images: ReadonlyArray, opts: { readonly maxAtlasSize: number; }): ShelfPackOutcome; //# sourceMappingURL=shelf-pack.d.ts.map