Libraryless. Click here for Pure Java version (7902L/45K).
1 | // f should return a value between 0 and 1 (will be clamped for you) |
2 | static BWImage bwImageFromFunction(int w, int h default w, IF2_IntInt_Double f) { |
3 | BWImage 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 BWImage bwImageFromFunction(int w, int h default w, IF0<Double> f) { |
11 | ret bwImageFromFunction(w, (x, y) -> f!); |
12 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026933 |
Snippet name: | bwImageFromFunction |
Eternal ID of this version: | #1026933/7 |
Text MD5: | 79db4da0ece03f30ffa766519c42f116 |
Transpilation MD5: | 8fcc3e0dd4321fe4ccb93bbe21a0072f |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-22 19:16:25 |
Source code size: | 401 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 282 / 417 |
Version history: | 6 change(s) |
Referenced in: | [show references] |