Uses 974K of libraries. Click here for Pure Java version (4976L/27K).
1 | !7 |
2 | |
3 | !include once #1025225 // Shared IntegralImage |
4 | |
5 | cmodule FindConstantArea > DynImageSurface {
|
6 | switchable int displayWidth = 400, cubeSize = 40; |
7 | transient Rect area; // area currently looked at |
8 | transient RGB lastColor; |
9 | |
10 | start {
|
11 | dm_vmBus_onMessage_q newScreenshotInStream(voidfunc(O mod, virtual Screenshot ss) {
|
12 | IntegralImage ii = cast rget integralImage(ss); |
13 | setImage(scaledBufferedImageFromIntegralImage(displayWidth, ii)); |
14 | if (area == null) area = randomRect(cubeSize, cubeSize, ii_rect(ii)); |
15 | print("Area: " + area);
|
16 | setSelection(scaleRect(area, doubleRatio(displayWidth, ii.getWidth()))); |
17 | RGB color = ii_averageColorOfArea(ii, area); |
18 | if (lastColor != null) {
|
19 | if (eq(color, lastColor)) |
20 | print("Same color! " + color);
|
21 | else {
|
22 | print("New color (" + lastColor + "/" + color + "). Switching area.");
|
23 | area = null; |
24 | } |
25 | } |
26 | lastColor = color; |
27 | }); |
28 | } |
29 | } |
Began life as a copy of #1025278
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025283 |
| Snippet name: | Find area on screen without change v1 [OK] |
| Eternal ID of this version: | #1025283/14 |
| Text MD5: | a955c261c7327b2b28967916ae1acab4 |
| Transpilation MD5: | e7f72ff0d62a70fb5e3b0a55cf806898 |
| Author: | stefan |
| Category: | javax / screen recognition |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-09-20 18:09:33 |
| Source code size: | 999 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 506 / 724 |
| Version history: | 13 change(s) |
| Referenced in: | [show references] |