/** * worker-api.ts * * Low-level bridge between JavaScript and the OpenSlide WASM module. * Runs inside a Web Worker. Handles cwrap binding, memory management, * virtual filesystem mounting, and pixel format conversion. */ import type { OpenSlideWasmModule, SlideInfo, Dimensions, VirtualFile } from './types.js'; import type { SyncIo } from './io/sync-client.js'; export declare class WorkerApi { private mod; private fn; /** Shared I/O channel; mounts route through the broker when present. */ private io; /** Broker file keys per mount, released on unmount. */ private brokerMounts; constructor(mod: OpenSlideWasmModule, io?: SyncIo | null); /** Check for an OpenSlide error after a call and throw if present. */ private checkError; /** Read a NULL-terminated array of C strings from a pointer. */ private readStringArray; /** * Copy `pixels` ARGB words from the WASM heap at `ptr` into a fresh * (transferable) buffer, converting to straight RGBA in the same pass. * The heap view is taken fresh per call — memory growth invalidates * earlier views — and the caller must not await between readRegion * returning and this copy. */ private copyHeapArgbAsRgba; open(path: string): Promise; close(handle: number): Promise; getSlideInfo(handle: number): Promise; /** * Read a region and return the raw RGBA bytes as a transferable ArrayBuffer. */ readRegion(handle: number, x: number, y: number, level: number, w: number, h: number): Promise; readAssociatedImage(handle: number, name: string): Promise<{ buffer: ArrayBuffer; width: number; height: number; }>; getAssociatedImageDimensions(handle: number, name: string): Promise; detectVendor(path: string): Promise; getVersion(): Promise; getIccProfile(handle: number): Promise; mountFiles(files: File[], mountId: string): string; /** * Mount files with directory structure (for multi-file formats like MRXS). * * WORKERFS mounts are flat — each mount point gets a set of files with no * subdirectories. So we group files by parent directory and create a separate * WORKERFS mount for each group. The root dir must be created with mkdir * first, then subdirectories get their own WORKERFS mounts. * * Layout for MRXS "image_1.mrxs" + "image_1/Slidedat.ini" + "image_1/Data0001.dat": * /mnt//root/ ← WORKERFS mount with [image_1.mrxs] * /mnt//root/image_1/ ← WORKERFS mount with [Slidedat.ini, Data0001.dat, ...] */ mountDir(entries: VirtualFile[], indexFile: string, mountId: string): string; mountUrl(url: string, mountId: string): Promise; unmount(mountId: string): void; } //# sourceMappingURL=worker-api.d.ts.map