forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
png-async.d.ts
58 lines (50 loc) · 1.65 KB
/
png-async.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
// Type definitions for png-async
// Project: https://github.com/kanreisa/node-png-async
// Definitions by: Yuki KAN <https://github.com/kanreisa>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'png-async' {
import stream = require('stream');
export interface IImageOptions {
width?: number;
height?: number;
fill?: boolean;
checkCRC?: boolean;
deflateChunkSize?: number;
deflateLevel?: number;
deflateStrategy?: EDeflateStrategy;
filterType?: EFilterType;
}
export enum EDeflateStrategy {
DEFAULT_STRATEGY = 0,
FILTERED = 1,
HUFFMAN_ONLY = 2,
RLE = 3,
FIXED = 4,
}
export enum EFilterType {
Auto = -1,
None = 0,
Sub = 1,
Up = 2,
Average = 3,
Paeth = 4,
}
export function createImage(option?: IImageOptions): Image;
export class Image extends stream.Duplex {
width: number;
height: number;
gamma: number;
data: Buffer;
constructor(option?: IImageOptions);
pack(): Image;
parse(data: Buffer, callback?: (err: Error, image: Image) => void): Image;
write(data: any, cb?: any): boolean;
end(data?: any): void;
bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image;
on(event: string, listener: Function): Image;
once(event: string, listener: Function): Image;
removeListener(event: string, listener: Function): Image;
removeAllListeners(event: string): Image;
}
}