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

23
LINES

< > BotCompany Repo | #1020683 // tilesToImage_twoLevelList

JavaX fragment (include)

1  
static BufferedImage tilesToImage_twoLevelList(LL<BufferedImage> tiles) {
2  
  if (empty(tiles)) null;
3  
  int columns = maxLength(tiles);
4  
  int rows = l(tiles);
5  
  int w = intSum(mapMethod getWidth(first(tiles)));
6  
  int h = intSum(mapMethod getWidth(map first(tiles)));
7  
  BufferedImage img = newBufferedImage(w, h);
8  
  
9  
  int yy = 0;
10  
  for y to rows: {
11  
    int xx = 0, th = 0;
12  
    for x to columns: {
13  
      BufferedImage tile = get(tiles.get(y), x);
14  
      if (tile != null) {
15  
        copyBufferedImage(tile, img, xx, yy);
16  
        xx += tile.getWidth();
17  
        th = tile.getHeight();
18  
      }
19  
    }
20  
    yy += th;
21  
  }
22  
  ret img;
23  
}

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: 192 / 239
Version history: 4 change(s)
Referenced in: [show references]