UNPKG

imagerot

Version:

A lightweight, cross-environment image library for applying unique effects via raw image buffers.

50 lines (49 loc) 1.41 kB
interface IRotItem { data: Uint8Array; width: number; height: number; } type TRotHandler = (params: IRotParams) => Promise<IRotItem>; type IRotData = readonly [Uint8Array | null, number, number]; interface IRotParams { data?: Buffer | File | IRotData | IRotItem | IRotData; url?: string; file?: string; } type TEffectOptions = { [key: string]: string | number; }; type TEffectItemBrowser = { name: string; browser: TEffectItem; pixelOp?: TPixelOp; }; type TEffectItemNode = { name: string; node: TEffectItem; pixelOp?: TPixelOp; }; type TEffectItemShared = { name: string; browser: TEffectItem; node: TEffectItem; pixelOp?: TPixelOp; }; type TEffectExport = TEffectItemBrowser | TEffectItemNode | TEffectItemShared; type TEffectItem = (params: IRotItem, options?: TEffectOptions | null) => Promise<Uint8Array>; type TEffectPoolItem = { method: TEffectItem; pixelOp?: TPixelOp; }; type TPixelOp<T = TEffectOptions> = (params: { index: number; data: Uint8Array; width?: number; height?: number; }, options?: T | null) => void; type TMode = (params: IRotItem & { effects: { [key: string]: TEffectPoolItem; }; }) => Promise<Uint8Array>; export { TEffectItem, TEffectOptions, TEffectExport, TEffectItemNode, TEffectItemBrowser, TEffectPoolItem, TPixelOp, IRotItem, TRotHandler, IRotParams, IRotData, TMode };