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)

static BWImage mergeBWImagesVertically(BWImage... images) {
  ret mergeBWImagesVertically(toList(images));
}

static BWImage mergeBWImagesVertically(L<BWImage> images) {
  int spacing = imageMergeSpacing();
  float spaceColor = 0.9f;
  int h = intSum(images, "height")+(l(images)-1)*spacing, w = intMax(images, "width");
  BWImage out = new(w, h, spaceColor);
  int y = 0;
  for i over images: {
    BWImage img = images.get(i);
    int x = (w-img.w())/2;
    copyBWImage(img, 0, 0, out, x, y);
    y += img.h() + spacing;
  }
  ret out;
}

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: 335 / 363
Version history: 2 change(s)
Referenced in: [show references]