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

23
LINES

< > BotCompany Repo | #1020683 // tilesToImage_twoLevelList

JavaX fragment (include)

static BufferedImage tilesToImage_twoLevelList(LL<BufferedImage> tiles) {
  if (empty(tiles)) null;
  int columns = maxLength(tiles);
  int rows = l(tiles);
  int w = intSum(mapMethod getWidth(first(tiles)));
  int h = intSum(mapMethod getWidth(map first(tiles)));
  BufferedImage img = newBufferedImage(w, h);
  
  int yy = 0;
  for y to rows: {
    int xx = 0, th = 0;
    for x to columns: {
      BufferedImage tile = get(tiles.get(y), x);
      if (tile != null) {
        copyBufferedImage(tile, img, xx, yy);
        xx += tile.getWidth();
        th = tile.getHeight();
      }
    }
    yy += th;
  }
  ret img;
}

Author comment

Began life as a copy of #1020217

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: #1020683
Snippet name: tilesToImage_twoLevelList
Eternal ID of this version: #1020683/5
Text MD5: a96e3492905d0b597026c722ba5d5353
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:41:47
Source code size: 644 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 247 / 295
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020687 - twoLevelIntListToBWImage