Libraryless. Click here for Pure Java version (9839L/56K).
1 | static <A> PatchworkImage<A> mergePatchworkImagesVertically(L<PatchworkImage<A>> images, O... _) {
|
2 | if (empty(images)) null; |
3 | optPar int spacing = imageMergeSpacing(); |
4 | int h = intSum(mapMethod h(images))+(l(images)-1)*spacing; |
5 | int w = intMax(mapMethod w(images)); |
6 | PatchworkImage<A> out = new(w, h); |
7 | int y = 0; |
8 | for (img : images) {
|
9 | int x = (w-img.w())/2; |
10 | for (patch : img.patches) |
11 | out.addPatch(patch.image, |
12 | x+patch.bounds.x, y+patch.bounds.y, patch.userValue); |
13 | y += img.h() + spacing; |
14 | } |
15 | ret out; |
16 | } |
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: | 459 / 553 |
| Referenced in: | [show references] |