Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1033393 // gridLOLToImage

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5917L/33K).

static BufferedImage gridLOLToImage(L<Int> cellWidths, L<Int> cellHeights, LL<Int> lol) {
  L<Matrix<Int>> lom = mapWithIndex(lol,
    (i, m) -> listToMatrix(cyclicGet(cellWidths, i), m));
  
  MatrixOfMatrices<Int> mom = listToMatrix_cols(l(cellWidths), lom);

  L<Int> cellX1s = partialSums_firstIs0(cellWidths);
  L<Int> cellY1s = partialSums_firstIs0(cellHeights);
  int w = last(cellX1s), h = last(cellY1s);
  BufferedImage restored = newBufferedImage(w, h);
  forEachWithPosition(mom, (x, y, cell) ->
    drawIntMatrix(restored, cell,
      cyclicGet(cellX1s, x),
      cyclicGet(cellY1s, y)));
  ret restored;
}

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: 190 / 324
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)