Libraryless. Click here for Pure Java version (6372L/42K/141K).
1 | !7 |
2 | |
3 | sclass PossibleHScrollbar { |
4 | Rect slider; |
5 | int hIdx; |
6 | } |
7 | |
8 | p { |
9 | // Find candidates |
10 | |
11 | RGBImage rgb = shootScreen(); //loadImage(#1006358; |
12 | ocr_explodedView1_init(); |
13 | L<Rect> vClips = ocr_wideBlack_vsplit(rgb); |
14 | int iLine = 0; |
15 | new L<PossibleHScrollbar> hCandidates; |
16 | int y = 0; |
17 | for i over vClips: { |
18 | RGBImage line = rgb.clip(vClips.get(i)); |
19 | L<Rect> lineClips = ocr_highBlack_hsplit(line); |
20 | //print("Line " + (++iLine) + " (" + r + "): " + struct(lineClips)); |
21 | int x = 0; |
22 | for j over lineClips: { |
23 | Rect clip = lineClips.get(j); |
24 | if (clip.w == 1) |
25 | hCandidates.add(nu(PossibleHScrollbar, |
26 | slider := new Rect(x, y, clip.w, clip.h), hIdx := j)); |
27 | x += clip.w; |
28 | } |
29 | y += line.h(); |
30 | } |
31 | printStruct(+hCandidates); |
32 | |
33 | // Keep shooting, check candidates for movement |
34 | |
35 | while licensed { |
36 | sleepSeconds(2); |
37 | print("Shooting & checking for scrollbar movement"); |
38 | rgb = shootScreen(); //loadImage(#1006358; |
39 | vClips = ocr_wideBlack_vsplit(rgb); |
40 | y = 0; |
41 | int iHC = 0; |
42 | for i over vClips: { |
43 | // find candidates for this line |
44 | while (iHC < l(hCandidates) && hCandidates.get(iHC).slider.y < y) ++iHC; |
45 | if (iHC >= l(hCandidates)) break; |
46 | |
47 | int jHC = iHC; |
48 | while (jHC < l(hCandidates) && hCandidates.get(jHC).slider.y == y) ++jHC; |
49 | if (jHC > iHC) { // any candidates for this line |
50 | L<PossibleHScrollbar> lineCandidates = subList(hCandidates, iHC, jHC); |
51 | RGBImage line = rgb.clip(vClips.get(i)); |
52 | L<Rect> lineClips = ocr_highBlack_hsplit(line); |
53 | int x = 0; |
54 | for j over lineClips: { |
55 | Rect clip = lineClips.get(j); |
56 | if (clip.w == 1) { |
57 | PossibleHScrollbar sb = findWhere(lineCandidates, xIdx := x); |
58 | if (sb != null) |
59 | print("Horizontal slider move: " + sb.slider.x + " => " + x); |
60 | } |
61 | x += clip.w; |
62 | } |
63 | } |
64 | y += vClips.get(i).h; |
65 | } |
66 | } |
67 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006398 |
Snippet name: | Find Scroll Bar 4 |
Eternal ID of this version: | #1006398/1 |
Text MD5: | 4876b16c6b633276291966286dcabde6 |
Transpilation MD5: | 37ee4fbf651a9d1265fda8864322932b |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-16 11:32:48 |
Source code size: | 2029 bytes / 67 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 618 / 726 |
Referenced in: | [show references] |