import { ILTRect } from './rects/ILTRect'; import { DataURL } from './DataURLs'; import { IDimensions } from "./IDimensions"; import { ImageType } from "./ImageType"; export declare type RawImageData = ArrayBuffer | DataURL | HTMLImageElement; export interface ImageData { readonly data: ArrayBuffer | DataURL; readonly format: 'arraybuffer' | 'dataurl'; readonly type: ImageType; readonly width: number; readonly height: number; } export declare namespace ImageDatas { function toDataURL(image: ImageData): string; } export declare namespace Canvases { function toDataURL(data: HTMLCanvasElement | ArrayBuffer, opts?: ImageOpts): Promise; function toArrayBuffer(canvas: HTMLCanvasElement, opts?: ImageOpts): Promise; interface CropOpts extends ImageOpts, CanvasOpts { } function crop(image: RawImageData, rect: ILTRect, opts?: CropOpts): Promise; interface ResizeOpts extends ImageOpts, CanvasOpts { } function resize(data: RawImageData, dimensions: IDimensions, opts?: ResizeOpts): Promise; function extract(canvas: HTMLCanvasElement, rect: ILTRect, opts?: ImageOpts): Promise; function canvasToImageData(canvas: HTMLCanvasElement, opts?: ImageOpts): Promise; function arrayBufferToImageData(data: ArrayBuffer, dimensions: IDimensions, type: ImageType): Promise; } export interface CanvasOpts { canvas?: HTMLCanvasElement; } export interface ImageOpts { readonly type: ImageType; readonly quality: number; } export declare class DefaultImageOpts implements ImageOpts { readonly type = "image/png"; readonly quality = 1; }