feat: pool set_mask + route

Write a per-slot grayscale mask sidecar (img_XXXX.mask.png) and record
it on the slot. Add the multipart /grid_pool/set_mask route.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 14:01:26 +02:00
parent cd0b8783dc
commit 6feb2c6e63
4 changed files with 48 additions and 0 deletions
+8
View File
@@ -21,3 +21,11 @@ def test_handle_active_label_remove(tmp_path):
assert handlers.handle_active(base, "p1", 1)["active"] == 1
assert handlers.handle_label(base, "p1", 0, "hi")["slots"][0]["label"] == "hi"
assert len(handlers.handle_remove(base, "p1", 0)["slots"]) == 1
def test_handle_set_mask(tmp_path):
base = str(tmp_path)
handlers.handle_add(base, "p1", _png_bytes(), "png", ts=1)
m = handlers.handle_set_mask(base, "p1", 0, b"MASKBYTES")
assert m["slots"][0]["mask"] == "img_0001.mask.png"
assert (tmp_path / "p1" / "img_0001.mask.png").read_bytes() == b"MASKBYTES"