This repository was archived by the owner on Mar 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjimp-upng.d.ts
104 lines (94 loc) · 2.36 KB
/
jimp-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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { JimpType, Image, Bitmap } from "@jimp/core";
declare function jimpUPNG(): JimpType<jimpUPNG.UPNGImage>;
declare namespace jimpUPNG {
/**
* Represents a bitmap converted to a jimp image using the built-in decoder
*/
interface UPNGConvertBitmap extends UPNGBitmap {
frames: ImageFrame[];
colorDepth: number;
colorType: number;
}
/**
* Represents a bitmap converted to a jimp image using
* [[ImageFrame#bitmap]] or the built-in decoder
*/
interface UPNGBitmap extends Bitmap {
delay: number;
dispose: APNGFrameDisposal;
blend: APNGFrameBlend;
}
/**
* Represents a converted image
*/
interface UPNGImage extends Image {
bitmap: UPNGConvertBitmap;
}
/**
* Represents raw frame data from UPNG.js
*/
interface UPNGImageData {
delay: number;
rect: {
x: number;
y: number;
width: number;
height: number;
}
dispose: APNGFrameDisposal;
blend: APNGFrameBlend;
data: Uint8Array;
}
/**
* Represents an image frame
*/
export class ImageFrame {
public constructor(upngData: UPNGImageData);
public delay: number;
public x: number;
public y: number;
public width: number;
public height: number;
public dispose: APNGFrameDisposal;
public disposeMethod: APNGFrameDisposal;
public blend: APNGFrameBlend;
public blendMethod: APNGFrameBlend;
public raw: UPNGImageData;
get bitmap(): UPNGBitmap;
public static createFromJIMP(img: Image, opts?: UPNGImageData & {
x?: number;
y?: number;
});
}
/**
* Frame disposal options
*/
export enum APNGFrameDisposal {
/**
* Don't do anything
*/
NONE = 0,
/**
* Restore the frame to the background
*/
BACKGROUND = 1,
/**
* Restore the frame to the previous frame
*/
PREVIOUS = 2
}
/**
* Frame blending options
*/
export enum APNGFrameBlend {
/**
* Overwrite the old source
*/
SOURCE = 0,
/**
* Composite the image over the old source
*/
OVER = 1
}
}
export = jimpUPNG;