Skip to content

Commit ce8ae77

Browse files
committed
Merge pull request DefinitelyTyped#7346 from pimterry/resemble-docs
Add some docs to Resemble.js
2 parents cc3d223 + 8efbe33 commit ce8ae77

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

resemblejs/resemblejs.d.ts

+31
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55

66
declare namespace Resemble {
77
interface ResembleStatic {
8+
/**
9+
* Retrieve basic analysis for a single image (add compareTo to compare with another).
10+
*/
811
(image: string|ImageData): ResembleAnalysis;
12+
13+
/**
14+
* Set the resemblance image output style
15+
*/
916
outputSettings(settings: OutputSettings): ResembleStatic;
1017
}
1118

@@ -21,7 +28,14 @@ declare namespace Resemble {
2128
}
2229

2330
interface ResembleAnalysis {
31+
/**
32+
* Run the analysis on this image and get the result
33+
*/
2434
onComplete(callback: (result: ResembleAnalysisResult) => void): void;
35+
36+
/**
37+
* Compare this image to another image, to get resemblance data
38+
*/
2539
compareTo(fileData: string|ImageData): ResembleComparison;
2640
}
2741

@@ -33,6 +47,9 @@ declare namespace Resemble {
3347
}
3448

3549
interface ResembleComparison {
50+
/**
51+
* Run the analysis and get the comparison result
52+
*/
3653
onComplete(callback: (result: ResembleComparisonResult) => void): void;
3754

3855
ignoreNothing(): ResembleComparison;
@@ -43,15 +60,29 @@ declare namespace Resemble {
4360
}
4461

4562
interface ResembleComparisonResult {
63+
/**
64+
* Do the two images have the same dimensions?
65+
*/
4666
isSameDimensions: boolean;
67+
68+
/**
69+
* The difference in width and height between the dimensions of the two compared images
70+
*/
4771
dimensionDifference: {
4872
width: number;
4973
height: number;
5074
};
5175

76+
/**
77+
* Get a data URL for the comparison image
78+
*/
5279
getImageDataUrl(): string;
5380

81+
/**
82+
* The percentage of pixels which do not match between the images
83+
*/
5484
misMatchPercentage: number;
85+
5586
diffBounds: {
5687
top: number;
5788
left: number;

0 commit comments

Comments
 (0)