forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pngjs2.d.ts
64 lines (53 loc) · 1.77 KB
/
pngjs2.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 definitions for pngjs2 2.0.0
// Project: https://www.npmjs.com/package/pngjs2
// Definitions by: Elisée Maurer <https://sparklinlabs.com/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "pngjs2" {
import fs = require("fs");
import events = require("events");
import stream = require("stream");
interface PNGOptions {
width?: number;
height?: number;
checkCRC?: boolean;
deflateChunkSize?: number;
deflateLevel?: number;
deflateStrategy?: number;
deflateFactory?: any;
filterType?: number|number[];
colorType?: number;
inputHasAlpha?: boolean;
}
interface PNGMetadata {
width: number;
height: number;
palette: boolean;
color: boolean;
alpha: boolean;
interlace: boolean;
}
export class PNG extends stream.Writable {
constructor(options?: PNGOptions);
width: number;
height: number;
data: Buffer;
gamma: number;
on(event: string, callback: Function): PNG;
on(event: "metadata", callback: (metadata: PNGMetadata) => void): PNG;
on(event: "parsed", callback: (data: Buffer) => void): PNG;
on(event: "error", callback: (err: Error) => void): PNG;
parse(data: string|Buffer, callback?: (err: Error, data: Buffer) => void): PNG;
pack(): PNG;
pipe(destination: fs.WriteStream): PNG;
static bitblt(src: PNG, dst: PNG, srcX: number, srcY: number,
width: number, height: number, deltaX: number, deltaY: number): void;
bitblt(dst: PNG, srcX: number, srcY: number,
width: number, height: number, deltaX: number, deltaY: number): PNG;
}
export namespace PNG {
namespace sync {
function read(buffer: string|Buffer, options?: PNGOptions): PNG;
}
}
}