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

14
LINES

< > BotCompany Repo | #1035978 // imageSurfaceCheckerBoardBackground

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

Libraryless. Click here for Pure Java version (19351L/121K).

1  
static ImageSurface imageSurfaceCheckerBoardBackground(ImageSurface is) {
2  
  if (is.drawBackground != null) ret is;
3  
  double pixelsPerSecond = 8;
4  
  is.drawBackground = (w, h, g) -> {
5  
    var cb = new CheckerBoard2().w(w).h(h);
6  
    double time = sysSeconds();
7  
    int shift = iround(time*pixelsPerSecond);
8  
    cb.shiftX(shift).shiftY(shift);
9  
    cb.drawOn(g);
10  
  };
11  
  setDoubleBuffered(is);
12  
  repaintEvery(1.0/pixelsPerSecond, is);
13  
  ret is;
14  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035978
Snippet name: imageSurfaceCheckerBoardBackground
Eternal ID of this version: #1035978/5
Text MD5: 7052f5a445b846fa15f2a9533930d88f
Transpilation MD5: 212519923576e256b4d0a4c0ecbbf9cc
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-20 23:06:35
Source code size: 453 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 185 / 260
Version history: 4 change(s)
Referenced in: [show references]