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

18
LINES

< > BotCompany Repo | #1018775 // mergeBWImagesVertically [with spacing]

JavaX fragment (include)

1  
static BWImage mergeBWImagesVertically(BWImage... images) {
2  
  ret mergeBWImagesVertically(toList(images));
3  
}
4  
5  
static BWImage mergeBWImagesVertically(L<BWImage> images) {
6  
  int spacing = imageMergeSpacing();
7  
  float spaceColor = 0.9f;
8  
  int h = intSum(images, "height")+(l(images)-1)*spacing, w = intMax(images, "width");
9  
  BWImage out = new(w, h, spaceColor);
10  
  int y = 0;
11  
  for i over images: {
12  
    BWImage img = images.get(i);
13  
    int x = (w-img.w())/2;
14  
    copyBWImage(img, 0, 0, out, x, y);
15  
    y += img.h() + spacing;
16  
  }
17  
  ret out;
18  
}

Author comment

Began life as a copy of #1006081

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018775
Snippet name: mergeBWImagesVertically [with spacing]
Eternal ID of this version: #1018775/3
Text MD5: ba8fd08e6c258b84fe06907f0cfe63b6
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-13 16:05:17
Source code size: 556 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 366
Version history: 2 change(s)
Referenced in: [show references]