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

18
LINES

< > BotCompany Repo | #1006374 // mergeImagesHorizontally [with spacing]

JavaX fragment (include)

static RGBImage mergeImagesHorizontally(RGBImage... images) {
  ret mergeImagesHorizontally(toList(images));
}

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

Author comment

Began life as a copy of #1006081

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006374
Snippet name: mergeImagesHorizontally [with spacing]
Eternal ID of this version: #1006374/2
Text MD5: a6ae7f60e67f69abd84bee15951118fb
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 00:46:24
Source code size: 594 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 515 / 523
Version history: 1 change(s)
Referenced in: [show references]