Libraryless. Click here for Pure Java version (5917L/33K).
1 | static BufferedImage gridLOLToImage(L<Int> cellWidths, L<Int> cellHeights, LL<Int> lol) { |
2 | L<Matrix<Int>> lom = mapWithIndex(lol, |
3 | (i, m) -> listToMatrix(cyclicGet(cellWidths, i), m)); |
4 | |
5 | MatrixOfMatrices<Int> mom = listToMatrix_cols(l(cellWidths), lom); |
6 | |
7 | L<Int> cellX1s = partialSums_firstIs0(cellWidths); |
8 | L<Int> cellY1s = partialSums_firstIs0(cellHeights); |
9 | int w = last(cellX1s), h = last(cellY1s); |
10 | BufferedImage restored = newBufferedImage(w, h); |
11 | forEachWithPosition(mom, (x, y, cell) -> |
12 | drawIntMatrix(restored, cell, |
13 | cyclicGet(cellX1s, x), |
14 | cyclicGet(cellY1s, y))); |
15 | ret restored; |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mikhejdllvsw, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033393 |
Snippet name: | gridLOLToImage |
Eternal ID of this version: | #1033393/6 |
Text MD5: | a99f503637f3405521e1c8497cc8ed87 |
Transpilation MD5: | 046564a69494d8c2a45a94fed14ecdef |
Author: | stefan |
Category: | javax / recognition by compression |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-27 02:19:44 |
Source code size: | 633 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 189 / 324 |
Version history: | 5 change(s) |
Referenced in: | [show references] |