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

55
LINES

< > BotCompany Repo | #1034147 // G22_TestScreenPanel [OK]

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (31949L) is out of date.

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()
    );
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034147
Snippet name: G22_TestScreenPanel [OK]
Eternal ID of this version: #1034147/15
Text MD5: 3cbf87b6f39f921be90e9d568f0b3d4b
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-26 14:58:08
Source code size: 1668 bytes / 55 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 385
Version history: 14 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)