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

16
LINES

< > BotCompany Repo | #1036008 // mergePatchworkImagesVertically [with spacing]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9839L/56K).

static <A> PatchworkImage<A> mergePatchworkImagesVertically(L<PatchworkImage<A>> images, O... _) {
  if (empty(images)) null;
  optPar int spacing = imageMergeSpacing();
  int h = intSum(mapMethod h(images))+(l(images)-1)*spacing;
  int w = intMax(mapMethod w(images));
  PatchworkImage<A> out = new(w, h);
  int y = 0;
  for (img : images) {
    int x = (w-img.w())/2;
    for (patch : img.patches)
      out.addPatch(patch.image,
        x+patch.bounds.x, y+patch.bounds.y, patch.userValue);
    y += img.h() + spacing;
  }
  ret out;
}

Author comment

Began life as a copy of #1024673

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036008
Snippet name: mergePatchworkImagesVertically [with spacing]
Eternal ID of this version: #1036008/1
Text MD5: cc0140220e08c8089139e8fc89ad7805
Transpilation MD5: 87adb507ae8f46c24578cbeff174b3bd
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-23 17:13:59
Source code size: 553 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 170 / 211
Referenced in: [show references]