persistable sclass G22_TestScreenPanel is IHasChangeListeners { settableWithChange S script = "rasters"; settableWithChange bool animate = true; event change; transient Animation animation; transient settable G22Utils g22utils; transient ImageSurface isInput; transient JGazelleVScriptRunner scriptRunner; void start { scriptRunner = new JGazelleVScriptRunner( liveValue_hasChangeListeners(this, S, -> script, x -> script = x)); isInput = g22utils.stdImageSurface(); // when test screen is visible, do the animation awtEvery(isInput, 1000/20, r stepAnimation); } void stepAnimation { if (!animate) ret; if (animation == null) { animation = new AnimatedLine; animation.start(); } animation.nextFrame(); var img = whiteImage(animation.w, animation.h); animation.setGraphics(createGraphics(img)); animation.paint(); isInput?.setImage(img); var ii = bwIntegralImage_withMeta(img); scriptRunner.parseAndRunOn(ii); } visualize { if (isInput == null) start(); ret centerAndSouthWithMargin( hsplit( northAndCenterWithMargin(centerAndEastWithMargin( jlabel("Input"), liveValueCheckBox("Animate", liveValue_hasChangeListeners(this, bool.class, -> animate, x -> animate(x)))), jscroll_centered_borderless(isInput)), northAndCenterWithMargin(centerAndEastWithMargin( jlabel("Output"), scriptRunner.lblScore), scriptRunner.scpScriptResult) ), scriptRunner.scriptInputField() ); } }