Uses 1113K of libraries. Click here for Pure Java version (12616L/66K).
!7 cm LetterboxOnScreen2 > DynPrintLogAndEnabled { switchable double frequency = 5.0; // 5 fps transient S shootingTime, conversionTime, recognitionTime; transient Map<O, JWindow> alwaysOnTopWindows = syncMap(); void cleanMeUp_windows { disposeWindows(getValuesAndClear(alwaysOnTopWindows)); } JComponent wrapControlArea() { ret northAndCenterWithMargin( hgridWithSpacing( dm_fieldLabelWithLabel shootingTime(), dm_fieldLabelWithLabel conversionTime(), dm_fieldLabelWithLabel recognitionTime()), super.wrapControlArea()); } start { dm_reloadOnFieldChange interval(); dm_doEvery(doubleRatio(1, frequency), r doIt); } void doIt { if (!enabled) ret with cleanMeUp_windows(); var rect = screenBounds(1); if (rect == null) ret; new TimeTaker tt; tt.start(); var img = shootScreen2(rect); setField(shootingTime := tt.renderMicroseconds()); tt.start(); var ii = IntegralImage(img); setField(conversionTime := tt.renderMicroseconds()); tt.start(); new Var<Rect> theBox; hijackPrint(r { stepAllWithStats(new ULetterbox1().run(ii, setVarWithConversion toRect(theBox))); }); setField(recognitionTime := tt.renderMicroseconds()); print(imageBounds(img) + " - " + theBox!); //showImageWithSelection(img, theBox!); var box1 = rect(rect.x, rect.y, rect.w, theBox->y); var box2 = rectFromPoints(rect.x, rect.y+theBox->y2(), rect.x2(), rect.y2()); printVars(+box1, +box2); positionMarkerWindow(0, box1, withAlpha(.2, Color.green)); positionMarkerWindow(1, box2, withAlpha(.2, Color.green)); } JWindow getOrCreateMarkerWindow(O key) { ret swing(() -> syncMapGetOrCreate(alwaysOnTopWindows, key, () -> makeAlwaysOnTopTranslucentWindow())); } void positionMarkerWindow(int iWindow, Rect box, Color color) { awt { JWindow w = getOrCreateMarkerWindow(iWindow); setBounds(w, box); w.setBackground(color); w.setVisible(true); } } }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032099 |
Snippet name: | Letterbox On Screen 2 |
Eternal ID of this version: | #1032099/11 |
Text MD5: | b814d946c36222a0d1db73935e0b6d9c |
Transpilation MD5: | b8e411d3e348657a50e37d15c017cbbc |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-12 05:30:30 |
Source code size: | 2097 bytes / 74 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 161 / 1680 |
Version history: | 10 change(s) |
Referenced in: | -