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

15
LINES

< > BotCompany Repo | #1006385 // mergeImagePartsVertically

JavaX fragment (include)

1  
static RGBImage mergeImagePartsVertically(RGBImage img, L<Rect> rects) {
2  
  RGB spaceColor = new RGB(0.9f);
3  
  int spacing = imageMergeSpacing();
4  
  if (l(rects) == 0) ret new RGBImage(1, 1, spaceColor);
5  
  int h = intSum(rects, "h")+(l(rects)-1)*spacing, w = intMax(rects, "w");
6  
  RGBImage out = new RGBImage(w, h, spaceColor);
7  
  int y = 0;
8  
  for i over rects: {
9  
    Rect r = rects.get(i);
10  
    int x = (w-r.w)/2;
11  
    copyRGBImage(img, r.x, r.y, out, x, y, r.w, r.h);
12  
    y += r.h + spacing;
13  
  }
14  
  ret out;
15  
}

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: 524 / 542
Referenced in: [show references]