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).

!7

!include once #1025225 // Shared IntegralImage

sclass Screenshot {
  LongRange timeTaken; // (timestamp start shooting, timestamp end shooting)
  long processingDone; // timestamp
  int screenNr;
  Rect screenRect;     // can be null (=whole screen)
  BufferedImage image;
  RGBImage rgbImage; // made on demand
  IntegralImage integralImage;
  
  int getWidth() { ret bufferedImageWidth(image); }
  int getHeight() { ret bufferedImageHeight(image); }
  
  synchronized RGBImage rgbImage() {
    if (rgbImage == null)
      rgbImage = RGBImage(image);
    ret rgbImage;
  }
}

cmodule StreamOfScreenshots > DynFlexibleRateTimerAndEnabled {
  transient Screenshot lastScreenshot;
  
  start {
 timer.setRunnableAndStart(r takeScreenshot);
 }
  
  void takeScreenshot enter {
    if (!enabled) ret with lastScreenshot = null;
    new Screenshot ss;
    long timeTaken = now();
    ss.image = shootScreen2();
    ss.timeTaken = longRange(timeTaken, now());
    ss.integralImage = IntegralImage(ss.image);
    ss.processingDone = now();
    printWithDate("Screenshot (" + ss.getWidth() + "*" + ss.getHeight() + ") taken in " + ss.timeTaken.length() + " ms, integral image made in " + (ss.processingDone-ss.timeTaken.end) + " ms");
    lastScreenshot = ss;
    vmBus_send newScreenshotInStream(this, ss);
  }
}

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: 359 / 29981
Version history: 14 change(s)
Referenced in: [show references]