@@ -10,13 +10,19 @@ import { TemplateMatchingFinder } from "../provider/opencv/template-matching-fin
10
10
import { Region } from "../region.class" ;
11
11
12
12
/**
13
- * OpenCVAdapter serves as an abstraction layer for all image based interactions.
13
+ * { @link VisionAdapter } serves as an abstraction layer for all image based interactions.
14
14
*
15
15
* This allows to provide a high level interface for image based actions,
16
- * whithout having to spread (possibly) multiple dependencies all over the code.
16
+ * without having to spread (possibly) multiple dependencies all over the code.
17
17
* All actions which involve screenshots / images are bundled in this adapter.
18
18
*/
19
19
export class VisionAdapter {
20
+ /**
21
+ * {@link VisionAdapter } class constructor
22
+ * @param finder A {@link FinderInterface} instance used for on-screen image detection (Default: {@link TemplateMatchingFinder})
23
+ * @param screen A {@link ScreenActionProvider} instance used to retrieve screen data (Default: {@link ScreenAction})
24
+ * @param dataSink A {@link DataSink} instance used to write output data to disk (Default: {@link ImageWriter})
25
+ */
20
26
constructor (
21
27
private finder : FinderInterface = new TemplateMatchingFinder ( ) ,
22
28
private screen : ScreenActionProvider = new ScreenAction ( ) ,
@@ -25,34 +31,31 @@ export class VisionAdapter {
25
31
}
26
32
27
33
/**
28
- * grabScreen will return an Image containing the current screen image
34
+ * { @link grabScreen} will return an { @link Image} containing the current screen image
29
35
*
30
- * @returns {Promise<Image> } Image will contain screenshot data as well as dimensions
31
- * @memberof VisionAdapter
36
+ * @returns An {@link Image} which will contain screenshot data as well as dimensions
32
37
*/
33
38
public grabScreen ( ) : Promise < Image > {
34
39
return this . screen . grabScreen ( ) ;
35
40
}
36
41
37
42
/**
38
- * grabScreenRegion essentially does the same as grabScreen, but only returns a specified Region
43
+ * { @link grabScreenRegion} essentially does the same as grabScreen, but only returns a specified { @link Region}
39
44
*
40
- * @param {Region } region The screen region we want to grab
41
- * @returns {Promise<Image> } Image will contain screenshot data of the specified region as well as dimensions
42
- * @memberof VisionAdapter
45
+ * @param region The screen {@link Region} we want to grab
46
+ * @returns An {@link Image} which will contain screenshot data of the specified {@link Region} as well as dimensions
43
47
*/
44
48
public grabScreenRegion ( region : Region ) : Promise < Image > {
45
49
return this . screen . grabScreenRegion ( region ) ;
46
50
}
47
51
48
52
/**
49
- * findOnScreenRegion will search for a given pattern inside a region of an image.
50
- * If multiple possible occurences are found, the one with the highes probability is returned.
53
+ * { @link findOnScreenRegion} will search for a given pattern inside a { @link Region } of the main screen
54
+ * If multiple possible occurrences are found, the one with the highest probability is returned.
51
55
* For matchProbability < 0.99 the search will be performed on grayscale images.
52
56
*
53
- * @param {MatchRequest } matchRequest A match request which holds all required matching data
54
- * @returns {Promise<MatchResult> } MatchResult will contain location and probability of a possible match
55
- * @memberof VisionAdapter
57
+ * @param matchRequest A {@link MatchRequest} which holds all required matching data
58
+ * @returns {@link MatchResult } containing location and probability of a possible match
56
59
*/
57
60
public async findOnScreenRegion (
58
61
matchRequest : MatchRequest ,
@@ -68,47 +71,43 @@ export class VisionAdapter {
68
71
}
69
72
70
73
/**
71
- * screenWidth returns the main screen's width as reported by the OS.
74
+ * { @link screenWidth} returns the main screens width as reported by the OS.
72
75
* Please notice that on e.g. Apples Retina display the reported width
73
76
* and the actual pixel size may differ
74
77
*
75
- * @returns {Promise<number> } The main screen's width as reported by the OS
76
- * @memberof VisionAdapter
78
+ * @returns The main screens width as reported by the OS
77
79
*/
78
80
public screenWidth ( ) : Promise < number > {
79
81
return this . screen . screenWidth ( ) ;
80
82
}
81
83
82
84
/**
83
- * screenHeight returns the main screen's height as reported by the OS.
85
+ * { @link screenHeight} returns the main screens height as reported by the OS.
84
86
* Please notice that on e.g. Apples Retina display the reported width
85
87
* and the actual pixel size may differ
86
88
*
87
- * @returns {Promise<number> } The main screen's height as reported by the OS
88
- * @memberof VisionAdapter
89
+ * @returns The main screens height as reported by the OS
89
90
*/
90
91
public screenHeight ( ) : Promise < number > {
91
92
return this . screen . screenHeight ( ) ;
92
93
}
93
94
94
95
/**
95
- * screenSize returns a Region object with the main screen's size.
96
- * Please notice that on e.g. Apples Retina display the reported width
96
+ * { @link screenSize} returns a { @link Region} object with the main screens size.
97
+ * Please note that on e.g. Apples Retina display the reported width
97
98
* and the actual pixel size may differ
98
99
*
99
- * @returns {Promise<Region> } The Region object the size of your main screen
100
- * @memberof VisionAdapter
100
+ * @returns A {@link Region} object representing the size of a systems main screen
101
101
*/
102
102
public screenSize ( ) : Promise < Region > {
103
103
return this . screen . screenSize ( ) ;
104
104
}
105
105
106
106
/**
107
- * saveImage saves an Image to a given path on disk.
107
+ * { @link saveImage} saves an { @link Image} to a given path on disk.
108
108
*
109
- * @param image The Image to store
110
- * @param path The storage path
111
- * @memberof VisionAdapter
109
+ * @param image The {@link Image} to store
110
+ * @param path The path where to store the image
112
111
*/
113
112
public saveImage ( image : Image , path : string ) : Promise < void > {
114
113
return ( this . dataSink as ImageWriter ) . store ( image , path ) ;
0 commit comments