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

43
LINES

< > BotCompany Repo | #1025188 // Stream of screenshots

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

Uses 974K of libraries. Click here for Pure Java version (8306L/43K).

1  
!7
2  
3  
!include once #1025225 // Shared IntegralImage
4  
5  
sclass Screenshot {
6  
  LongRange timeTaken; // (timestamp start shooting, timestamp end shooting)
7  
  long processingDone; // timestamp
8  
  int screenNr;
9  
  Rect screenRect;     // can be null (=whole screen)
10  
  BufferedImage image;
11  
  RGBImage rgbImage; // made on demand
12  
  IntegralImage integralImage;
13  
  
14  
  int getWidth() { ret bufferedImageWidth(image); }
15  
  int getHeight() { ret bufferedImageHeight(image); }
16  
  
17  
  synchronized RGBImage rgbImage() {
18  
    if (rgbImage == null)
19  
      rgbImage = RGBImage(image);
20  
    ret rgbImage;
21  
  }
22  
}
23  
24  
cmodule StreamOfScreenshots > DynFlexibleRateTimerAndEnabled {
25  
  transient Screenshot lastScreenshot;
26  
  
27  
  start {
28  
 timer.setRunnableAndStart(r takeScreenshot);
29  
 }
30  
  
31  
  void takeScreenshot enter {
32  
    if (!enabled) ret with lastScreenshot = null;
33  
    new Screenshot ss;
34  
    long timeTaken = now();
35  
    ss.image = shootScreen2();
36  
    ss.timeTaken = longRange(timeTaken, now());
37  
    ss.integralImage = IntegralImage(ss.image);
38  
    ss.processingDone = now();
39  
    printWithDate("Screenshot (" + ss.getWidth() + "*" + ss.getHeight() + ") taken in " + ss.timeTaken.length() + " ms, integral image made in " + (ss.processingDone-ss.timeTaken.end) + " ms");
40  
    lastScreenshot = ss;
41  
    vmBus_send newScreenshotInStream(this, ss);
42  
  }
43  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025188
Snippet name: Stream of screenshots
Eternal ID of this version: #1025188/15
Text MD5: 76ab33c0c26e38dc225c872be205b11e
Transpilation MD5: d925625c4d06ac4fa57370fd182b9f4d
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-20 18:07:15
Source code size: 1352 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 361 / 29983
Version history: 14 change(s)
Referenced in: [show references]