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

11
LINES

< > BotCompany Repo | #1035491 // image2BFromFunction

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

Libraryless. Click here for Pure Java version (11132L/63K).

static Image2B image2BFromFunction(int w, int h default w, IIntIntPred f) {
  Image2B img = new(w, h);
  for y to h:
    for x to w:
      img.setPixel(x, y, f.get(x, y));
  ret img;
}

static Image2B image2BFromFunction(int w, int h default w, IF0_Bool f) {
  ret image2BFromFunction(w, h, (x, y) -> f!);
}

Author comment

Began life as a copy of #1026933

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): mowyntqkapby, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035491
Snippet name: image2BFromFunction
Eternal ID of this version: #1035491/4
Text MD5: 7f65be8dd1a0146c92b5692b6a514c35
Transpilation MD5: 9c0442615c376aa6313a0917fa8208af
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-08 23:37:08
Source code size: 317 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 233
Version history: 3 change(s)
Referenced in: [show references]