Libraryless. Click here for Pure Java version (11132L/63K).
1 | static Image2B image2BFromFunction(int w, int h default w, IIntIntPred f) { |
2 | Image2B img = new(w, h); |
3 | for y to h: |
4 | for x to w: |
5 | img.setPixel(x, y, f.get(x, y)); |
6 | ret img; |
7 | } |
8 | |
9 | static Image2B image2BFromFunction(int w, int h default w, IF0_Bool f) { |
10 | ret image2BFromFunction(w, h, (x, y) -> f!); |
11 | } |
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: | 181 / 237 |
Version history: | 3 change(s) |
Referenced in: | [show references] |