open-vector-tile
Version:
This library reads/writes Open Vector Tiles
72 lines • 1.9 kB
TypeScript
import { PbfReader } from 'pbf-ts';
/** Image type */
export declare const enum ImageType {
/** PNG Image */
PNG = 0,
/** JPEG Image */
JPG = 1,
/** WEBP Image */
WEBP = 2,
/** GIF Image */
GIF = 3,
/** AVIF Image */
AVIF = 4,
/** SVG Image */
SVG = 5,
/** BMP Image */
BMP = 6,
/** RAW Image */
RAW = 7,
/** Unknown image type */
UNKNOWN = 8
}
/** String version of ImageType */
export type ImageTypeString = 'raw' | 'png' | 'jpg' | 'webp' | 'gif' | 'avif' | 'svg' | 'bmp' | 'unknown';
/** Elevation object to read from */
export declare class ImageData {
#private;
name: string;
private imagePos;
type: ImageTypeString;
width: number;
height: number;
/**
* @param pbf - the pbf protocol we are reading from
* @param end - the position to stop at
*/
constructor(pbf: PbfReader, end: number);
/**
* Reads the image data
* @returns - the image data
*/
image(): Uint8Array;
}
/** Necessary data to encode an image */
export interface ImageDataInput {
/** The name of the image */
name: string;
/** The image type */
type: ImageTypeString;
/** The width of the image */
width: number;
/** The height of the image */
height: number;
/** The raw image data */
image: Buffer | Uint8Array | ArrayBuffer;
}
/**
* @param input - the image data & metadata to encode
* @returns - the encoded tile data
*/
export declare function writeImageData(input: ImageDataInput): Uint8Array;
/**
* @param imageType - the enum to convert
* @returns - the string
*/
export declare function fromImageType(imageType: ImageType): ImageTypeString;
/**
* @param imageType - the string to convert
* @returns - the enum
*/
export declare function toImageType(imageType: ImageTypeString): ImageType;
//# sourceMappingURL=imageLayer.d.ts.map