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)

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

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