From 073051c76e8a790fd0e541afd399f08b7f113e95 Mon Sep 17 00:00:00 2001
From: Exp <17885980+exp111@users.noreply.github.com>
Date: Thu, 11 Jan 2024 12:12:27 +0100
Subject: [PATCH] stitching

---
 README.md       | 42 ------------------------------------------
 map/stitchWS.py | 26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 42 deletions(-)
 create mode 100644 map/stitchWS.py

diff --git a/README.md b/README.md
index 4fb733e..69f067a 100644
--- a/README.md
+++ b/README.md
@@ -5,48 +5,6 @@ Uses Leaflet to show the map.
 
 You need to first load a map before being able to play. A test map is available through the menu (Click "Load Test Map").
 
-## TODO:
-- mp:
-    - let users set color
-    - let users select name?
-    - make connecting less cbt
-    - ping? => do direction effect on border when ping off screen
-    - notify user that other user has changed/reset case
-    - host migration/close lobby when host leaves
-- right click menu:
-    - delete all markers
-    - debug:
-        - on circle/shape: set color
-- style markers (so you can see what you marked)
-- fix bounds on small images
-- mark solved cards better in ui
-- make objective display better on mobile
-- add shake on mobile/general cards after waiting too long?
-- add possibility to (temporarily) see unflipped card?
-- save case progress
-- save settings
-- optimize loading (zip limited?)
-- show step progress (1/4) somewhere on mobile (card menu? corner?)
-- finer file load progress bar (hook put onsuccess?)
-- performance test loading (seperate zip and idb tests)
-- hints
-- tests??
-- toolbar like debug menu for quick access?
-- finish timer
-- fix slides not being centered after resizing while case is finished (swiper is disabled)
-- Ui shouldnt have to do case logic checks, mark step as unsolvable (in buildnodes?), only check that flag
-- use card classes instead of adding card overlays for locked and solved?
-- fix caseclosed.png clipping
-- delete circles after clicking them in a AND/OR node
-- clean up multi-steps + objectives code
-- move to (first) unlocked card after solving card?
-- test multi steps more
-- case finish animation not working on mobile?
-
-## CaseBuilder TODO:
-- better step requirement input
-- show error symbol when something went wrong
-
 # How to create a map from a image
 To transform a image to raster tiles you can use libvips with this command:
 
diff --git a/map/stitchWS.py b/map/stitchWS.py
new file mode 100644
index 0000000..83dfa7f
--- /dev/null
+++ b/map/stitchWS.py
@@ -0,0 +1,26 @@
+from PIL import Image
+offsets = [
+    #x,y
+    [(0,0), (3244,0), (6493,0), (9742,0)],
+    [(0,2209), (3244,2209), (6493,2209), (9742,2209)],
+    [(0,4428), (3244,4422), (6493,4427), (9742,4422)],
+    [(0,6647), (3244,6641), (6493,6637), (9742,6635)],
+]
+
+# get the last image
+lastRow = len(offsets) - 1
+lastColumn = len(offsets[0]) - 1
+lastImg = Image.open(f"{lastRow}_{lastColumn}.png")
+
+totalWidth = offsets[lastRow][lastColumn][0] + lastImg.width
+totalHeight = offsets[lastRow][lastColumn][1] + lastImg.height
+print(f"Width: {totalWidth}, Height: {totalHeight}")
+
+img = Image.new("RGBA", (totalWidth, totalHeight))
+offset = 0
+for row in range(len(offsets)):
+    for column in range(len(offsets[0])):
+        offset = offsets[row][column]
+        img.paste(Image.open(f"{row}_{column}.png"), offset)
+img.save("out.png")
+print("Done")
\ No newline at end of file