1 | static int letUserMarkScreenArea_shootAfterClickDelay = 1000; |
2 | |
3 | static void letUserMarkScreenArea(final O f) { |
4 | letUserMarkScreenArea(shootScreen2(), f); |
5 | } |
6 | |
7 | // f: voidfunc(Rectangle r, BufferedImage screenshot) - gets called with null values on abort |
8 | static void letUserMarkScreenArea(final BufferedImage screenshot, final O f) { |
9 | final JWindow window = showAnimationInTopRightCorner("#1005611", "Please click roughly in the area you would like to select"); |
10 | |
11 | trackOneClick(voidfunc(final Point p) { |
12 | final new Flag done; |
13 | window.dispose(); |
14 | |
15 | thread "Shooting Screen" { |
16 | sleep(screenshot == null ? letUserMarkScreenArea_shootAfterClickDelay : 0); |
17 | awt { |
18 | final BufferedImage screenshot2 = screenshot == null ? shootScreen2() : screenshot; |
19 | |
20 | final ImageSurface is = imageSurface(screenshot2); |
21 | is.setZoom(4); |
22 | JFrame frame = showCenterFrame("Please select exact area and click OK", jScrollPane(is)); |
23 | setFrameBounds(frame, centerScreenPart(0.75)); |
24 | addToWindow(frame, withInset(imageSelectionDepend(is, jbutton("OK", r { |
25 | Rectangle r = is.selection; |
26 | if (r != null) { |
27 | disposeWindow(is); |
28 | done.raise(); |
29 | callF(f, r, screenshot2); |
30 | } |
31 | })))); |
32 | is.centerPoint(p); |
33 | onFrameClose(frame, r { |
34 | if (!done.isUp()) { |
35 | done.raise(); |
36 | callF(f, null, null); |
37 | } |
38 | }); |
39 | } |
40 | } |
41 | }); |
42 | } |
Began life as a copy of #1005662
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005673 |
Snippet name: | letUserMarkScreenArea |
Eternal ID of this version: | #1005673/1 |
Text MD5: | 10aef7eb66452b31230d2546ec26f810 |
Author: | stefan |
Category: | javax / gui / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-04 18:08:59 |
Source code size: | 1511 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 556 / 546 |
Referenced in: | [show references] |