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

57
LINES

< > BotCompany Repo | #1005686 // PIF [Persistent Image Finder] Classes v2

JavaX fragment (include)

1  
concept Screenshot {
2  
  S pngPath; // optional, relative (program ID + "/" + file name)
3  
  Rect r; // optional, rectangle that was shot
4  
  
5  
  *() {} // for persistance
6  
  *(BufferedImage img) {
7  
    savePNG(pngFile(), img);
8  
  }
9  
10  
  File pngFile() {
11  
    if (pngPath != null)
12  
      ret prepareFile(new File(javaxDataDir(), pngPath));
13  
    ret prepareProgramFile(_programID(), "screenshot" + id + ".png");
14  
  }
15  
  
16  
  BufferedImage loadImage() {
17  
    ret loadImage2(pngFile());
18  
  }
19  
  
20  
  bool hasImage() {
21  
    ret pngFile().exists();
22  
  }
23  
}
24  
25  
Screenshot > TransientScreenshot {
26  
  transient BufferedImage img;
27  
  
28  
  *() {} // for persistance
29  
  *(BufferedImage *img) {}
30  
  
31  
  bool hasImage() { ret img != null; }
32  
  BufferedImage loadImage() { ret img; }
33  
  
34  
  void disposeImage() { img = null; }
35  
}
36  
37  
Clip > MarkedClip {
38  
  new Ref<Screenshot> screenshot;
39  
  Rect positionInScreenshot;
40  
}
41  
42  
concept Clip {
43  
  long originalID; // ID in #1005389
44  
  BWImage img;
45  
  S description;
46  
}
47  
48  
concept Found {
49  
  new Ref<Screenshot> screenshot;
50  
  new Ref<Clip> clip;
51  
  FoundImg fi; // contains Rect r
52  
}
53  
54  
concept FullySearched {
55  
  new Ref<Screenshot> screenshot;
56  
  new Ref<Clip> clip;
57  
}

Author comment

Began life as a copy of #1005530

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005686
Snippet name: PIF [Persistent Image Finder] Classes v2
Eternal ID of this version: #1005686/1
Text MD5: ad93f956785467be5b83f03d3ae1c84a
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-03 22:41:09
Source code size: 1196 bytes / 57 lines
Pitched / IR pitched: No / No
Views / Downloads: 547 / 2034
Referenced in: [show references]