-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtypes.d.ts
64 lines (55 loc) · 1.39 KB
/
types.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
type Format = "rgb565" | "rgb444" | "rgba4444";
type QuantizeOptions = {
format?: Format;
oneBitAlpha?: boolean | number;
clearAlpha?: boolean;
clearAlphaThreshold?: number;
clearAlphaColor?: number;
};
type GIFEncoderOpts = {
auto?: boolean;
initialCapacity?: number;
};
type WriteFrameOpts = {
palette?: number[][];
first?: boolean;
transparent?: boolean;
transparentIndex?: number;
delay?: number;
repeat?: number;
dispose?: number;
};
type Encoder = {
writeFrame: (
index: Uint8Array,
width: number,
height: number,
ops?: WriteFrameOpts,
) => void;
finish: () => void;
bytes: () => Uint8Array;
bytesView: () => Uint8Array;
writeHeader: () => void;
reset: () => void;
buffer: ArrayBuffer;
stream: any;
};
export declare function quantize(
rgba: Uint8Array | Uint8ClampedArray,
maxColors: number,
options?: QuantizeOptions,
): number[][];
export declare function applyPalette(
rgba: Uint8Array | Uint8ClampedArray,
palette: number[][],
format?: Format,
): Uint8Array;
export declare function GIFEncoder(opts?: GIFEncoderOpts): Encoder;
export declare function nearestColorIndex(
palette: number[][],
pixel: [number, number, number] | [number, number, number],
): number;
export declare function nearestColorIndexWithDistance(
palette: number[][],
pixel: [number, number, number] | [number, number, number],
): [number, number];