@realsee/five
Version:
Realsee Renderer SDK
43 lines (42 loc) • 1.79 kB
TypeScript
interface ImageURLMappings {
[publicDomain: string]: {
"type"?: string;
"pano": [string, string];
"tile": [string, string];
"model": [string, string];
"texture": [string];
"default": [string];
};
}
interface ImageURLOptions {
/** 图片类型标识 */
key: string;
/** 图片尺寸参数 尽量使用 2 的幂次 如 256 512 1024 */
size?: number;
/** 图片质量参数(0-100) */
quality?: number;
/** 图片格式参数 */
format?: "jpg" | "jpeg" | "png" | "heif" | "heic" | "webp" | "avif";
/** 图片裁切 */
cut?: [x: number, y: number, width: number, height: number];
/** 锐化参数 海外不支持 */
sharpen?: number;
/** 腾讯云在做裁切, 旋转等操作时,需要此参数,应用 exif orientation */
forceUseExifOrientation?: boolean;
/** 域名匹配规则 */
mappings?: ImageURLMappings;
}
/**
* URL 地址的转换
* @param source - url 原地址
* @param options - url 转换参数
* @returns url 转换结果
*/
declare function imageURL(source: string, options: ImageURLOptions): string;
declare function applyImageURLOptions(source: string, imageURLTransform: ((source: string, options: ImageURLOptions) => string) | undefined, imageURLOptions: ImageURLOptions): string;
/** 从 url 获取图片尺寸, 图片中有 cube_<size> 特征 */
declare function getImageSizeFromURL(url: string): number | null;
/** 从 url 替换图片尺寸, 图片中有 cube_<size> 特征 */
declare function replaceImageSize(url: string, size: number): string;
declare function getImageSizeLevel(size: number): number;
export { imageURL, ImageURLOptions, applyImageURLOptions, ImageURLMappings, getImageSizeFromURL, replaceImageSize, getImageSizeLevel };