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

9
LINES

< > BotCompany Repo | #1022949 // colorPredicateToBWImage

JavaX fragment (include)

static BWImage colorPredicateToBWImage(F1<Int, Bool> predicate, RGBImage img) {
  int w = img.getWidth(), h = img.getHeight();
  BWImage bw = new(w, h);
  for y to h:
    for x to w:
      if (callF(predicate, img.getInt(x, y)))
        bw.setPixel(x, y, 1f);
  ret bw;
}

Author comment

Began life as a copy of #1022943

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022949
Snippet name: colorPredicateToBWImage
Eternal ID of this version: #1022949/3
Text MD5: 9f353b2e5dbd70f2b60257331cfcaa4f
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-15 03:48:39
Source code size: 279 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 227
Version history: 2 change(s)
Referenced in: [show references]