Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

27
LINES

< > BotCompany Repo | #1024982 // ScreenShooter

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6074L/43K).

1  
sclass ScreenShooter implements AutoCloseable {
2  
  transient L onNewImage = syncList(); // L<Runnable|voidfunc(BufferedImage)>
3  
  
4  
  transient BufferedImage latestImage;
5  
  double interval = 1.0;
6  
  transient java.util.Timer timer;
7  
  bool verbose = true;
8  
  bool enabled = true;
9  
  
10  
  ScreenShooter start(O... _) {
11  
    /*IF0<AutoCloseable>*/ O enter = optPar enter(_);
12  
    timer = doEvery(interval, r {
13  
      ret unless enabled;
14  
      temp asAutoCloseable(callF(enter));
15  
      long time = sysNow();
16  
      latestImage = shootScreen2();
17  
      if (verbose) done2_always(time, "Screenshot");
18  
      pcallFAll(onNewImage, latestImage);
19  
      vmBus_send newScreenShot(latestImage);
20  
    });
21  
    this;
22  
  }
23  
  
24  
  public void close() {
25  
    dispose timer;
26  
  }
27  
}

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: #1024982
Snippet name: ScreenShooter
Eternal ID of this version: #1024982/9
Text MD5: 9c338e8bdc3a653ac3a2feef685e20a1
Transpilation MD5: 87693d3ce97db04621e3fe4fd5a7934b
Author: stefan
Category: javax / visual bots
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-31 22:56:15
Source code size: 768 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 275 / 700
Version history: 8 change(s)
Referenced in: [show references]