Merge pull request #7346 from pimterry/resemble-docs

Add some docs to Resemble.js
This commit is contained in:
Horiuchi_H
2016-03-19 02:00:45 +09:00
+31
View File
@@ -5,7 +5,14 @@
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;
}
@@ -21,7 +28,14 @@ declare namespace Resemble {
}
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;
}
@@ -33,6 +47,9 @@ declare namespace Resemble {
}
interface ResembleComparison {
/**
* Run the analysis and get the comparison result
*/
onComplete(callback: (result: ResembleComparisonResult) => void): void;
ignoreNothing(): ResembleComparison;
@@ -43,15 +60,29 @@ declare namespace Resemble {
}
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;