static PatchworkImage patchworkBufferedImagesHorizontally(LPair 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 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;
}