From 8da1ba7b5d1c17c80e6c206d98372fc0b35992ce Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Thu, 24 Dec 2015 23:57:59 +0000 Subject: [PATCH 1/3] Add some docs to Resemble.js --- resemblejs/resemblejs.d.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/resemblejs/resemblejs.d.ts b/resemblejs/resemblejs.d.ts index 7ebb90bb7..b2e1b1299 100644 --- a/resemblejs/resemblejs.d.ts +++ b/resemblejs/resemblejs.d.ts @@ -5,7 +5,14 @@ declare namespace Resemble { interface ResembleStatic { + /** + * Retrieve basic analysis on one 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 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,14 @@ declare namespace Resemble { } interface ResembleComparison { + /** + * Run the analysis and get the result + */ + onComplete(callback: (result: ResembleAnalysisResult) => void): void; + + /** + * Run the analysis and get the comparison result + */ onComplete(callback: (result: ResembleComparisonResult) => void): void; ignoreNothing(): ResembleComparison; From e7a15ccfd2a7ee5d3a4916097429818ef87994d7 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 18 Mar 2016 17:23:44 +0100 Subject: [PATCH 2/3] Remove duplicated onComplete signature --- resemblejs/resemblejs.d.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resemblejs/resemblejs.d.ts b/resemblejs/resemblejs.d.ts index b2e1b1299..1dc45a4c4 100644 --- a/resemblejs/resemblejs.d.ts +++ b/resemblejs/resemblejs.d.ts @@ -47,11 +47,6 @@ declare namespace Resemble { } interface ResembleComparison { - /** - * Run the analysis and get the result - */ - onComplete(callback: (result: ResembleAnalysisResult) => void): void; - /** * Run the analysis and get the comparison result */ From 8efbe33282d792ac3362dcfe440ea1c123c8d1e0 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 18 Mar 2016 17:29:52 +0100 Subject: [PATCH 3/3] Add more detail to the ResembleJS docs --- resemblejs/resemblejs.d.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/resemblejs/resemblejs.d.ts b/resemblejs/resemblejs.d.ts index 1dc45a4c4..7b1801ad3 100644 --- a/resemblejs/resemblejs.d.ts +++ b/resemblejs/resemblejs.d.ts @@ -6,7 +6,7 @@ declare namespace Resemble { interface ResembleStatic { /** - * Retrieve basic analysis on one image (add compareTo to compare with another). + * Retrieve basic analysis for a single image (add compareTo to compare with another). */ (image: string|ImageData): ResembleAnalysis; @@ -29,13 +29,13 @@ declare namespace Resemble { interface ResembleAnalysis { /** - * Run the analysis and get the result + * 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; } @@ -60,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;