!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 = 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 data; for (MarkedClip clip) pcall { data.add(ll(clip.id, clip.img == null ? null : clip.img.getBufferedImage())); } showTableWithImages("Clips", splitAtSpace("ID Picture"), data); }