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

24
LINES

< > BotCompany Repo | #1035881 // JMaxSpeedAnimation

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

Libraryless. Click here for Pure Java version (19190L/120K).

1  
sclass JMaxSpeedAnimation is Swingable {
2  
  settable IF0<BufferedImage> renderFrame;
3  
  gettable new ImageSurface imageSurface;
4  
  gettable new DoubleFPSCounter fps;
5  
  
6  
  *() {}
7  
  *(IF0<BufferedImage> *renderFrame) {}
8  
  
9  
  cachedVisualize {
10  
    imageSurface.pixelate(true);
11  
    imageSurface.autoZoomToDisplay(true);
12  
    awtCalcContinuously(imageSurface, -> {
13  
      var img = renderFrame!;
14  
      fps.inc();
15  
      displayNewImage(img);
16  
    });
17  
    ret jscroll_center_borderless(imageSurface);
18  
  }
19  
  
20  
  // image may be null (=no update)
21  
  swappable void displayNewImage(BufferedImage image) {
22  
    if (image != null) imageSurface.setImage(image);
23  
  }
24  
}

Author comment

Began life as a copy of #1035609

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035881
Snippet name: JMaxSpeedAnimation
Eternal ID of this version: #1035881/7
Text MD5: 10c3538c64f26b47d75cb708b2c0c173
Transpilation MD5: 46ce5f979a7eb692e9dea2949d1c98bb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-17 22:05:37
Source code size: 668 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 256
Version history: 6 change(s)
Referenced in: [show references]