-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUPNG.d.ts
82 lines (70 loc) · 1.89 KB
/
UPNG.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Type definitions for upng-js 2.1
// Project: https://github.com/photopea/UPNG.js
// Definitions by: York Yao <https://github.com/plantain-00>, Sophie Kirschner <https://github.com/pineapplemachine>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface ImageFrameRect {
x: number;
y: number;
width: number;
height: number;
}
export interface ImageFrame {
rect: ImageFrameRect;
delay: number;
dispose: number;
blend: number;
}
export interface ImageTabACTL {
num_frames: number;
num_plays: number;
}
export interface ImageTabText {
[key: string]: string;
}
export interface ImageTabs {
acTL?: ImageTabACTL | undefined;
pHYs?: number[] | undefined;
cHRM?: number[] | undefined;
tEXt?: ImageTabText | undefined;
iTXt?: ImageTabText | undefined;
PLTE?: number[] | undefined;
hIST?: number[] | undefined;
tRNS?: (number | number[]) | undefined; // Depends on ctype
gAMA?: number | undefined;
sRGB?: number | undefined;
bKGD?: (number | number[]) | undefined; // Depends on ctype
}
export interface Image {
width: number;
height: number;
depth: number;
ctype: number;
frames: ImageFrame[];
tabs: ImageTabs;
data: ArrayBuffer;
}
export interface QuantizeResult {
abuf: ArrayBuffer;
inds: Uint8Array;
// Type is complicated and I am too lazy to work it out right now, sorry!
plte: any[];
}
export function encode(
imgs: ArrayBuffer[],
w: number,
h: number,
cnum: number,
dels?: number[]
): ArrayBuffer;
export function encodeLL(
imgs: ArrayBuffer[],
w: number,
h: number,
cc: number,
ac: number,
depth: number,
dels?: number[]
): ArrayBuffer;
export function decode(buffer: ArrayBuffer): Image;
export function toRGBA8(out: Image): ArrayBuffer[];
export function quantize(data: ArrayBuffer, psize: number): QuantizeResult;