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

15
LINES

< > BotCompany Repo | #1006078 // mergeImagePartsHorizontally [with spacing]

JavaX fragment (include)

static RGBImage mergeImagePartsHorizontally(RGBImage img, L<Rect> rects) {
  RGB spaceColor = new RGB(0.9f);
  int spacing = imageMergeSpacing();
  if (l(rects) == 0) ret new RGBImage(1, 1, spaceColor);
  int w = intSum(rects, "w")+(l(rects)-1)*spacing, h = intMax(rects, "h");
  RGBImage out = new RGBImage(w, h, spaceColor);
  int x = 0;
  for i over rects: {
    Rect r = rects.get(i);
    int y = (h-r.h)/2;
    copyRGBImage(img, r.x, r.y, out, x, y, r.w, r.h);
    x += r.w + spacing;
  }
  ret out;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006078
Snippet name: mergeImagePartsHorizontally [with spacing]
Eternal ID of this version: #1006078/1
Text MD5: 83e8ef2144fb52a0dc2be5ecd8dac9cd
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-30 00:35:02
Source code size: 520 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 597 / 588
Referenced in: #1006081 - mergeImagesVertically [with spacing]
#1006385 - mergeImagePartsVertically
#1006654 - Standard functions list 2 (LIVE, continuation of #761)