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).

static ImageSurface imageSurfaceCheckerBoardBackground(ImageSurface is) {
  if (is.drawBackground != null) ret is;
  double pixelsPerSecond = 8;
  is.drawBackground = (w, h, g) -> {
    var cb = new CheckerBoard2().w(w).h(h);
    double time = sysSeconds();
    int shift = iround(time*pixelsPerSecond);
    cb.shiftX(shift).shiftY(shift);
    cb.drawOn(g);
  };
  setDoubleBuffered(is);
  repaintEvery(1.0/pixelsPerSecond, is);
  ret is;
}

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: 16 / 49
Version history: 4 change(s)
Referenced in: [show references]