Libraryless. Click here for Pure Java version (10829L/62K).
1 | // f should return a value between 0 and 1 (will be clamped for you) |
2 | static FloatBWImage floatBWImageFromFunction(int w, int h default w, IF2_IntInt_Double f) { |
3 | FloatBWImage img = new(w, h); |
4 | for y to h: |
5 | for x to w: |
6 | img.setPixel(x, y, (float) f.get(x, y)); |
7 | ret img; |
8 | } |
9 | |
10 | static FloatBWImage floatBWImageFromFunction(int w, int h default w, IF0<Double> f) { |
11 | ret floatBWImageFromFunction(w, (x, y) -> f!); |
12 | } |
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: | 128 / 181 |
Referenced in: | [show references] |