UNPKG

@bitblit/asyncglk

Version:
68 lines (67 loc) 2.02 kB
export interface ImageSize { height: number; width: number; } export interface BlorbChunk { /** Resource descriptions */ alttext?: string; /** Whether a data chunk is binary */ binary?: boolean; /** The original Chunk ID FourCC */ blorbtype?: string; content?: Uint8Array; /** Cached image dimensions */ imagesize?: ImageSize; /** Image type */ type?: string; /** External URL for image */ url?: string; /** Resource usage */ usage: 'data' | 'exec' | 'pict' | 'sound'; } export interface ImageInfo extends BlorbChunk { height?: number; /** The resource number */ image: number; width?: number; } export interface BlorbDataChunk { binary: boolean; data: Uint8Array; } export interface InfoMapResource { height: number; image: number; url: string; width: number; } export type InfoMap = Record<string, InfoMapResource>; export declare class Blorb { classname: string; /** Chunks are indexed with "USE:NUMBER" keys */ chunks: Record<string, BlorbChunk>; private coverimagenum?; private debugdata?; private is_inited; private metadata; constructor(data?: Uint8Array); init(data: any[]): void; init(data: InfoMap, options: { format: 'infomap'; }): void; init(data: Uint8Array): void; getlibrary(): null; get_chunk(usage: string, num: number): BlorbChunk | null; get_cover_pict(): number | null; get_data_chunk(num: number): BlorbDataChunk | null; get_debug_info(): Uint8Array | undefined; /** Return the game file chunk, or null if there isn't one. * If type is provided (GLUL or ZCOD) then the game file is checked to ensure it matches */ get_exec_data(gametype?: 'GLUL' | 'ZCOD'): Uint8Array | null; get_image_info(num: number): ImageInfo | null; get_image_url(num: number): string | null; get_metadata(field: string): string; inited(): boolean; } export declare function is_blorb(data: Uint8Array): boolean;