static BufferedImage tilesToImage(L<BufferedImage> tiles, int columns) { if (empty(tiles)) null; int rows = idiv_ceil(l(tiles), columns); int tw = first(tiles).getWidth(), th = first(tiles).getHeight(); int w = tw*columns, h = th*rows; BufferedImage img = newBufferedImage(w, h); int i = 0, yy = 0; for y to rows: { int xx = 0; for x to columns: { if (i >= l(tiles)) break; BufferedImage tile = tiles.get(i++); copyBufferedImage(tile, img, xx, yy); xx += tile.getWidth(); th = tile.getHeight(); } yy += th; } ret img; }
Began life as a copy of #1016032
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020217 |
Snippet name: | tilesToImage - TODO: varying tile sizes |
Eternal ID of this version: | #1020217/6 |
Text MD5: | 7dcba2048bafbaaf3a8332470f402e61 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-30 21:06:32 |
Source code size: | 606 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 278 / 323 |
Version history: | 5 change(s) |
Referenced in: | [show references] |