forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resemblejs.d.ts
97 lines (81 loc) · 2.24 KB
/
resemblejs.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
// Type definitions for Resemble.js v1.3.0
// Project: http://huddle.github.io/Resemble.js/
// Definitions by: Tim Perry <https://github.com/pimterry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Resemble {
interface ResembleStatic {
/**
* Retrieve basic analysis for a single image (add compareTo to compare with another).
*/
(image: string|ImageData): ResembleAnalysis;
/**
* Set the resemblance image output style
*/
outputSettings(settings: OutputSettings): ResembleStatic;
}
interface OutputSettings {
errorColor: {
red: number;
green: number;
blue: number;
};
errorType: string;
transparency: number;
largeImageThreshold: number;
}
interface ResembleAnalysis {
/**
* Run the analysis on this image and get the result
*/
onComplete(callback: (result: ResembleAnalysisResult) => void): void;
/**
* Compare this image to another image, to get resemblance data
*/
compareTo(fileData: string|ImageData): ResembleComparison;
}
interface ResembleAnalysisResult {
red: number;
green: number;
blue: number;
brightness: number;
}
interface ResembleComparison {
/**
* Run the analysis and get the comparison result
*/
onComplete(callback: (result: ResembleComparisonResult) => void): void;
ignoreNothing(): ResembleComparison;
ignoreAntialiasing(): ResembleComparison;
ignoreColors(): ResembleComparison;
repaint(): ResembleComparison;
}
interface ResembleComparisonResult {
/**
* Do the two images have the same dimensions?
*/
isSameDimensions: boolean;
/**
* The difference in width and height between the dimensions of the two compared images
*/
dimensionDifference: {
width: number;
height: number;
};
/**
* Get a data URL for the comparison image
*/
getImageDataUrl(): string;
/**
* The percentage of pixels which do not match between the images
*/
misMatchPercentage: number;
diffBounds: {
top: number;
left: number;
bottom: number;
right: number;
};
analysisTime: number;
}
}
declare var resemble: Resemble.ResembleStatic;