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

28
LINES

< > BotCompany Repo | #1019105 // Web Cam, Pixelated [Dyn Module, OK]

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

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

1  
!7
2  
3  
cm WebCamPixelated > DynImageSurface {
4  
  int width = 16;
5  
  switchable int interval = 1000;
6  
  transient BufferedImage lastImage;
7  
  
8  
  start {
9  
    doEvery(interval, rstUpdate());
10  
    dm_reloadOnFieldChange interval();
11  
  }
12  
  
13  
  enhanceFrame {
14  
    dm_intFieldMenuItem(f, 'width, formTitle := "Set Pixelated Image Width", onSet := r { setField(lastImage := null) });
15  
  }
16  
  
17  
  afterVisualize { imageSurface_pixelated(imageSurface); }
18  
  
19  
  void update {
20  
    if (imageSurface == null) ret;
21  
    final BufferedImage img = dm_webCamImage();
22  
    temp tempAfterwards(r { lastImage = img });
23  
    if (img == null || img == lastImage) ret;
24  
    if (lastImage == null)
25  
      setZoom(doubleRatio(img.getWidth(), width));
26  
    setImage(resizeImage(img, width));
27  
  }
28  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019105
Snippet name: Web Cam, Pixelated [Dyn Module, OK]
Eternal ID of this version: #1019105/24
Text MD5: b7f6c68964b41a641ef04b8fe5da6f56
Transpilation MD5: 586af774a75d410d9fe1759c864f2512
Author: stefan
Category: javax / stefan's os / web cam
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-08 17:59:32
Source code size: 777 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 348 / 2428
Version history: 23 change(s)
Referenced in: [show references]