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

15
LINES

< > BotCompany Repo | #1006385 // mergeImagePartsVertically

JavaX fragment (include)

static RGBImage mergeImagePartsVertically(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 h = intSum(rects, "h")+(l(rects)-1)*spacing, w = intMax(rects, "w");
  RGBImage out = new RGBImage(w, h, spaceColor);
  int y = 0;
  for i over rects: {
    Rect r = rects.get(i);
    int x = (w-r.w)/2;
    copyRGBImage(img, r.x, r.y, out, x, y, r.w, r.h);
    y += r.h + spacing;
  }
  ret out;
}

Author comment

Began life as a copy of #1006078

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: #1006385
Snippet name: mergeImagePartsVertically
Eternal ID of this version: #1006385/1
Text MD5: 236bd375fcd81085ec4cda1b85e62939
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:34:42
Source code size: 518 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 523 / 541
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)