import type { Glyph } from 'workers/process/glyph/familySource.js'; import type { ImageExtensions } from 'style/style.spec.js'; import type Session from './session.js'; import type TexturePack from './texturePack.js'; /** Metadata for an image source */ export type ImageMetadata = Record; /** Full metadata for an image source including name */ export interface ImageSourceMetadata { name: string; metadata: ImageMetadata; } /** * # ImageSource * * ## Description * A collection of images relating to a single source */ export default class ImageSource { active: boolean; name: string; path: string; fileType: ImageExtensions; metadata: ImageMetadata; session: Session; texturePack: TexturePack; /** * @param name - the name of the source * @param path - the path to the source * @param texturePack - the texture pack to store the glyphs/images into * @param session - the session * @param fileType - the file type */ constructor(name: string, path: string, texturePack: TexturePack, session: Session, fileType?: ImageExtensions); /** * Build the source * @param _mapID - the id of the map to build for * @returns the image metadata (we don't need to early ship this) */ build(_mapID: string): Promise; /** * Add an image to the source collection * @param mapID - the id of the map to build for * @param name - the name of the image * @param path - the path to the image * @returns the image metadata if successful */ addImage(mapID: string, name: string, path: string): Promise; /** * Fetch an image * @param path - the path to the image or metadata * @param mapID - the id of the map * @returns the image or metadata */ _fetch(path: string, mapID: string): Promise; }