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

17
LINES

< > BotCompany Repo | #1020135 // mergeImagesHorizontally_top [with spacing, align on top]

JavaX fragment (include)

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

Author comment

Began life as a copy of #1006374

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020135
Snippet name: mergeImagesHorizontally_top [with spacing, align on top]
Eternal ID of this version: #1020135/1
Text MD5: 70cb1651ceb8c162b352874b5f004e9b
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-08 23:07:33
Source code size: 563 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 250 / 254
Referenced in: [show references]