Uses 11335K of libraries. Click here for Pure Java version (2233L/14K).
!include once #1027304 // eclipse collections import org.eclipse.collections.impl.map.mutable.primitive.*; static IBWImage lazyBWImage(int w, int h, IF2<Int, Int, Float> getFloatPixel) { ret new IBWImage { new IntFloatHashMap knownPixels; public int getWidth() { ret w; } public int getHeight() { ret h; } public float getFloatPixel(int x, int y) { int i = x*w+h; Float f = knownPixels.getIfAbsent(i, Float.NaN); if (!isNaN(f)) ret f; knownPixels.put(i, f = getFloatPixel.get(x, y)); ret f; } }; }
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: | #1027305 |
Snippet name: | lazyBWImage - IBWImage with on-demand pixel generation. not synchronized |
Eternal ID of this version: | #1027305/5 |
Text MD5: | 505c40580f962c808d2fdb71ecd665d0 |
Transpilation MD5: | 933e7b29940f6115c3ccedbf2279fcfc |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-01 11:26:31 |
Source code size: | 584 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 203 / 310 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |