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

37
LINES

< > BotCompany Repo | #1020038 // Continuously Take Scaled Down Screenshot [doesn't save, just for image analysis]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1113K of libraries. Click here for Pure Java version (13790L/72K).

1  
!7
2  
3  
cm ContinuousScreenshots > DynImageSurface {
4  
  bool enabled, runInBackground = true;
5  
  int width = 64;
6  
  double videoInterval = 1;
7  
  
8  
  start {
9  
    doEvery(videoInterval, r grab);
10  
  }
11  
  
12  
  visualize {
13  
    JComponent c = super.visualize();
14  
    enableDoubleBuffering();
15  
    imageSurface_pixelated(imageSurface);
16  
    
17  
    ret northAndCenterWithMargins(
18  
      centerAndEastWithMargin(withLabel("Resize to width (pixels):",
19  
        jLiveValueIntTextField(dm_fieldLiveValue('width))),
20  
        dm_fieldCheckBox('enabled)), c);
21  
  }
22  
  
23  
  bool actuallyEnabled() {
24  
    ret enabled && (runInBackground || dm_isVisible());
25  
  }
26  
  
27  
  void grab enter {
28  
    if (!actuallyEnabled()) ret;
29  
    time "Get Screenshot" {
30  
      setImage(scaledDownScreenshot(width));
31  
    }
32  
  }
33  
  
34  
  enhanceFrame {
35  
    dm_doubleFieldMenuItem(f, 'videoInterval, formTitle := "Update image every n seconds", onSet := rThread dm_reload);
36  
  }
37  
}

Author comment

Began life as a copy of #1019894

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020038
Snippet name: Continuously Take Scaled Down Screenshot [doesn't save, just for image analysis]
Eternal ID of this version: #1020038/5
Text MD5: 4fe7814c45c81b3870d69fb9af0edad5
Transpilation MD5: ba81ceb1982212f76ad70db2fea38224
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-21 19:43:55
Source code size: 938 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 234 / 701
Version history: 4 change(s)
Referenced in: [show references]