forked from nsfw-filter/gif-frames
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gif-frames.d.ts
46 lines (39 loc) · 1.36 KB
/
gif-frames.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {Initializer} from "multi-integer-range";
declare module "@clicks/gif-frames" {
export default function gifFrames<T extends GifFrameOptions>(options: T): Promise<GifFrameData<T>[]>;
export default function gifFrames<T extends GifFrameOptions>(options: T, callback: (err: Error, frameData: GifFrameData<T>[]) => void): void;
type GifOutputType = "jpeg" | "jpg" | "gif" | "png" | "canvas";
type GifFrameData<T extends GifFrameOptions> = T["outputType"] extends "canvas" ? GifFrameCanvas : GifFrameBuffer;
interface GifFrameOptions {
url: string | ArrayBuffer;
frames: "all" | Initializer;
outputType?: GifOutputType;
quality?: number;
cumulative?: boolean;
}
interface GifFrameCanvas {
getImage(): HTMLCanvasElement;
frameIndex: number;
frameInfo: GifFrameInfo;
}
interface GifFrameBuffer {
getImage(): ImageData;
frameIndex: number;
frameInfo: GifFrameInfo;
}
interface GifFrameInfo {
x: number;
y: number;
width: number;
height: number;
has_local_palette: boolean;
palette_offset: number;
palette_size: number;
data_offset: number;
data_length: number;
transparent_index: number;
interlaced: boolean;
delay: number;
disposal: number;
}
}