9
9
import java .util .Iterator ;
10
10
import java .util .List ;
11
11
12
+ /**
13
+ * INTERNAL: An abstract super-class for {@link Region} and {@link Image}.
14
+ * <br>
15
+ * <p>BE AWARE: This class cannot be used as such (cannot be instantiated)
16
+ * <br>... instead use the classes Region or Image as needed</p>
17
+ * NOTES:
18
+ * <br>- the classname might change in the future without notice
19
+ * <br>- the intention is, to have only one implementation for features, that are the same for Region and Image
20
+ * <br>- the implementation here is ongoing beginning with version 2.0.2 and hence not complete yet
21
+ * <br>- you might get <b>not-implemented exceptions</b> until complete
22
+ */
12
23
public abstract class Pixels {
13
24
14
25
protected static final int logLevel = 3 ;
@@ -31,7 +42,7 @@ public int getX() {
31
42
}
32
43
33
44
/**
34
- * X-coordinate of the Region
45
+ * X-coordinate of the Region (ignored for Image)
35
46
*/
36
47
public int x = 0 ;
37
48
@@ -43,31 +54,31 @@ public int getY() {
43
54
}
44
55
45
56
/**
46
- * Y-coordinate of the Region
57
+ * Y-coordinate of the Region (ignored for Image)
47
58
*/
48
59
public int y = 0 ;
49
60
50
61
/**
51
- * @return width of region
62
+ * @return width of region/image
52
63
*/
53
64
public int getW () {
54
65
return w ;
55
66
}
56
67
57
68
/**
58
- * Width of the Region
69
+ * Width of the Region/Image
59
70
*/
60
71
public int w = 0 ;
61
72
62
73
/**
63
- * @return height of region
74
+ * @return height of region/image
64
75
*/
65
76
public int getH () {
66
77
return h ;
67
78
}
68
79
69
80
/**
70
- * Height of the Region
81
+ * Height of the Region/Image
71
82
*/
72
83
public int h = 0 ;
73
84
@@ -107,7 +118,7 @@ protected void setImageMissingHandler(Object handler) {
107
118
* finds the given Pattern, String or Image in the region and returns the best match.
108
119
*
109
120
* @param <PSI> Pattern, String or Image
110
- * @param target
121
+ * @param target what (PSI) to find in this Region
111
122
* @return If found, the element. null otherwise
112
123
* @throws FindFailed if the Find operation failed
113
124
*/
@@ -214,7 +225,7 @@ public List<Match> findWords() {
214
225
/**
215
226
* Find the first word as text (top left to bottom right) containing the given text
216
227
*
217
- * @param word
228
+ * @param word to be searched
218
229
* @return a text match or null if not found
219
230
*/
220
231
public Match findWord (String word ) {
@@ -231,7 +242,7 @@ public Match findWord(String word) {
231
242
/**
232
243
* Find all words as text (top left to bottom right) containing the given text
233
244
*
234
- * @param word
245
+ * @param word to be searched
235
246
* @return a list of text matches
236
247
*/
237
248
public List <Match > findWords (String word ) {
@@ -245,7 +256,7 @@ public List<Match> findWords(String word) {
245
256
/**
246
257
* Find the first line as text (top left to bottom right) containing the given text
247
258
*
248
- * @param text
259
+ * @param text the line should contain
249
260
* @return a text match or null if not found
250
261
*/
251
262
public Match findLine (String text ) {
@@ -262,7 +273,7 @@ public Match findLine(String text) {
262
273
/**
263
274
* Find all lines as text (top left to bottom right) containing the given text
264
275
*
265
- * @param text
276
+ * @param text the lines should contain
266
277
* @return a list of text matches or empty list if not found
267
278
*/
268
279
public List <Match > findLines (String text ) {
@@ -322,6 +333,10 @@ public Match existsText(String text) {
322
333
//return match;
323
334
}
324
335
336
+ public Match existsT (String text ) {
337
+ return existsText (text );
338
+ }
339
+
325
340
public boolean hasText (String text ) {
326
341
return null != existsText (text );
327
342
}
@@ -344,8 +359,8 @@ public List<Match> findAllT(String text) {
344
359
//<editor-fold desc="20 helper">
345
360
/**
346
361
* INTERNAL: get Image from target
347
- * @param target Pattern, Filename, Image, ScreenImage
348
- * @param < PSI>
362
+ * @param <PSI> Pattern, Filename, Image, ScreenImage
363
+ * @param target what( PSI) to search
349
364
* @return Image object
350
365
*/
351
366
public static <PSI > Image getImageFromTarget (PSI target ) {
@@ -369,8 +384,7 @@ protected static <SFIRBS> BufferedImage getBufferedImage(SFIRBS whatEver) {
369
384
} else if (whatEver instanceof File ) {
370
385
return Image .create ((File ) whatEver ).get ();
371
386
} else if (whatEver instanceof Region ) {
372
- Region reg = (Region ) whatEver ;
373
- return reg .getScreen ().capture (reg ).getImage ();
387
+ return ((Region ) whatEver ).getImage ().get ();
374
388
} else if (whatEver instanceof Image ) {
375
389
return ((Image ) whatEver ).get ();
376
390
} else if (whatEver instanceof ScreenImage ) {
@@ -409,9 +423,10 @@ protected Match relocate(Match match) {
409
423
protected long lastSearchTimeRepeat = -1 ;
410
424
411
425
/**
412
- * a find operation saves its match on success in the used region object<br>unchanged if not successful
426
+ * a find operation saves its match on success in this region/image.
427
+ * <br>... unchanged if not successful
413
428
*
414
- * @return the Match object from last successful find in this region
429
+ * @return the Match object from last successful find
415
430
*/
416
431
public Match getLastMatch () {
417
432
return lastMatch ;
@@ -420,9 +435,10 @@ public Match getLastMatch() {
420
435
// ************************************************
421
436
422
437
/**
423
- * a searchAll operation saves its matches on success in the used region object<br>unchanged if not successful
438
+ * a searchAll operation saves its matches on success in this region/image
439
+ * <br>... unchanged if not successful
424
440
*
425
- * @return a Match-Iterator of matches from last successful searchAll in this region
441
+ * @return a Match-Iterator of matches from last successful searchAll
426
442
*/
427
443
public Iterator <Match > getLastMatches () {
428
444
return lastMatches ;
@@ -431,7 +447,7 @@ public Iterator<Match> getLastMatches() {
431
447
432
448
//<editor-fold desc="99 obsolete">
433
449
/**
434
- * @return
450
+ * @return a list of matches
435
451
* @deprecated use findLines() instead
436
452
* @see #findLines()
437
453
*/
@@ -440,7 +456,7 @@ public List<Match> collectLines() {
440
456
}
441
457
442
458
/**
443
- * @return
459
+ * @return a list of lines as strings
444
460
* @deprecated use textLines() instead
445
461
* @see #textLines()
446
462
*/
@@ -450,7 +466,7 @@ public List<String> collectLinesText() {
450
466
}
451
467
452
468
/**
453
- * @return
469
+ * @return a list of matches
454
470
* @deprecated use findWords() instead
455
471
* @see #findWords()
456
472
*/
@@ -460,7 +476,7 @@ public List<Match> collectWords() {
460
476
}
461
477
462
478
/**
463
- * @return
479
+ * @return a list of words sa strings
464
480
* @deprecated use textWords() instead
465
481
* @see #textWords()
466
482
*/
0 commit comments