forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-electron.native-image.d.ts
59 lines (57 loc) · 1.52 KB
/
github-electron.native-image.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
// Type definitions for Electron v0.37.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare namespace Electron {
/**
* This class is used to represent an image.
*/
class NativeImage {
/**
* Creates an empty NativeImage instance.
*/
static createEmpty(): NativeImage;
/**
* Creates a new NativeImage instance from file located at path.
*/
static createFromPath(path: string): NativeImage;
/**
* Creates a new NativeImage instance from buffer.
* @param scaleFactor 1.0 by default.
*/
static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage;
/**
* Creates a new NativeImage instance from dataURL
*/
static createFromDataURL(dataURL: string): NativeImage;
/**
* @returns Buffer Contains the image's PNG encoded data.
*/
toPng(): Buffer;
/**
* @returns Buffer Contains the image's JPEG encoded data.
*/
toJpeg(quality: number): Buffer;
/**
* @returns string The data URL of the image.
*/
toDataURL(): string;
/**
* @returns boolean Whether the image is empty.
*/
isEmpty(): boolean;
/**
* @returns {} The size of the image.
*/
getSize(): any;
/**
* Marks the image as template image.
*/
setTemplateImage(option: boolean): void;
/**
* Returns a boolean whether the image is a template image.
*/
isTemplateImage(): boolean;
}
}