!752 /* -Screenshots (as usual) -User-supplied clips (bwImage, pos/neg, position, screenshot) [optional: Comments on clips] */ concepts. !include #1005686 // PIF Classes v2 static JComponent form; static JLabel lFound, lSearchTime; p-substance { concepts(); form = showForm( "Number of button pictures stored:", jConceptCountLabel(Clip), "Number of screenshots stored:", jConceptDependentLabel(func { int n = countConcepts(Screenshot); int t = countConcepts(TransientScreenshot); ret n + " (" + (n-t) + " with image)"; }), "Currently found:", lFound = jlabel(), "Search time:", lSearchTime = jlabel(), "", jbutton("Show pictures", r { showClips() }), "", jbutton("Grab picture of start button", r { addClip(false) }), "", jbutton("Grab picture with delay", r { addClip(true) }) ); final new MonoThread thread; installTimer(form, 5000, 0, r { thread.runIfNotRunning(r { BufferedImage img = shootScreen2(); long start = now(); final L<Found> found = continuousFind_step(list(Clip), img); final long time = now()-start; awt { lSearchTime.setText(time + " ms"); S s = "no"; if (nempty(found)) s = "at " + first(found).fi.r + " [clip " + first(found).clip->id + "]"; if (l(found) > 1) s += " +" + (l(found)-1); lFound.setText(s); } }); }); } svoid addClip(bool delay) { letUserMarkScreenArea(delay ? null : shootScreen2(), voidfunc(final Rectangle r, BufferedImage img) { if (r == null) print("Cancelled!"); else { Screenshot screenshot = new Screenshot(img); showAnimation("#1005611", "You marked " + r, 3); uniq(MarkedClip, +screenshot, positionInScreenshot := new Rect(r), description := "Start button", img := new BWImage(img).clip(r)); darkenScreenArea(r, 5); swingLater(250, r { pointArrowsToArea(r, 5-0.25); }); } }); } svoid showClips { new L<L> data; for (MarkedClip clip) pcall { data.add(ll(clip.id, clip.img == null ? null : clip.img.getBufferedImage())); } showTableWithImages("Clips", splitAtSpace("ID Picture"), data); }
Began life as a copy of #1005676
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005747 |
Snippet name: | Find Start Button [backup] |
Eternal ID of this version: | #1005747/1 |
Text MD5: | 81070c4e2da948c2cc4b1332606ab797 |
Author: | stefan |
Category: | javax / gui / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-05 22:31:59 |
Source code size: | 2275 bytes / 77 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 527 / 508 |
Referenced in: | -