Libraryless. Click here for Pure Java version (10829L/62K).
// f should return a value between 0 and 1 (will be clamped for you) static FloatBWImage floatBWImageFromFunction(int w, int h default w, IF2_IntInt_Double f) { FloatBWImage img = new(w, h); for y to h: for x to w: img.setPixel(x, y, (float) f.get(x, y)); ret img; } static FloatBWImage floatBWImageFromFunction(int w, int h default w, IF0<Double> f) { ret floatBWImageFromFunction(w, (x, y) -> f!); }
Began life as a copy of #1026933
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035848 |
Snippet name: | floatBWImageFromFunction |
Eternal ID of this version: | #1035848/1 |
Text MD5: | 22951b52f4a7804080d5a09e8fcf9238 |
Transpilation MD5: | b084f19f80d55b34794e4cb5ed17a6bd |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-02 22:15:34 |
Source code size: | 431 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 127 / 180 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |