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

16
LINES

< > BotCompany Repo | #1036007 // patchworkBufferedImagesHorizontally [with spacing]

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

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

static <A> PatchworkImage<A> patchworkBufferedImagesHorizontally(LPair<BufferedImage, A> imagesAndValues, O... _) {
  if (empty(imagesAndValues)) null;
  optPar int spacing = imageMergeSpacing();
  var images = pairsA(imagesAndValues);
  int w = intSum(mapMethod getWidth(images))+(l(images)-1)*spacing;
  int h = intMax(mapMethod getHeight(images));
  PatchworkImage<A> out = new(w, h);
  int x = 0;
  for (imageAndValue : imagesAndValues) {
    BufferedImage img = imageAndValue.a;
    int y = (h-img.getHeight())/2;
    out.addPatch(img, x, y, imageAndValue.b);
    x += img.getWidth() + spacing;
  }
  ret out;
}

Author comment

Began life as a copy of #1024673

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036007
Snippet name: patchworkBufferedImagesHorizontally [with spacing]
Eternal ID of this version: #1036007/8
Text MD5: 3b1a294e80e2e9800da9f2679214450b
Transpilation MD5: 822d56f02d9c15df62a0ee6525a2115f
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:00:46
Source code size: 631 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 69 / 115
Version history: 7 change(s)
Referenced in: [show references]