Merge remote-tracking branch 'origin/main' into fix/17471-fill-remembers-scripted-color

# Conflicts:
#	crates/engine-paint/src/cmd/fill_cmds.rs
This commit is contained in:
David Mann committed 2026-11-30 19:15:03 +01:00
commit d645a5de70
32 files changed
+1590 -197

No files matched your search

Generated
+95 -95
View File
@@ -1376,7 +1376,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1417,7 +1417,7 @@ dependencies = [
[[package]]
name = "craft-affinity"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"crc32fast",
"flate2",
@@ -1438,7 +1438,7 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -1450,7 +1450,7 @@ dependencies = [
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"rustix 1.1.6",
]
@@ -1458,7 +1458,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1483,7 +1483,7 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"accesskit",
"bitflags 2.13.2",
@@ -1501,7 +1501,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1519,7 +1519,7 @@ dependencies = [
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"egui",
]
@@ -1527,7 +1527,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"md-5",
"rayon",
@@ -1536,12 +1536,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
[[package]]
name = "craft-color"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"serde",
]
@@ -1549,7 +1549,7 @@ dependencies = [
[[package]]
name = "craft-color-transform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-cms",
"craft-color",
@@ -1559,7 +1559,7 @@ dependencies = [
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1579,7 +1579,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-ai-agents",
"craft-atomic",
@@ -1595,7 +1595,7 @@ dependencies = [
[[package]]
name = "craft-control-protocol"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"getrandom 0.3.4",
"serde_json",
@@ -1605,7 +1605,7 @@ dependencies = [
[[package]]
name = "craft-crs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-metadata",
"craft-xml",
@@ -1615,7 +1615,7 @@ dependencies = [
[[package]]
name = "craft-crw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"thiserror 2.0.21",
]
@@ -1623,7 +1623,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"rayon",
]
@@ -1631,7 +1631,7 @@ dependencies = [
[[package]]
name = "craft-develop"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-color",
"craft-color-transform",
@@ -1646,7 +1646,7 @@ dependencies = [
[[package]]
name = "craft-develop-model"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-geom",
"craft-metadata",
@@ -1658,7 +1658,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"block2 0.6.2",
"craft-appkit",
@@ -1684,7 +1684,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"serde",
]
@@ -1692,7 +1692,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1711,12 +1711,12 @@ dependencies = [
[[package]]
name = "craft-eps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
[[package]]
name = "craft-file-formats"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-eps",
"craft-idml",
@@ -1734,7 +1734,7 @@ dependencies = [
[[package]]
name = "craft-flags"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-atomic",
"dirs",
@@ -1744,7 +1744,7 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1759,7 +1759,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1779,7 +1779,7 @@ dependencies = [
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
@@ -1788,7 +1788,7 @@ dependencies = [
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"cap-primitives",
"craft-atomic",
@@ -1811,12 +1811,12 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
[[package]]
name = "craft-geom"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"serde",
]
@@ -1824,7 +1824,7 @@ dependencies = [
[[package]]
name = "craft-heif"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"heic-rs",
"rayon",
@@ -1833,7 +1833,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1846,7 +1846,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"brotli 9.1.3",
"brotli-decompressor 6.3.2",
@@ -1876,7 +1876,7 @@ dependencies = [
[[package]]
name = "craft-idml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1886,7 +1886,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-dds",
"craft-heif",
@@ -1914,7 +1914,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1932,12 +1932,12 @@ dependencies = [
[[package]]
name = "craft-ipp"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"thiserror 2.0.21",
]
@@ -1945,7 +1945,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1960,7 +1960,7 @@ dependencies = [
[[package]]
name = "craft-kra"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1970,7 +1970,7 @@ dependencies = [
[[package]]
name = "craft-layers"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -1984,7 +1984,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2002,7 +2002,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"brotli-decompressor 6.3.2",
"chrono",
@@ -2014,7 +2014,7 @@ dependencies = [
[[package]]
name = "craft-nightly"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"uds_windows",
"winsafe",
@@ -2023,7 +2023,7 @@ dependencies = [
[[package]]
name = "craft-ora"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-xml",
"craft-zip",
@@ -2033,7 +2033,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2049,7 +2049,7 @@ dependencies = [
[[package]]
name = "craft-pcraft-bundle"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"blake3",
"craft-atomic",
@@ -2062,7 +2062,7 @@ dependencies = [
[[package]]
name = "craft-pcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"flate2",
"serde",
@@ -2073,7 +2073,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bytemuck",
"flate2",
@@ -2088,7 +2088,7 @@ dependencies = [
[[package]]
name = "craft-pdn"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -2097,7 +2097,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"async-channel",
"async-io",
@@ -2130,7 +2130,7 @@ dependencies = [
[[package]]
name = "craft-plist"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"thiserror 2.0.21",
]
@@ -2138,7 +2138,7 @@ dependencies = [
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2162,7 +2162,7 @@ dependencies = [
[[package]]
name = "craft-psd"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"encoding_rs",
"flate2",
@@ -2173,7 +2173,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"dispatch2",
"egui",
@@ -2186,7 +2186,7 @@ dependencies = [
[[package]]
name = "craft-raw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"chrono",
"craft-crw",
@@ -2204,7 +2204,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -2223,7 +2223,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2240,7 +2240,7 @@ dependencies = [
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-image-codecs",
"craft-xml",
@@ -2261,7 +2261,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2273,7 +2273,7 @@ dependencies = [
[[package]]
name = "craft-testkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"rustix 1.1.6",
"tempfile",
@@ -2283,7 +2283,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-font-manager",
@@ -2306,7 +2306,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2321,7 +2321,7 @@ dependencies = [
[[package]]
name = "craft-theme-editor"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-theme",
@@ -2332,7 +2332,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2347,7 +2347,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2357,7 +2357,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2366,7 +2366,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2381,7 +2381,7 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"serde",
]
@@ -2389,7 +2389,7 @@ dependencies = [
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2403,7 +2403,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -2419,7 +2419,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2461,7 +2461,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2472,7 +2472,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2490,7 +2490,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2511,7 +2511,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2531,7 +2531,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2550,7 +2550,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -2582,7 +2582,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"winsafe",
]
@@ -2590,7 +2590,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"craft-appkit",
"craft-atomic",
@@ -2622,7 +2622,7 @@ dependencies = [
[[package]]
name = "craft-xcf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -2631,7 +2631,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -2641,7 +2641,7 @@ dependencies = [
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -4165,7 +4165,7 @@ dependencies = [
[[package]]
name = "hayro"
version = "0.7.1"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bytemuck",
"hayro-interpret",
@@ -4195,7 +4195,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -4213,7 +4213,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -4237,7 +4237,7 @@ checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -5330,7 +5330,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"arrayvec",
"kurbo 0.13.1",
@@ -9841,7 +9841,7 @@ dependencies = [
[[package]]
name = "vello_common"
version = "0.0.8"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bytemuck",
"fearless_simd",
@@ -9889,7 +9889,7 @@ dependencies = [
[[package]]
name = "vello_cpu"
version = "0.0.8"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
dependencies = [
"bytemuck",
"glifo 0.1.1",
@@ -11535,14 +11535,14 @@ source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387
[[patch.unused]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
[[patch.unused]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
[[patch.unused]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=6ffc396957f7b12ec8fae8bf9084f077384ad2b4#6ffc396957f7b12ec8fae8bf9084f077384ad2b4"
source = "git+https://github.com/storytold/craft-libs?rev=4ed3d95b0f244b2b10d5f167183658f38f73594d#4ed3d95b0f244b2b10d5f167183658f38f73594d"
+42 -42
View File
@@ -12,21 +12,21 @@ rust-version = "1.95"
[workspace.dependencies]
# The craft framework through its facade (`craft::ui::…`). The egui `[patch]` below must match
# `craft::egui_fork::REV` (checked by `cargo xtask ci`).
craft = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4", default-features = false }
craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d", default-features = false }
craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
# internal
photocraft-geom = { path = "crates/geom" }
photocraft-color = { path = "crates/color" }
photocraft-raster = { path = "crates/raster" }
photocraft-doc = { path = "crates/doc" }
photocraft-ops = { path = "crates/ops" }
craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] }
craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] }
photocraft-raw = { path = "crates/raw" }
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
photocraft-compose = { path = "crates/compose" }
photocraft-gpu = { path = "crates/gpu" }
photocraft-paint = { path = "crates/paint" }
@@ -48,38 +48,38 @@ photocraft-ipp = { path = "crates/ipp" }
# external
# ICC colour management: the shared crate (replaces crates/cms; craft-libs#779).
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-print = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-print = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
# HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784).
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4", features = ["raster", "write-raster"] }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d", features = ["raster", "write-raster"] }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
# Keep the shared embedded-image validation API until the framework revision includes it.
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4", features = ["tree-render", "tree-render-system-fonts"] }
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d", features = ["tree-render", "tree-render-system-fonts"] }
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
# Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563.
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
# Interface translations: lookup, fallback, CLDR plurals and language names over the craft-i18n
# catalogs that `crates/ui-egui/build.rs` embeds from `CRAFT_I18N_DIR` (storytold/craft-i18n, at
# the commit in `craft-i18n.rev`). Already in the tree through craft.
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
# craft-update: app-specific pretend versions apply to startup and manual checks.
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4", features = ["ui"] }
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d", features = ["ui"] }
# Self-contained nightly profile isolation, launch protocol, and security fence.
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
thiserror = "2"
serde = { version = "1", features = ["derive", "rc"] }
serde_json = "1"
@@ -352,16 +352,16 @@ opt-level = 3
# Keep the complete egui family and native event bridge on reviewed fork commits.
[patch.crates-io]
krilla = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
vello_common = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
vello_common = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
+3 -3
View File
@@ -2112,7 +2112,7 @@ fn mcp_session(args: &[&str], env: &[(&str, &std::ffi::OsStr)], calls: &[(&str,
}
/// Plain `mcp` without the person's consent works headless, as it always did: commands run, UI
/// tools say they need the open app. `--headless` too, and it doesn't read a PHOTOCRAFT_CONTROL_PORT
/// tools are not offered. `--headless` too, and it doesn't read a PHOTOCRAFT_CONTROL_PORT
/// exported for another tool (here not even a port).
#[test]
fn mcp_without_consent_works_headless() {
@@ -2124,8 +2124,8 @@ fn mcp_without_consent_works_headless() {
let calls = [("command_list", json!({})), ("ui_inspect", json!({}))];
let r = mcp_session(&["mcp", "--when-closed", "error"], &env, &calls);
assert_ne!(r[0]["isError"], true, "headless commands run: {}", r[0]);
assert_eq!(r[1]["isError"], true, "{}", r[1]);
assert!(r[1]["content"][0]["text"].as_str().unwrap().contains("bridge"), "{}", r[1]);
// An unknown tool is a protocol error, so the reply has no `result`.
assert!(r[1].is_null(), "headless mcp offers no ui_* tools: {}", r[1]);
let mut env = env.to_vec();
env.push(("PHOTOCRAFT_CONTROL_PORT", std::ffi::OsStr::new("not-a-port")));
let r = mcp_session(&["mcp", "--headless"], &env, &calls[..1]);
+16 -4
View File
@@ -637,6 +637,9 @@ impl PhotocraftMcp {
pub fn with_backend(backend: Backend) -> Self {
let mut tool_router = Self::tool_router();
if matches!(&backend, Backend::Headless(_)) {
tool_router.map.retain(|name, _| !name.starts_with("ui_") && name != "control_call");
}
for route in tool_router.map.values_mut() {
let mut schema = (*route.attr.input_schema).clone();
strict_schema(&mut schema);
@@ -1058,13 +1061,13 @@ impl PhotocraftMcp {
`disabledReason` says why a command is off (null when enabled); `needsDocument` is true when it is off because no \
document is open: create or open one first (doc_new, doc_open).")]
async fn command_list(&self, Parameters(p): Parameters<ListParams>) -> Result<CallToolResult, McpError> {
let all = if let Some(r) = self.headless_op(|h| Ok(h.command_list())).await {
r
let (all, headless) = if let Some(r) = self.headless_op(|h| Ok(h.command_list())).await {
(r, true)
} else {
let Some(b) = self.bridge_client() else {
return Ok(no_backend());
};
b.call_read("engine.commands", json!({})).await
(b.call_read("engine.commands", json!({})).await, false)
};
let all = match all {
Ok(v) => v,
@@ -1072,10 +1075,19 @@ impl PhotocraftMcp {
};
let needle = p.filter.map(|f| f.to_lowercase());
let enabled_only = p.enabled_only.unwrap_or(false);
let params = json!({});
let items: Vec<Value> = into_command_rows(all)
.into_iter()
.filter(|c| {
needle.as_ref().is_none_or(|n| photocraft_engine::commands::list_entry_matches(c, n))
let allowed = c.get("id").and_then(Value::as_str).is_some_and(|id| {
if headless {
id == "file.export.renderVideo" || crate::workspace::authorize_engine_command(id, &params).is_ok()
} else {
crate::workspace::authorize_desktop_engine_command(id, &params).is_ok()
}
});
allowed
&& needle.as_ref().is_none_or(|n| photocraft_engine::commands::list_entry_matches(c, n))
&& (!enabled_only || c.get("enabled").and_then(Value::as_bool).unwrap_or(true))
})
.collect();
+1 -1
View File
@@ -9,7 +9,7 @@ use rmcp::service::RequestContext;
const DOCUMENT: &str = "photocraft://document";
const COMMANDS: &str = "photocraft://commands";
const INSTRUCTIONS: &str = "PhotoCraft image editor. Start with doc_new/doc_open, discover ids and parameter docs with command_list, edit with command_run or command_batch (one history step per command). Inspect with doc_inspect and render_preview; doc_save writes native .pcraft or exports by extension. File paths are relative to the read/write roots granted at launch; agent_folders tells where they are. ui_inspect/ui_screenshot and other ui_* tools require bridge mode. Read photocraft://document and photocraft://commands for live JSON state.";
const INSTRUCTIONS: &str = "PhotoCraft image editor. Start with doc_new/doc_open, discover ids and parameter docs with command_list, edit with command_run or command_batch (one history step per command). Inspect with doc_inspect and render_preview; doc_save writes native .pcraft or exports by extension. File paths are relative to the read/write roots granted at launch; agent_folders tells where they are. ui_* tools and control_call, where listed, need the open app (bridge mode). Read photocraft://document and photocraft://commands for live JSON state.";
fn annotated(mut tool: Tool) -> Tool {
let words = tool.name.replace('_', " ");
+66 -12
View File
@@ -93,15 +93,11 @@ async fn lists_expected_tools() {
"command_list",
"command_run",
"command_batch",
"ui_inspect",
"ui_screenshot",
"ui_pointer",
"ui_menu_invoke",
"ui_set",
"control_call",
] {
assert!(names.contains(&n.to_string()), "missing tool {n}: {names:?}");
}
assert!(!names.iter().any(|name| name.starts_with("ui_") || name == "control_call"));
assert!(client.call_tool(CallToolRequestParams::new("ui_screenshot")).await.is_err());
for t in &tools {
assert!(t.name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_'), "tool name `{}`", t.name);
assert!(t.description.as_ref().is_some_and(|d| !d.is_empty()));
@@ -165,6 +161,15 @@ async fn command_list_filters() {
let all = json_of(&call(&client, "command_list", json!({})).await);
let n_all = all.as_array().unwrap().len();
assert!(n_all > 20);
for id in ["file.openAs", "file.placeEmbedded", "file.export.quickExport", "file.automate.photomerge"] {
assert!(!all.as_array().unwrap().iter().any(|row| row["id"] == id), "{id}");
}
for filter in ["rotate", "rotation"] {
let rows = json_of(&call(&client, "command_list", json!({"filter": filter})).await);
for id in ["image.imageRotation.90cw", "edit.transform.rotate90Cw"] {
assert!(rows.as_array().unwrap().iter().any(|row| row["id"] == id), "{filter}: {id}");
}
}
let blur = json_of(&call(&client, "command_list", json!({"filter": "blur"})).await);
assert!(!blur.as_array().unwrap().is_empty() && blur.as_array().unwrap().len() < n_all);
assert!(blur.as_array().unwrap().iter().all(|c| c["params"].is_string()));
@@ -221,7 +226,7 @@ fn strict_schema_problems(path: &str, schema: &Value, out: &mut Vec<String>) {
async fn tool_schemas_pass_strict_validators() {
// #1782: `ui_pointer`'s `items: true` and `command_batch`'s `$ref`/`$defs` made strict
// providers (e.g. Moonshot via Volcano Ark) reject the whole request.
let client = connect(PhotocraftMcp::headless()).await;
let client = connect(PhotocraftMcp::bridge("127.0.0.1:1", CONTROL_TOKEN).unwrap()).await;
let tools = client.list_all_tools().await.unwrap();
let mut problems = Vec::new();
for t in &tools {
@@ -294,7 +299,7 @@ fn ui_set_fields() -> Vec<String> {
/// three fields missing when the issue was filed.
#[tokio::test(flavor = "multi_thread")]
async fn ui_set_description_names_every_accepted_field() {
let client = connect(PhotocraftMcp::headless()).await;
let client = connect(PhotocraftMcp::bridge("127.0.0.1:1", CONTROL_TOKEN).unwrap()).await;
let tools = client.list_all_tools().await.unwrap();
let tool = tools.iter().find(|t| t.name == "ui_set").expect("ui_set tool");
let schema = Value::Object((*tool.input_schema).clone());
@@ -319,9 +324,6 @@ async fn errors_are_tool_errors_not_crashes() {
assert_eq!(r.is_error, Some(true));
let r = call(&client, "doc_open", json!({"path": "/definitely/missing.png"})).await;
assert_eq!(r.is_error, Some(true));
let r = call(&client, "ui_inspect", json!({})).await;
assert_eq!(r.is_error, Some(true));
assert!(text(&r).contains("bridge"));
let r = call(&client, "doc_export", json!({})).await;
assert_eq!(r.is_error, Some(true));
// Quality 0 is refused, not clamped to 1 (serde already refuses 500, -1 and "85").
@@ -1368,6 +1370,58 @@ async fn command_batch_description_exposes_non_atomic_semantics_when_tools_are_l
client.cancel().await.unwrap();
}
#[tokio::test(flavor = "multi_thread")]
async fn invalid_edit_parameters_do_not_modify_the_document() {
let client = connect(PhotocraftMcp::headless()).await;
json_of(&call(&client, "doc_new", json!({"width": 8, "height": 8})).await);
let before = json_of(&call(&client, "doc_inspect", json!({})).await);
for (id, params, expected) in [
("image.adjustments.desaturate", json!({"amount": 50}), "unknown parameter"),
("image.adjustments.desaturate", json!([]), "object"),
("document.pixel", json!({"x": 0}), "y must be a number"),
("image.crop", json!({"deleteCroppedPixels": "false"}), "must be true or false"),
] {
let step = json!({"id": id, "params": params});
let reply = call(&client, "command_run", step.clone()).await;
assert_eq!(reply.is_error, Some(true), "{id}: {}", text(&reply));
assert!(text(&reply).contains(expected), "{id}: {}", text(&reply));
let batch = json_of(&call(&client, "command_batch", json!({"steps": [step]})).await);
assert_eq!(batch["failed"], 1, "{batch}");
assert!(batch["results"][0]["error"].as_str().unwrap().contains(expected), "{batch}");
}
let after = json_of(&call(&client, "doc_inspect", json!({})).await);
assert_eq!(after["history"], before["history"]);
assert_eq!(after["width"], 8);
assert_eq!(after["height"], 8);
client.cancel().await.unwrap();
}
/// The headless session's gate is no reason to refuse a crop frame past the canvas: the Crop tool
/// extends the canvas that way, and Reveal All always crops to a frame larger than the canvas.
#[tokio::test(flavor = "multi_thread")]
async fn gated_sessions_still_crop_past_the_canvas() {
let client = connect(PhotocraftMcp::headless()).await;
json_of(&call(&client, "doc_new", json!({"width": 8, "height": 8})).await);
let size = |doc: &Value| (doc["width"].as_u64().unwrap(), doc["height"].as_u64().unwrap());
let run = |id: &'static str, params: Value| {
let client = &client;
async move {
let reply = call(client, "command_run", json!({"id": id, "params": params})).await;
assert_ne!(reply.is_error, Some(true), "{id}: {}", text(&reply));
}
};
run("image.crop", json!({"x": -2, "y": 0, "width": 10, "height": 8})).await;
let extended = size(&json_of(&call(&client, "doc_inspect", json!({})).await));
assert!(extended.0 > 8, "an extending crop widens the canvas: {extended:?}");
run("image.crop", json!({"x": 2, "y": 0, "width": 4, "height": 8, "deleteCroppedPixels": false})).await;
let cropped = size(&json_of(&call(&client, "doc_inspect", json!({})).await));
assert!(cropped.0 < extended.0, "{cropped:?}");
run("image.revealAll", json!({})).await;
let revealed = size(&json_of(&call(&client, "doc_inspect", json!({})).await));
assert!(revealed.0 > cropped.0, "Reveal All brings the hidden pixels back: {revealed:?}");
client.cancel().await.unwrap();
}
#[tokio::test(flavor = "multi_thread")]
async fn command_batch_runs_steps_in_order() {
let client = connect(PhotocraftMcp::headless()).await;
@@ -1552,7 +1606,7 @@ async fn convention_tool_hints_match_what_each_tool_does() {
("ui_set", EDITS),
("control_call", EDITS),
];
let client = connect(PhotocraftMcp::headless()).await;
let client = connect(PhotocraftMcp::bridge("127.0.0.1:1", CONTROL_TOKEN).unwrap()).await;
let tools = client.list_all_tools().await.unwrap();
assert_eq!(tools.len(), expected.len(), "classify every tool here");
for tool in tools {
+1
View File
@@ -32,6 +32,7 @@ pub mod native_lab;
pub mod pattern;
pub mod proxy;
pub mod psblend;
pub mod scripted_pattern;
pub mod shape_split;
pub mod smart_mix;
mod uniform;
+230
View File
@@ -0,0 +1,230 @@
//! Scripted patterns: Edit › Fill › Pattern with Script on lays the chosen pattern out as separate tiles instead of a
//! plain repeat. Brick Fill is the first script; the others extend [`SCRIPTS`] and [`controls`] with their own layout.
//!
//! Every script shares the per-tile Color and Brightness randomness ([`Jitter`]): at 0 a tile keeps the pattern's
//! exact colours, above 0 each placed tile drifts by its own random amount. Areas no tile covers stay transparent.
use photocraft_geom::Rect;
use crate::pattern::{Placement, Tile};
/// The scripts in the Script list's order: (parameter value, name). The name is also the script dialog's title.
pub const SCRIPTS: [(&str, &str); 6] = [
("brickFill", "Brick Fill"),
("crossWeave", "Cross Weave"),
("placeAlongPath", "Place Along Path"),
("randomFill", "Random Fill"),
("spiral", "Spiral"),
("symmetryFill", "Symmetry Fill"),
];
/// The scripts that paint today; the rest are listed but answer "not supported yet".
pub const SUPPORTED: [&str; 1] = ["brickFill"];
/// The parameter value of a script name, matched without regard to case.
pub fn script_key(name: &str) -> Option<&'static str> {
SCRIPTS.iter().map(|(k, _)| *k).find(|k| k.eq_ignore_ascii_case(name))
}
/// One value of a script dialog: its parameter key, factory value and range.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Control {
pub key: &'static str,
pub default: f64,
pub min: f64,
pub max: f64,
/// The most digits shown after the decimal mark.
pub decimals: u32,
}
impl Control {
const fn new(key: &'static str, default: f64, min: f64, max: f64, decimals: u32) -> Control {
Control { key, default, min, max, decimals }
}
/// `v` inside the range; a non-finite value takes the factory value.
pub fn clamp(&self, v: f64) -> f64 {
if v.is_finite() { v.clamp(self.min, self.max) } else { self.default }
}
}
/// The Spacing range for a `width` x `height` pattern tile, in pixels: up to three tile widths apart, and overlapping
/// by up to the shorter side less 2 px (the measured -28 to 120 for a 40 x 30 tile). It does not change with the scale.
pub fn spacing_range(width: u32, height: u32) -> (f64, f64) {
let min = -f64::from(width.min(height).saturating_sub(2));
(min, 3.0 * f64::from(width))
}
/// The values of `script` in its dialog's order, for a `width` x `height` pattern; `None` for an unknown script or one
/// that does not paint yet.
pub fn controls(script: &str, width: u32, height: u32) -> Option<Vec<Control>> {
match script {
"brickFill" => {
let (lo, hi) = spacing_range(width, height);
Some(vec![
Control::new("patternScale", 1.0, 0.1, 1.25, 2),
Control::new("spacing", 0.0, lo, hi, 0),
Control::new("offsetBetweenRows", 50.0, -100.0, 100.0, 0),
Control::new("colorRandomness", 0.05, 0.0, 1.0, 2),
Control::new("brightnessRandomness", 0.1, 0.0, 1.0, 2),
Control::new("patternRotateAngle", 0.0, -180.0, 180.0, 0),
])
}
_ => None,
}
}
/// Per-tile colour and brightness drift, both 0..1, repeatable for one `seed`.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Jitter {
pub color: f32,
pub brightness: f32,
pub seed: u64,
}
/// How far each channel moves at randomness 1: a quarter of the range, so the default 0.05 / 0.1 shift a channel by a
/// few levels (one measured tile: blue 245 instead of 255).
const JITTER_REACH: f32 = 0.25;
impl Jitter {
/// The change added to each channel of tile `(row, col)`: its own colour offsets plus one shared brightness offset.
fn offsets(&self, row: i64, col: i64) -> [f32; 3] {
if self.color <= 0.0 && self.brightness <= 0.0 {
return [0.0; 3];
}
let mut state = self.seed ^ (row as u64).wrapping_mul(0x9E37_79B9_7F4A_7C15) ^ (col as u64).wrapping_mul(0xC2B2_AE3D_27D4_EB4F);
let mut next = || {
// splitmix64: a well-mixed value per call, in -1..1.
state = state.wrapping_add(0x9E37_79B9_7F4A_7C15);
let mut z = state;
z = (z ^ (z >> 30)).wrapping_mul(0xBF58_476D_1CE4_E5B9);
z = (z ^ (z >> 27)).wrapping_mul(0x94D0_49BB_1331_11EB);
z ^= z >> 31;
((z >> 40) as f32 / (1u64 << 24) as f32) * 2.0 - 1.0
};
let light = next() * self.brightness * JITTER_REACH;
let mut out = [0.0; 3];
for o in &mut out {
*o = next() * self.color * JITTER_REACH + light;
}
out
}
}
/// Brick Fill: rows of whole tiles from the canvas origin, every second row shifted by a share of the tile width.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct BrickFill {
/// Tile size as a fraction (0.1..1.25).
pub scale: f64,
/// Pixels between neighbouring tiles, across and down; negative overlaps them.
pub spacing: f64,
/// Shift of every second row to the left, in percent of the tile width (negative shifts right).
pub offset: f64,
/// Rotation of each tile about its centre, degrees counter-clockwise.
pub angle: f64,
pub jitter: Jitter,
}
/// Most tiles composited into one pixel, front to back: bounds the work of extreme overlaps. Only a pixel whose
/// frontmost tiles all let some of it through ever reaches it; an opaque tile ends the pixel at once.
const MAX_LAYERS: usize = 1024;
/// The x range where the convex polygon `corners` (in order) meets the line at height `y`, if it does.
fn span(corners: &[(f64, f64); 4], y: f64) -> Option<(f64, f64)> {
let mut range: Option<(f64, f64)> = None;
for i in 0..4 {
let (a, b) = (corners[i], corners[(i + 1) % 4]);
if (a.1 - y) * (b.1 - y) > 0.0 {
continue;
}
let x = if a.1 == b.1 { [a.0, b.0] } else { [a.0 + (b.0 - a.0) * (y - a.1) / (b.1 - a.1); 2] };
for x in x {
range = Some(range.map_or((x, x), |(lo, hi)| (lo.min(x), hi.max(x))));
}
}
range
}
impl BrickFill {
/// The tiles of a `width` x `height` pattern laid out over `rect` (row-major straight RGBA, transparent where no
/// tile lies). Later tiles (down, then right) lie over earlier ones where they overlap.
pub fn render(&self, tile: &Tile, width: u32, height: u32, rect: Rect) -> Vec<[f32; 4]> {
let len = rect.width() as usize * rect.height() as usize;
let mut out = vec![[0.0f32; 4]; len];
// At the f32 precision the placement maps with, so the tile bounds here are the ones it samples.
let scale = if self.scale.is_finite() && self.scale > 0.0 { f64::from(self.scale as f32) } else { 1.0 };
let (tw, th) = (f64::from(width) * scale, f64::from(height) * scale);
if len == 0 || tw <= 0.0 || th <= 0.0 {
return out;
}
let spacing = if self.spacing.is_finite() { self.spacing } else { 0.0 };
// At least a pixel between tile origins, so every layout ends.
let (pitch_x, pitch_y) = ((tw + spacing).max(1.0), (th + spacing).max(1.0));
let shift = if self.offset.is_finite() { self.offset / 100.0 * tw } else { 0.0 };
let angle = if self.angle.is_finite() { self.angle } else { 0.0 };
let (c, s) = (angle.to_radians().cos(), angle.to_radians().sin());
// The tile centres that put a pixel inside their tile form the turned tile rectangle around the pixel: its
// corners, relative to the pixel, and how far it reaches down.
let (a, b) = (tw / 2.0, th / 2.0);
let corners = [(a, b), (a, -b), (-a, -b), (-a, b)].map(|(hx, hy)| (hx * c + hy * s, -hx * s + hy * c));
let reach_y = s.abs() * a + c.abs() * b;
let placement = |row: i64, col: i64| {
let x0 = col as f64 * pitch_x - if row.rem_euclid(2) == 1 { shift } else { 0.0 };
let y0 = row as f64 * pitch_y;
let (cx, cy) = (x0 + tw / 2.0, y0 + th / 2.0);
// The corner the tile's (0, 0) lands on once it is turned about its centre (y down, counter-clockwise).
let (hx, hy) = (-tw / 2.0, -th / 2.0);
let origin = (cx + hx * c + hy * s, cy - hx * s + hy * c);
Placement::anchored(origin, true, (0.0, 0.0), scale as f32, angle as f32)
};
let mut i = 0;
for y in rect.y0..rect.y1 {
let py = f64::from(y) + 0.5;
// Rows whose tiles can reach this line, the last drawn (topmost) first.
let top_row = ((py + reach_y - th / 2.0) / pitch_y).floor() as i64;
let low_row = ((py - reach_y - th / 2.0) / pitch_y).ceil() as i64;
for x in rect.x0..rect.x1 {
let px = f64::from(x) + 0.5;
let mut acc = [0.0f32; 4];
let mut layers = 0;
'rows: for row in (low_row..=top_row).rev() {
// Only the tiles of this row whose centre lies in the turned rectangle around the pixel cover it.
let Some((lo, hi)) = span(&corners, row as f64 * pitch_y + th / 2.0 - py) else { continue };
let row_shift = if row.rem_euclid(2) == 1 { shift } else { 0.0 };
let right = ((px + hi + row_shift - tw / 2.0) / pitch_x).floor() as i64;
let left = ((px + lo + row_shift - tw / 2.0) / pitch_x).ceil() as i64;
for col in (left..=right).rev() {
if layers >= MAX_LAYERS || acc[3] >= 1.0 {
break 'rows;
}
let place = placement(row, col);
let (u, v) = place.map(px, py);
if !(0.0..f64::from(width)).contains(&u) || !(0.0..f64::from(height)).contains(&v) {
continue;
}
layers += 1;
let mut q = tile.sample_area(&place, px, py);
let d = self.jitter.offsets(row, col);
// Without a drift a tile keeps its exact colour, also a float one past 1.
for ch in 0..3 {
if d[ch] != 0.0 {
q[ch] = (q[ch] + d[ch]).clamp(0.0, 1.0);
}
}
// Front to back: what is already in front covers this tile.
let k = q[3] * (1.0 - acc[3]);
for ch in 0..3 {
acc[ch] += q[ch] * k;
}
acc[3] += k;
}
}
if acc[3] > 0.0 {
out[i] = [acc[0] / acc[3], acc[1] / acc[3], acc[2] / acc[3], acc[3].min(1.0)];
}
i += 1;
}
}
out
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ photocraft-geom = { workspace = true }
photocraft-color = { workspace = true }
craft-cms = { workspace = true }
# PCTIP codec from craft-libs#1564; kept at the same shared revision as the workspace.
craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
photocraft-raster = { workspace = true }
photocraft-doc = { workspace = true }
photocraft-ops = { workspace = true }
+5 -1
View File
@@ -812,7 +812,11 @@ fn unlock_background_for_crop(doc: &mut Document) {
}
fn crop_with(s: &mut Session, p: &Value, keep_background: bool) -> Result<Value> {
let delete = p.get("deleteCroppedPixels").and_then(Value::as_bool).unwrap_or(true);
let delete = match p.get("deleteCroppedPixels") {
None | Some(Value::Null) => true,
Some(Value::Bool(value)) => *value,
Some(value) => return Err(bad("image.crop", format!("`deleteCroppedPixels` must be true or false, not {value}"))),
};
// The Crop tool's Fill: Content-Aware Fill of what the crop uncovers (#3823).
let content_aware = match p.get("contentAware") {
None | Some(Value::Null) => false,
@@ -157,7 +157,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Group from Layers…",
&["Layer", "New"],
None,
r##"{"layer":id?,"name":text?,"color":"none|red|orange|yellow|green|seafoam|blue|indigo|magenta|fuchsia|violet|gray"="none","mode":str="passThrough" (blend mode),"opacity":0..100=100 (percent)} (no layer: every selected layer; the new group starts collapsed)"##,
r##"{"layer":id?,"name":text?,"color":"none|red|orange|yellow|green|seafoam|blue|indigo|magenta|fuchsia|violet|gray"="none","mode":str="passThrough" (blend mode),"opacity":0..100=100 (percent)} (no layer: every selected layer; the new group starts expanded with one target and collapsed with multiple targets)"##,
structure::can_group_from_layers,
structure::group_from_layers
),
@@ -192,3 +192,6 @@ mod group_from_layers_clipping_tests;
#[cfg(test)]
mod merge_layers_history_match_tests;
#[cfg(test)]
mod group_from_layers_one_layer_expanded_tests;
@@ -0,0 +1,104 @@
use super::*;
const GROUP_FROM_LAYERS: &str = "layer.new.groupFromLayers";
fn session() -> Session {
let mut s = crate::session();
s.execute("file.new", json!({"width": 32, "height": 32})).unwrap();
s
}
fn create(s: &mut Session, command: &str, name: &str) -> LayerId {
let reply = s.execute(command, json!({"name": name})).unwrap();
LayerId(reply["layer"].as_u64().unwrap())
}
fn inspect_layer(layers: &Value, id: LayerId) -> Option<&Value> {
layers.as_array()?.iter().find_map(|layer| if layer["id"] == id.0 { Some(layer) } else { inspect_layer(&layer["children"], id) })
}
fn assert_group(s: &mut Session, group: LayerId, expanded: bool, children: &[LayerId]) {
let state = s.execute("document.inspect", json!({})).unwrap();
let inspected = inspect_layer(&state["layers"], group).expect("new group is in the layer tree");
assert_eq!(inspected["expanded"], expanded);
let ids: Vec<_> = inspected["children"].as_array().unwrap().iter().rev().map(|layer| LayerId(layer["id"].as_u64().unwrap())).collect();
assert_eq!(ids, children);
}
#[test]
fn grouping_one_layer_or_group_starts_expanded_in_a_single_history_step() {
for command in ["layer.new.layer", "layer.new.group"] {
let mut s = session();
let child = create(&mut s, command, "Child");
let before = s.active().unwrap().history.past_len();
let group = create(&mut s, GROUP_FROM_LAYERS, "Wrapper");
assert_group(&mut s, group, true, &[child]);
assert_eq!(s.active().unwrap().history.past_len(), before + 1);
s.execute("edit.undo", json!({})).unwrap();
let doc = &s.active().unwrap().doc;
assert!(doc.layer(group).is_none());
assert!(doc.layers.iter().any(|layer| layer.id == child));
}
}
#[test]
fn grouping_one_nested_layer_starts_expanded_with_either_parent_lock_state() {
for locked in [false, true] {
let mut s = session();
let child = create(&mut s, "layer.new.layer", "Child");
let parent = create(&mut s, "layer.new.group", "Parent");
s.execute("layer.moveTo", json!({"layer": child.0, "target": parent.0, "position": "into"})).unwrap();
s.execute("layer.select", json!({"layer": parent.0})).unwrap();
s.execute("layer.lockLayers", json!({"all": locked})).unwrap();
s.execute("layer.select", json!({"layer": child.0})).unwrap();
let group = create(&mut s, GROUP_FROM_LAYERS, "Inner");
assert_group(&mut s, group, true, &[child]);
let doc = &s.active().unwrap().doc;
assert_eq!(doc.layers.index().parent(group), Some(parent));
assert_eq!(doc.layer(parent).unwrap().locks.all, locked);
s.execute("edit.undo", json!({})).unwrap();
assert_eq!(s.active().unwrap().doc.layers.index().parent(child), Some(parent));
}
}
#[test]
fn a_multi_selection_starts_collapsed_and_an_explicit_target_starts_expanded() {
let mut s = session();
let a = create(&mut s, "layer.new.layer", "A");
let b = create(&mut s, "layer.new.layer", "B");
s.execute("layer.select", json!({"layers": [a.0, b.0]})).unwrap();
let group = create(&mut s, GROUP_FROM_LAYERS, "Pair");
assert_group(&mut s, group, false, &[a, b]);
s.execute("edit.undo", json!({})).unwrap();
s.execute("layer.select", json!({"layers": [a.0, b.0]})).unwrap();
let reply = s.execute(GROUP_FROM_LAYERS, json!({"layer": a.0})).unwrap();
let explicit = LayerId(reply["layer"].as_u64().unwrap());
assert_group(&mut s, explicit, true, &[a]);
s.execute("layer.select", json!({"layers": [explicit.0, a.0]})).unwrap();
let wrapper = create(&mut s, GROUP_FROM_LAYERS, "Ancestor and Child");
assert_group(&mut s, wrapper, false, &[explicit]);
}
#[test]
fn ordinary_group_layers_still_starts_collapsed_for_one_layer() {
let mut s = session();
let child = create(&mut s, "layer.new.layer", "Child");
let group = create(&mut s, "layer.groupLayers", "Wrapper");
assert_group(&mut s, group, false, &[child]);
}
#[test]
fn one_selected_base_starts_expanded_with_its_clipped_layer() {
let mut s = session();
let base = create(&mut s, "layer.new.layer", "Base");
let clipped = create(&mut s, "layer.new.layer", "Clipped");
s.execute("layer.setProps", json!({"layer": clipped.0, "clipped": true})).unwrap();
s.execute("layer.select", json!({"layer": base.0})).unwrap();
let group = create(&mut s, GROUP_FROM_LAYERS, "Wrapper");
assert_group(&mut s, group, true, &[base, clipped]);
assert!(s.active().unwrap().doc.layer(clipped).unwrap().clipped);
}
@@ -122,9 +122,7 @@ pub(super) fn can_group_from_layers(s: &Session) -> std::result::Result<(), Stri
Ok(())
}
/// Group from Layers: [`group_layers`], refused with the Background among the layers it would
/// move, also when the `layer` param names it (#14709). Group Layers (⌘G) is not measured and
/// keeps grouping it.
/// Group from Layers opens a group made from one target and refuses to group the Background (#14709).
pub(super) fn group_from_layers(s: &mut Session, p: &Value) -> Result<Value> {
let ids = match crate::commands::explicit_layer(s, p)? {
Some(id) => vec![id],
@@ -134,17 +132,21 @@ pub(super) fn group_from_layers(s: &mut Session, p: &Value) -> Result<Value> {
if ids.iter().any(|id| doc.is_background(*id)) {
return Err(EngineError::Other("the Background layer can't go into a group".into()));
}
group_layers(s, p)
group_layers_with(s, p, &ids, ids.len() == 1)
}
/// Group Layers (⌘G) / Group from Layers: the explicit layer, or every selected layer, moves
/// into a new, collapsed group placed where the top-most of them was. Bottom-to-top order is
/// preserved. The New Group dialog's colour, mode and opacity are set in the same history step.
/// Group Layers (⌘G) moves the explicit layer or the selection into a new, collapsed group.
pub fn group_layers(s: &mut Session, p: &Value) -> Result<Value> {
let ids = match crate::commands::explicit_layer(s, p)? {
Some(id) => vec![id],
None => selected(s),
};
group_layers_with(s, p, &ids, false)
}
/// Creates the group at the topmost target, preserving layer order and applying the dialog's
/// options in the same history step.
fn group_layers_with(s: &mut Session, p: &Value, ids: &[LayerId], expanded: bool) -> Result<Value> {
if ids.is_empty() {
return Err(EngineError::Other("no layer selected".into()));
}
@@ -153,7 +155,7 @@ pub fn group_layers(s: &mut Session, p: &Value) -> Result<Value> {
// A base takes the layers clipped to it into the group, still clipped, whether they were
// selected or not; a clipped layer that goes in without its base is released, as in the
// reference application (#14713).
let mut ids = top_level(doc, &ids);
let mut ids = top_level(doc, ids);
let bases: Vec<LayerId> = ids.clone();
for id in bases {
ids.extend(crate::clip_group::clipped_to(doc, id));
@@ -170,10 +172,9 @@ pub fn group_layers(s: &mut Session, p: &Value) -> Result<Value> {
}
let top = *ids.last().ok_or(EngineError::NoLayer(LayerId(0)))?;
let name = opts.name.clone().unwrap_or_else(|| doc.next_layer_name("Group"));
// Photoshop creates the group collapsed, so the panel shows one row in place of the layers.
let mut group = Layer::group(name, vec![]);
if let LayerContent::Group(g) = &mut group.content {
g.expanded = false;
g.expanded = expanded;
}
let gid = doc.insert_above(Some(top), group);
let mut children = Vec::with_capacity(ids.len());
@@ -109,7 +109,10 @@ pub fn specs() -> Vec<CommandSpec> {
params: r##"{"x":i32,"y":i32}"##,
enabled: has_doc,
run: |s, p| {
let coord = |k: &str| i32::try_from(int(p, k).unwrap_or(0)).map_err(|_| bad("document.pixel", format!("{k} must fit in 32 bits")));
let coord = |key: &str| {
let value = int(p, key).ok_or_else(|| bad("document.pixel", format!("{key} must be a number")))?;
i32::try_from(value).map_err(|_| bad("document.pixel", format!("{key} must fit in 32 bits")))
};
let (x, y) = (coord("x")?, coord("y")?);
let d = s.active().ok_or(EngineError::NoDocument)?;
// At i32::MAX the 1x1 rect saturates to empty: a pixel that far out is transparent.
+7
View File
@@ -135,6 +135,13 @@ pub fn list_entry(s: &Session, c: &CommandSpec, reason: Option<String>) -> Value
/// say "RAW Develop" (#12403).
pub(crate) const SEARCH_KEYWORDS: &[(&str, &str)] = &[
("select.rect", "Rectangular Marquee, Elliptical Marquee (\"ellipse\":true), ellipse, oval, circle, Single Row/Column Marquee (\"line\")"),
("image.imageRotation.180", "Rotate Canvas, Image Rotation"),
("image.imageRotation.90cw", "Rotate Canvas, Image Rotation"),
("image.imageRotation.90ccw", "Rotate Canvas, Image Rotation"),
("edit.transform.rotate180", "Layer Rotation"),
("edit.transform.rotate90Cw", "Layer Rotation"),
("edit.transform.rotate90Ccw", "Layer Rotation"),
("image.rotation.arbitrary", "Rotate Canvas, Image Rotation"),
("filter.cameraRaw", "Camera Raw Filter"),
("edit.preferences.rawDefaults", "Camera Raw Defaults"),
];
+46 -3
View File
@@ -140,10 +140,16 @@ pub fn fill(s: &mut Session, p: &Value) -> Result<Value> {
// Edit › Fill (#14975).
let space = photocraft_compose::pattern::PatternSpace::of_pixels(&st.doc);
let tile = photocraft_compose::pattern::Tile::new_in(&pat, space).ok_or_else(|| bad("the pattern is empty or too large to paint"))?;
// Photoshop's Fill uses the canvas origin.
let place = photocraft_compose::pattern::Placement::new(Rect::EMPTY, false, (0.0, 0.0), scale, angle);
out["pattern"] = json!(pat.id);
Source::Pixels(area, photocraft_compose::pattern::render(&tile, &place, area))
// With a script the pattern is laid out tile by tile instead of repeated.
if let Some(script) = script(p)? {
out["script"] = json!(script);
Source::Pixels(area, scripted(p, script, &tile, &pat, area)?)
} else {
// Photoshop's Fill uses the canvas origin.
let place = photocraft_compose::pattern::Placement::new(Rect::EMPTY, false, (0.0, 0.0), scale, angle);
Source::Pixels(area, photocraft_compose::pattern::render(&tile, &place, area))
}
}
"history" => {
// A History panel row `state` or a `snapshot`, else the History Brush's source.
@@ -216,6 +222,43 @@ fn remember_color(s: &mut Session, p: &Value, source: &Source) {
}
}
/// The `script` param of a pattern fill: a [`SCRIPTS`](photocraft_compose::scripted_pattern::SCRIPTS) key, or none.
fn script(p: &Value) -> Result<Option<&'static str>> {
use photocraft_compose::scripted_pattern::{SCRIPTS, script_key};
match p.get("script") {
None | Some(Value::Null) => Ok(None),
Some(Value::String(name)) => {
let names = SCRIPTS.iter().map(|(k, _)| *k).collect::<Vec<_>>().join("|");
script_key(name).map(Some).ok_or_else(|| bad(format!("unknown script `{name}` ({names})")))
}
Some(v) => Err(bad(format!("`script` must be a script name, not {v}"))),
}
}
/// The scripted pattern `script` laid out over `area`, with its values from `p` (each clamped to its range, the factory
/// value when missing) and an optional whole-number `seed` for the per-tile randomness.
fn scripted(p: &Value, script: &str, tile: &photocraft_compose::pattern::Tile, pat: &photocraft_doc::pattern::Pattern, area: Rect) -> Result<Vec<[f32; 4]>> {
use photocraft_compose::scripted_pattern::{BrickFill, Jitter, controls};
let controls =
controls(script, pat.width, pat.height).ok_or_else(|| bad(format!("the `{script}` script is not supported yet; only brickFill paints today")))?;
let mut values = std::collections::HashMap::new();
for c in &controls {
let v = match p.get(c.key) {
None | Some(Value::Null) => c.default,
Some(v) => v.as_f64().filter(|v| v.is_finite()).ok_or_else(|| bad(format!("`{}` must be a number {}..{}, not {v}", c.key, c.min, c.max)))?,
};
values.insert(c.key, c.clamp(v));
}
let seed = match p.get("seed") {
None | Some(Value::Null) => 1,
Some(v) => v.as_u64().ok_or_else(|| bad(format!("`seed` must be a whole number, not {v}")))?,
};
let get = |k: &str| values.get(k).copied().unwrap_or_default();
let jitter = Jitter { color: get("colorRandomness") as f32, brightness: get("brightnessRandomness") as f32, seed };
let brick = BrickFill { scale: get("patternScale"), spacing: get("spacing"), offset: get("offsetBetweenRows"), angle: get("patternRotateAngle"), jitter };
Ok(brick.render(tile, pat.width, pat.height, area))
}
/// The reference application refuses Fill on the Quick Mask with a colour-only blend mode, Preserve Transparency or
/// History contents, and leaves the channel as it was (#17489).
fn check_quick_mask(contents: &str, mode: BlendMode, preserve: bool) -> Result<()> {
@@ -0,0 +1,227 @@
//! #17428: Edit › Fill › Pattern with Script on lays the pattern out tile by tile. `edit.fill` takes `script` and the
//! script's values; Brick Fill paints rows of whole tiles from the canvas origin with every second row shifted left by
//! the row offset (50 % of the tile width by default). An unknown script is an error, not a plain fill; the five
//! listed scripts without a layout yet answer "not supported".
use serde_json::{Value, json};
use crate::Session;
const RED: [u8; 3] = [255, 0, 0];
const BLUE: [u8; 3] = [0, 0, 255];
const GREEN: [u8; 3] = [0, 255, 0];
/// The probe tile: 40 x 30, left half red, right half blue, the bottom-right 20 x 15 quarter green, so a shift, a turn
/// and a mirror all show. Defined as "probe" from a `mode` / `depth` document.
fn define_probe(s: &mut Session, mode: &str, depth: u32) {
s.execute("file.new", json!({"width": 40, "height": 30, "mode": mode, "depth": depth, "background": "white"})).unwrap();
for (rect, color) in [([0, 0, 20, 30], "#ff0000"), ([20, 0, 20, 15], "#0000ff"), ([20, 15, 20, 15], "#00ff00")] {
s.execute("select.rect", json!({"x": rect[0], "y": rect[1], "width": rect[2], "height": rect[3]})).unwrap();
s.execute("edit.fill", json!({"contents": "color", "color": color})).unwrap();
}
s.execute("edit.definePattern", json!({"name": "probe", "rect": [0, 0, 40, 30]})).unwrap();
}
/// A 600 x 400 white document of `mode` / `depth` with an empty pixel layer on top (active), the probe defined.
fn session_in(mode: &str, depth: u32) -> Session {
let mut s = crate::session();
define_probe(&mut s, mode, depth);
s.execute("file.new", json!({"width": 600, "height": 400, "mode": mode, "depth": depth, "background": "white"})).unwrap();
s.execute("layer.new.layer", json!({})).unwrap();
s
}
fn session() -> Session {
session_in("rgb", 8)
}
/// Brick Fill with both randomness values at 0 and `extra` values on top.
fn brick(extra: Value) -> Value {
let mut p = json!({"contents": "pattern", "pattern": "probe", "script": "brickFill", "colorRandomness": 0, "brightnessRandomness": 0});
for (k, v) in extra.as_object().into_iter().flatten() {
p[k] = v.clone();
}
p
}
fn pixel(s: &Session, x: i32, y: i32) -> [f32; 4] {
let st = s.active().unwrap();
st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap().rgba(x, y)
}
fn rgb8(px: [f32; 4]) -> [u8; 3] {
[0, 1, 2].map(|c| (px[c] * 255.0).round() as u8)
}
/// The colour runs along row `y` from x 0 to 79 (two tile widths).
fn runs(s: &Session, y: i32) -> Vec<(i32, [u8; 3])> {
let mut out: Vec<(i32, [u8; 3])> = Vec::new();
for x in 0..80 {
let c = rgb8(pixel(s, x, y));
if out.last().is_none_or(|(_, last)| *last != c) {
out.push((x, c));
}
}
out
}
fn undo_label(s: &Session) -> Option<String> {
s.active().unwrap().history.undo_label().map(str::to_string)
}
#[test]
fn brick_fill_shifts_every_second_row_by_half_a_tile() {
let mut s = session();
let r = s.execute("edit.fill", brick(json!({}))).unwrap();
assert_eq!(r["script"], "brickFill");
// Row 0 starts with the tile's left edge at x 0; row 1 (y 30-59) starts 20 px further left.
assert_eq!(runs(&s, 3), vec![(0, RED), (20, BLUE), (40, RED), (60, BLUE)]);
assert_eq!(runs(&s, 33), vec![(0, BLUE), (20, RED), (40, BLUE), (60, RED)]);
// The bottom quarter shows the shift too, and row 2 lines up with row 0 again.
assert_eq!(rgb8(pixel(&s, 5, 50)), GREEN);
assert_eq!(runs(&s, 63), runs(&s, 3));
assert_eq!(undo_label(&s).as_deref(), Some("Fill"));
}
#[test]
fn brick_fill_differs_from_the_plain_pattern_fill() {
let mut plain = session();
plain.execute("edit.fill", json!({"contents": "pattern", "pattern": "probe"})).unwrap();
let mut scripted = session();
scripted.execute("edit.fill", brick(json!({}))).unwrap();
assert_eq!(runs(&plain, 3), runs(&scripted, 3), "row 0 is the plain repeat");
assert_ne!(runs(&plain, 33), runs(&scripted, 33), "row 1 is shifted only with the script");
}
#[test]
fn row_offset_spacing_and_scale_move_the_tiles() {
// No offset: every row lines up like the plain repeat.
let mut s = session();
s.execute("edit.fill", brick(json!({"offsetBetweenRows": 0}))).unwrap();
assert_eq!(runs(&s, 33), runs(&s, 3));
// Spacing leaves transparent gaps between tiles, across and down.
let mut s = session();
s.execute("edit.fill", brick(json!({"spacing": 10, "offsetBetweenRows": 0}))).unwrap();
assert_eq!(pixel(&s, 45, 3)[3], 0.0, "gap after the first tile");
assert!(pixel(&s, 55, 3)[3] > 0.99, "the second tile starts after the gap");
assert_eq!(pixel(&s, 5, 35)[3], 0.0, "gap under the first row");
// Half the scale halves the tile.
let mut s = session();
s.execute("edit.fill", brick(json!({"patternScale": 0.5, "offsetBetweenRows": 0}))).unwrap();
assert_eq!(rgb8(pixel(&s, 25, 3)), RED, "the second, half-size tile starts at x 20");
}
#[test]
fn a_turned_tile_is_no_longer_upright() {
let mut s = session();
s.execute("edit.fill", brick(json!({"patternRotateAngle": 180}))).unwrap();
// Turned half way, the tile's blue half comes first.
assert_eq!(rgb8(pixel(&s, 5, 20)), BLUE);
}
#[test]
fn randomness_varies_tiles_only_above_zero() {
let mut exact = session();
exact.execute("edit.fill", brick(json!({}))).unwrap();
let mut drift = session();
drift.execute("edit.fill", brick(json!({"colorRandomness": 0.5, "brightnessRandomness": 0.5}))).unwrap();
// At 0 every tile keeps the pattern's colours.
for x in (5..600).step_by(40) {
assert_eq!(rgb8(pixel(&exact, x, 3)), RED, "x {x}");
}
// Above 0 the tiles drift, each its own way, while one tile stays one colour.
let tiles: Vec<[u8; 3]> = (5..600).step_by(40).map(|x| rgb8(pixel(&drift, x, 3))).collect();
assert!(tiles.iter().any(|c| *c != RED), "{tiles:?}");
assert!(tiles.windows(2).any(|w| w[0] != w[1]), "tiles differ from each other: {tiles:?}");
assert_eq!(rgb8(pixel(&drift, 5, 3)), rgb8(pixel(&drift, 15, 10)), "one tile drifts as a whole");
// The factory values drift a little.
let mut default = session();
let mut p = brick(json!({}));
p.as_object_mut().unwrap().retain(|k, _| !k.ends_with("Randomness"));
default.execute("edit.fill", p).unwrap();
let tiles: Vec<[u8; 3]> = (5..600).step_by(40).map(|x| rgb8(pixel(&default, x, 3))).collect();
assert!(tiles.iter().any(|c| *c != RED), "{tiles:?}");
}
#[test]
fn the_fill_stays_in_the_selection_with_mode_and_opacity() {
let mut s = session();
s.execute("select.rect", json!({"x": 0, "y": 0, "width": 100, "height": 50})).unwrap();
s.execute("edit.fill", brick(json!({"opacity": 50}))).unwrap();
let inside = pixel(&s, 5, 3);
assert!((inside[3] - 0.5).abs() < 0.01, "half opacity: {inside:?}");
assert_eq!(pixel(&s, 150, 3)[3], 0.0, "outside the selection");
assert_eq!(pixel(&s, 5, 80)[3], 0.0, "below the selection");
assert_eq!(undo_label(&s).as_deref(), Some("Fill"));
s.execute("edit.undo", json!({})).unwrap();
assert_eq!(pixel(&s, 5, 3)[3], 0.0, "one history state");
}
#[test]
fn an_unknown_script_is_an_error_and_the_unbuilt_ones_are_unsupported() {
let mut s = session();
let before = undo_label(&s);
let err = s.execute("edit.fill", brick(json!({"script": "noSuchScript"}))).unwrap_err().to_string();
assert!(err.contains("unknown script"), "{err}");
for script in ["crossWeave", "placeAlongPath", "randomFill", "spiral", "symmetryFill"] {
let err = s.execute("edit.fill", brick(json!({"script": script}))).unwrap_err().to_string();
assert!(err.contains("not supported"), "{script}: {err}");
}
assert_eq!(undo_label(&s), before, "nothing was filled");
assert_eq!(pixel(&s, 5, 3)[3], 0.0);
}
#[test]
fn bad_values_are_errors_and_out_of_range_ones_are_clamped() {
let mut s = session();
for bad in [json!({"script": 3}), json!({"patternScale": "big"}), json!({"spacing": [1]}), json!({"seed": -1}), json!({"offsetBetweenRows": true})] {
assert!(s.execute("edit.fill", brick(bad.clone())).is_err(), "{bad}");
}
// A huge scale paints at the 1.25 limit; a huge negative spacing at the overlap limit, without hanging.
let mut huge = session();
huge.execute("edit.fill", brick(json!({"patternScale": 1e9, "offsetBetweenRows": 0}))).unwrap();
let mut limit = session();
limit.execute("edit.fill", brick(json!({"patternScale": 1.25, "offsetBetweenRows": 0}))).unwrap();
assert_eq!(runs(&huge, 3), runs(&limit, 3));
let mut s = session();
s.execute("edit.fill", brick(json!({"spacing": -1e12, "patternRotateAngle": 45}))).unwrap();
}
#[test]
fn brick_fill_runs_in_every_mode_and_depth() {
for (mode, depth) in [("rgb", 8), ("rgb", 16), ("rgb", 32), ("cmyk", 8), ("lab", 8), ("gray", 8), ("gray", 16)] {
let mut s = session_in(mode, depth);
s.execute("edit.fill", brick(json!({}))).unwrap_or_else(|e| panic!("{mode}/{depth}: {e}"));
// Row 1's first pixel shows the tile's right half, row 0's its left half.
let (row0, row1) = (pixel(&s, 5, 3), pixel(&s, 5, 33));
assert!(row0[3] > 0.99 && row1[3] > 0.99, "{mode}/{depth}: painted");
assert_ne!(rgb8(row0), rgb8(row1), "{mode}/{depth}: row 1 is shifted");
assert_eq!(undo_label(&s).as_deref(), Some("Fill"), "{mode}/{depth}");
}
}
#[test]
fn a_long_turned_tile_still_covers_pixels_far_from_its_centre() {
// A 4000 x 4 tile overlapping its neighbours by the most (2 px between rows) and turned 45°: about 2000 rows of
// tiles lie near each pixel, and the one that covers (1000, 200) has its centre 1000 px above it.
let mut s = crate::session();
s.execute("file.new", json!({"width": 4000, "height": 4, "background": "white"})).unwrap();
s.execute("edit.fill", json!({"contents": "color", "color": "#ff0000"})).unwrap();
s.execute("edit.definePattern", json!({"name": "bar", "rect": [0, 0, 4000, 4]})).unwrap();
s.execute("file.new", json!({"width": 1200, "height": 400, "background": "white"})).unwrap();
s.execute("layer.new.layer", json!({})).unwrap();
s.execute("select.rect", json!({"x": 995, "y": 195, "width": 10, "height": 10})).unwrap();
let p = json!({"pattern": "bar", "spacing": -2, "offsetBetweenRows": 0, "patternRotateAngle": 45});
s.execute("edit.fill", brick(p)).unwrap();
let px = pixel(&s, 1000, 200);
assert!(px[3] > 0.99 && rgb8(px) == RED, "{px:?}");
}
#[test]
fn a_pixel_on_the_edge_of_a_scaled_tile_is_painted() {
// At scale 1.01249999 the tile is 40.5 px wide (at the placement's f32 precision a hair wider), so the centre of
// pixel 40 lies inside the first tile and must be painted, not left in the 1 px gap.
let mut s = session();
s.execute("edit.fill", brick(json!({"patternScale": 1.012_499_99, "spacing": 1, "offsetBetweenRows": 0}))).unwrap();
assert!(pixel(&s, 40, 5)[3] > 0.0, "{:?}", pixel(&s, 40, 5));
}
+2
View File
@@ -46,6 +46,8 @@ mod eraser_gray_background_tests;
#[cfg(test)]
mod fill_quick_mask_refusals_tests;
#[cfg(test)]
mod fill_script_brick_tests;
#[cfg(test)]
mod mixer_indexed_bitmap_tests;
#[cfg(test)]
mod mixer_toggle_commands_tests;
+1 -1
View File
@@ -7,7 +7,7 @@ license.workspace = true
rust-version.workspace = true
[dependencies]
craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "6ffc396957f7b12ec8fae8bf9084f077384ad2b4" }
craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "4ed3d95b0f244b2b10d5f167183658f38f73594d" }
[lints]
workspace = true
+2
View File
@@ -91,5 +91,7 @@ impl PhotocraftApp {
ctx.options_mut(|o| o.zoom_with_keyboard = false);
// A pointer move that changes nothing under the pointer runs no frame (#17148).
craft::ui::runtime::pointer::gate_pointer_moves(ctx);
// Moving a window changes nothing it shows, so a move runs no frame (#18000).
ctx.set_window_move_needs_pass(false);
}
}
+12 -9
View File
@@ -136,10 +136,10 @@ pub(crate) fn ants_shown(app: &PhotocraftApp, idx: usize) -> Option<(i32, i32)>
Some(if active { super::tools::selection::shown_offset(app).unwrap_or((0, 0)) } else { (0, 0) })
}
/// Whether PhotoCraft's tool moves the view with the pointer this pass: the Crop tool in its default mode slides the
/// view under a fixed frame. The canvas then shows the view unaligned.
pub(crate) fn view_follows_pointer(app: &PhotocraftApp) -> bool {
crate::crop_ui::moves_view(app)
/// Whether PhotoCraft's tool moves the view of document `idx` with the pointer this pass: the Crop tool in its default
/// mode slides the active document's view under a fixed frame. The canvas then shows the view unaligned.
pub(crate) fn view_follows_pointer(app: &PhotocraftApp, idx: usize) -> bool {
crate::crop_ui::moves_view(app) && app.session.active_index() == Some(idx)
}
/// The user's navigation choices from Preferences (General, Tools, Enhanced Controls).
@@ -285,7 +285,7 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, view: &mut View,
}
let label = super::tabs::tab_title_at(app, idx, view.zoom * 100.0);
let navigation = navigation(app);
let follows_pointer = view_follows_pointer(app);
let follows_pointer = view_follows_pointer(app, idx);
let checker = checkerboard(app);
let snap = super::snap_ui::snap(app, idx);
let target = view_target(app, idx);
@@ -412,9 +412,11 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, view: &mut View,
.flatten();
let overlay = OverlayPrep::new(app, ctx, idx, output, live.as_ref());
// The canvas edge isn't outlined while the pixels past it show (Photoshop's crop preview), nor while the Crop
// tool hides everything outside its box (Show Cropped Area off).
let edge = border == PageBorder::Line && !crate::crop_ui::shows_beyond_canvas(app) && !crate::crop_ui::hides_canvas_edge(app);
let region = crate::crop_ui::shows_beyond_canvas(app).then(|| crate::crop_ui::frame(app)).flatten().map(|frame| {
// tool hides everything outside its box (Show Cropped Area off). Both belong to the active document's frame.
let cropped = app.session.active_index() == Some(idx);
let beyond = cropped && crate::crop_ui::shows_beyond_canvas(app);
let edge = border == PageBorder::Line && !beyond && !(cropped && crate::crop_ui::hides_canvas_edge(app));
let region = beyond.then(|| crate::crop_ui::frame(app)).flatten().map(|frame| {
let r = frame.turned_bounds();
PixelRect::new(r.x0.floor() as i32, r.y0.floor() as i32, r.x1.ceil() as i32, r.y1.ceil() as i32)
});
@@ -564,7 +566,8 @@ fn canvas_controls(
crate::symmetry_ui::canvas_controls(ui, app, rect);
crate::perspective_crop_ui::body(app, ui, rect);
crate::analysis::canvas::body(app, ui, rect);
if primary {
// The frame is the active document's: another document on screen shows none (#18368).
if primary && app.session.active_index() == Some(host.idx) {
reported.crop = super::tools::crop::show_frame(app, ui, rect);
}
// The scroll bars (Standard Screen Mode only) and the rotation compass change the view they are bound to. They are
+1 -1
View File
@@ -373,7 +373,7 @@ impl CanvasTool for PaintTool<'_> {
scope.with_app(|app| {
crate::brush_cursor::sync_tip(app);
// The readout request lasts one pass: a pass without pointer input repeats it.
app.brush_resize.hud(cx);
app.brush_resize.hud(app, cx);
let Some(stroke) = state.stroke.as_ref() else { return };
let stale_mixer =
stroke.tool == Tool::MixerBrush && app.live_stroke.is_some() && app.session.active_index().is_none_or(|idx| live_stroke(app, idx).is_none());
@@ -24,7 +24,7 @@ fn crop_image_movement_keeps_its_continuous_camera_mapping() {
for ppp in [1.0, 1.5] {
for classic in [false, true] {
app.ui.tool_options.crop.shield.classic_mode = classic;
assert_eq!(super::document_display::view_follows_pointer(&app), !classic, "only Default Crop moves the view with the pointer");
assert_eq!(super::document_display::view_follows_pointer(&app, 0), !classic, "only Default Crop moves the view with the pointer");
ctx.set_pixels_per_point(ppp);
let screen = Rect::from_min_size(Pos2::ZERO, vec2(700.0, 600.0));
let rect = Rect::from_min_size(pos2(40.0, 100.0), vec2(523.0, 471.0));
+58
View File
@@ -1191,3 +1191,61 @@ mod gpu_tests {
assert_eq!(texture_key(canvas_display(&app, &doc, Some(1)).0.as_deref(), &doc), texture_key(canvas_display(&app, &doc, Some(4)).0.as_deref(), &doc));
}
}
/// #18368: the Crop frame belongs to the active document. Another document on screen beside it (a floating window, a
/// tiled pane) shows none, so a drag on it where the active frame's corner would land leaves the frame alone; the same
/// drag on the active document's canvas resizes the frame.
#[test]
fn a_drag_on_another_documents_canvas_leaves_the_crop_frame_alone() {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({"width": 400, "height": 300, "name": "other"})).unwrap();
app.run("file.new", json!({"width": 400, "height": 300, "name": "cropped"})).unwrap();
app.sync_views();
app.ui.tool = Tool::Crop;
assert_eq!(app.session.active_index(), Some(1));
for view in &mut app.ui.views {
view.zoom = 1.0;
view.center = [200.0, 150.0];
view.clear_pending();
}
// Both documents show at 100 %, side by side: the same document point lies at the same place in each canvas.
let other = Rect::from_min_size(pos2(20.0, 20.0), vec2(440.0, 340.0));
let cropped = other.translate(vec2(480.0, 0.0));
let mut h = egui_kittest::Harness::builder().with_size(vec2(960.0, 400.0)).with_context(app.ctx().clone()).build_ui_state(
move |ui, app: &mut Box<PhotocraftApp>| {
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| {
for (idx, rect) in [(1, cropped), (0, other)] {
let view = app.ui.views[idx].clone();
canvas_view(app, ui, CanvasHost::main(idx), rect, view, idx == 1);
}
});
},
app,
);
h.run_steps(4);
let frame = h.state().canvas_tools.crop.tool.frame().expect("the active document shows the Crop frame");
// The frame's bottom-right corner on the active document's canvas, and where it would land on the other one.
let corner = |canvas: Rect| canvas.center() + vec2(frame.rect.x1 as f32 - 200.0, frame.rect.y1 as f32 - 150.0);
fn drag(h: &mut egui_kittest::Harness<'_, Box<PhotocraftApp>>, from: Pos2) {
let to = from - vec2(120.0, 90.0);
h.hover_at(from);
h.run_steps(2);
h.drag_at(from);
h.run_steps(1);
for step in [0.25_f32, 0.5, 1.0] {
h.hover_at(from + (to - from) * step);
h.run_steps(1);
}
h.event(egui::Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE });
h.run_steps(2);
}
drag(&mut h, corner(other));
let tool = &h.state().canvas_tools.crop.tool;
assert_eq!(tool.frame(), Some(frame), "a drag on another document's canvas leaves the active document's frame alone");
assert!(!tool.modified(), "a drag on another document's canvas starts no crop edit");
drag(&mut h, corner(cropped));
let after = h.state().canvas_tools.crop.tool.frame().expect("the frame stays");
assert!(after.rect.width() < frame.rect.width(), "the same drag on the active document's canvas resizes its frame: {after:?}");
}
+5 -3
View File
@@ -514,10 +514,12 @@ fn with_rig<R>(
) -> R {
let tool = app.ui.tool;
let fam = family(tool);
// Tools that own state the app lends nobody are built before the scope takes the app.
let crop_run = (fam == Family::Crop).then(|| crate::crop_ui::CropRun::of(app)).flatten();
let mut crop_tool = crop_run.as_ref().map(|_| std::mem::take(&mut tools.crop.tool));
let in_gesture = ToolHost::in_gesture(ctx, host.canvas_id());
// Tools that own state the app lends nobody are built before the scope takes the app. The Crop tool edits the active
// document's frame, so only that document's canvas runs it (#18368); a gesture keeps it to its cancel.
let crops_here = app.session.active_index() == Some(host.idx) || in_gesture;
let crop_run = (fam == Family::Crop && crops_here).then(|| crate::crop_ui::CropRun::of(app)).flatten();
let mut crop_tool = crop_run.as_ref().map(|_| std::mem::take(&mut tools.crop.tool));
if in_gesture && tools.gesture_pick == GesturePick::Dialog {
dialog::end_if_disarmed(app, &mut tools.dialog, host);
}
+5 -2
View File
@@ -40,8 +40,8 @@ pub(crate) mod params {
use super::{
PhotocraftApp, alerts, brush_preset_dialog, canvas_input, channel_options_ui, color_picker_ui, color_table_ui, contact_sheet_ui, count_group_name_ui,
duplicate_layer_ui, equalize_ui, file_forms, fill_ui, filter_dialog, history_options_ui, image_processor_ui, merge_channels_ui, new_group_ui,
new_layer_ui, paragraph_text_size, smart_filter_dialog, snapshot_dialog, stack_dialog, stroke_ui,
duplicate_layer_ui, equalize_ui, file_forms, fill_script_ui, fill_ui, filter_dialog, history_options_ui, image_processor_ui, merge_channels_ui,
new_group_ui, new_layer_ui, paragraph_text_size, smart_filter_dialog, snapshot_dialog, stack_dialog, stroke_ui,
};
use crate::canvas::document_display::CanvasHost;
@@ -95,6 +95,7 @@ pub(crate) mod params {
/// Every family of parameter dialogs, first match wins; the generic filter family owns what is left.
pub(crate) const PARAM_FAMILIES: &[ParamFamily] = &[
ParamFamily { check: Some(fill_ui::check), ..ParamFamily::new(fill_ui::owns, fill_ui::run) },
ParamFamily { check: Some(fill_ui::check), footer: Some(fill_script_ui::footer), ..ParamFamily::new(fill_script_ui::owns, fill_script_ui::run) },
ParamFamily { check: Some(stroke_ui::check), ..ParamFamily::new(stroke_ui::owns, stroke_ui::run) },
ParamFamily {
check: Some(smart_filter_dialog::check),
@@ -511,6 +512,7 @@ pub(crate) const TAKERS: &[fn(&mut PhotocraftApp, &egui::Context)] = &[
file_ui::take,
format_prompts::take,
pattern_fill_ui::take,
fill_script_ui::take,
crate::workspace_ui::take,
crate::kys_import::take,
crate::prefs_ui::take_presets,
@@ -835,6 +837,7 @@ pub mod export_dialog;
pub(crate) mod fade_modes;
pub mod file_forms;
pub mod file_ui;
pub mod fill_script_ui;
pub mod fill_ui;
pub mod filter_dialog;
pub(super) mod filter_preview_ui;
@@ -0,0 +1,275 @@
//! The script dialog of Edit › Fill › Pattern with Script on (#17428): OK in Fill opens the chosen script's own dialog,
//! titled with the script's name. Every script shares one layout: a live preview of the current values with the chosen
//! pattern, a Preset row (Default, Load / Save / Delete greyed, Custom), a field and slider per value, and OK, Reset and
//! Cancel. Reset restores the values the dialog opened with; Preset › Default sets the factory values, and changing a
//! value turns Preset back to Custom. The values are remembered per script after OK. Cancel fills nothing.
use craft::ui::contract::Bind;
use craft::ui::dialog::{DialogId, StackDialog};
use craft::ui::patterns::form_dialogs::{DialogFields, FieldValue, HostedParamDialog, Param, ParamDialog, ParamKind, ParamResult, PreviewState};
use craft::ui::runtime::env::Label;
use craft::ui::runtime::memory::{MemoryStage, SaveKey};
use craft::ui::sections::{DialogRole, FooterButton};
use craft::ui::value_drag::SliderScale;
use photocraft_compose::scripted_pattern::{BrickFill, Control, Jitter, SCRIPTS, controls};
use serde_json::{Map, Value, json};
use crate::PhotocraftApp;
use crate::dialogs::params::{captured, memory_scope, open_param};
/// The dialog key of a script is this prefix and the script's parameter value (`edit.fill.script.brickFill`).
const PREFIX: &str = "edit.fill.script.";
/// The side of the preview's sample area, in pattern pixels.
const PREVIEW: u32 = 256;
/// The Preset entries: (value, label). Load, Save and Delete are listed greyed until presets can be filed.
const PRESETS: [(&str, &str); 5] =
[("default", "Default"), ("load", "Load Preset..."), ("save", "Save Preset..."), ("delete", "Delete Preset..."), ("custom", "Custom")];
/// The dialog key of `script`.
pub(crate) fn key(script: &str) -> String {
format!("{PREFIX}{script}")
}
/// Whether the dialog `key` is a script dialog.
pub(crate) fn owns(key: &str) -> bool {
key.starts_with(PREFIX)
}
fn script_of(key: &str) -> &str {
key.strip_prefix(PREFIX).unwrap_or_default()
}
/// The label of a script value.
fn label(key: &str) -> Label {
Label::from(match key {
"patternScale" => tl!("Pattern Scale"),
"spacing" => tl!("Spacing"),
"offsetBetweenRows" => tl!("Offset between rows"),
"colorRandomness" => tl!("Color randomness"),
"brightnessRandomness" => tl!("Brightness randomness"),
"patternRotateAngle" => tl!("Pattern rotate angle"),
_ => tl!("Value"),
})
}
/// The unit shown after a value's field, if any.
fn unit(key: &str) -> Option<Label> {
match key {
"spacing" => Some(Label::from(tl!("px"))),
"offsetBetweenRows" => Some(Label::from(tl!("%"))),
"patternRotateAngle" => Some(Label::from(tl!("°"))),
_ => None,
}
}
/// The title of a script's dialog: its name.
fn title(script: &str) -> Label {
Label::from(match script {
"brickFill" => tl!("Brick Fill"),
"crossWeave" => tl!("Cross Weave"),
"placeAlongPath" => tl!("Place Along Path"),
"randomFill" => tl!("Random Fill"),
"spiral" => tl!("Spiral"),
"symmetryFill" => tl!("Symmetry Fill"),
_ => tl!("Fill"),
})
}
/// The Script list of the Fill dialog: (value, label), in the reference order.
pub(crate) fn script_options() -> Vec<(String, Label)> {
SCRIPTS.iter().map(|(k, _)| (k.to_string(), title(k))).collect()
}
fn rows(controls: &[Control]) -> Vec<Param> {
let presets = PRESETS.iter().map(|(k, l)| (k.to_string(), Label::from(tl!(l)))).collect();
let mut rows = vec![
Param::new("preset", tl!("Preset:"), ParamKind::choice(presets, Some("default".into())))
.disabled_options(["load", "save", "delete"])
.separated_at(1)
.separated_at(4),
];
for c in controls {
let mut row = Param::new(c.key, label(c.key), ParamKind::range(c.min, c.max, c.default, SliderScale::Linear)).decimals(c.decimals);
if let Some(unit) = unit(c.key) {
row = row.unit_label(unit);
}
rows.push(row);
}
rows
}
/// The factory values of `controls`, with Preset › Default.
fn factory(controls: &[Control]) -> DialogFields {
let mut f = DialogFields::new();
f.set("preset", "default");
for c in controls {
f.set(c.key, c.default);
}
f
}
/// Whether the values of `f` are the factory values.
fn is_factory(f: &DialogFields, controls: &[Control]) -> bool {
controls.iter().all(|c| f.number(c.key).is_some_and(|v| (v - c.default).abs() < 1e-9))
}
/// The values a script dialog opens with: the ones confirmed last time (each kept in its range), else the factory values.
fn opening(ctx: &egui::Context, key: &str, controls: &[Control]) -> DialogFields {
let saved: Option<DialogFields> = MemoryStage::peek_saved(ctx, &SaveKey::named(memory_scope(key)));
let mut f = factory(controls);
if let Some(saved) = saved {
if let Some(preset) = saved.text("preset").filter(|p| *p == "default" || *p == "custom") {
f.set("preset", preset);
}
for c in controls {
if let Some(v) = saved.number(c.key) {
f.set(c.key, c.clamp(v));
}
}
}
f
}
/// Opens the dialog of `script` for the Fill whose `edit.fill` params are `fill`, on the document and layer `held`
/// names. A script without a dialog yet runs the fill as it is, so the engine reports it as not supported.
pub(crate) fn open(app: &mut PhotocraftApp, script: &str, fill: Value, held: &Value) -> Option<DialogId> {
let pattern = fill.get("pattern").and_then(Value::as_str).and_then(|id| photocraft_engine::pattern_cmds::resolve(&app.session, id));
let (w, h) = pattern.as_ref().map_or((1, 1), |p| (p.width, p.height));
let controls = controls(script, w, h)?;
let key = key(script);
let fields = opening(app.ctx(), &key, &controls);
let mut opened = Map::new();
for (k, v) in fields.iter() {
opened.insert(k.to_string(), json!(v));
}
let mut captured = held.clone();
captured["fill"] = fill;
captured["opening"] = Value::Object(opened);
captured["lastPreset"] = json!(fields.text("preset").unwrap_or("custom"));
let rows = rows(&controls);
let title = title(script);
Some(open_param(app, &key.clone(), fields, captured, move |fields| {
ParamDialog::new(key.clone(), title.clone(), rows.clone())
.values(Bind::bound(fields))
.previews(true)
.alt_resets(false)
.extra_buttons(vec![("reset".to_owned(), FooterButton::new(tl!("Reset").to_string(), DialogRole::Other))])
}))
}
/// The `edit.fill` params of a confirmed script dialog: the Fill's own, the script and its values.
pub fn params(script: &str, f: &DialogFields, fill: &Value) -> Value {
let mut p = fill.as_object().cloned().unwrap_or_default();
p.insert("contents".into(), json!("pattern"));
p.insert("script".into(), json!(script));
for c in controls(script, 1, 1).unwrap_or_default() {
if let Some(v) = f.number(c.key) {
p.insert(c.key.into(), json!(v));
}
}
Value::Object(p)
}
/// OK: fill with the script's values, remembered for the next time once the fill succeeded.
pub(crate) fn run(app: &mut PhotocraftApp, ctx: &egui::Context, result: ParamResult) {
let held = captured(app, &result.key);
let p = params(script_of(&result.key), &result.fields, held.get("fill").unwrap_or(&Value::Null));
match app.run(super::fill_ui::COMMAND, p) {
Ok(_) => result.remember(ctx),
Err(e) => crate::notices::error(app, e),
}
}
/// Reset puts back the values the dialog opened with.
pub(crate) fn footer(app: &mut PhotocraftApp, _ctx: &egui::Context, id: DialogId, action: &str) {
if action != "reset" {
return;
}
let Some(key) = app.framework.dialogs.get_by_id::<HostedParamDialog>(id).and_then(|d| d.key().map(str::to_owned)) else { return };
let opening = captured(app, &key).get("opening").cloned().unwrap_or(Value::Null);
let Some(dialog) = app.framework.dialogs.get_mut_by_id::<HostedParamDialog>(id) else { return };
for (k, v) in opening.as_object().into_iter().flatten() {
match v {
Value::String(s) => dialog.set_field(k.clone(), FieldValue::Text(s.clone())),
v => {
if let Some(n) = v.as_f64() {
dialog.set_field(k.clone(), FieldValue::Number(n));
}
}
}
}
if let Some(preset) = opening.get("preset").and_then(Value::as_str)
&& let Some(held) = app.framework.captured.get_mut(&key)
{
held["lastPreset"] = json!(preset);
}
}
/// Each pass: Preset › Default sets the factory values and a changed value turns Preset to Custom; the preview follows
/// the values.
pub(crate) fn take(app: &mut PhotocraftApp, ctx: &egui::Context) {
let ids: Vec<DialogId> = app.framework.dialogs.stack().ids().collect();
for id in ids {
let Some(dialog) = app.framework.dialogs.get_by_id::<HostedParamDialog>(id) else { continue };
let Some(key) = dialog.key().filter(|k| owns(k)).map(str::to_owned) else { continue };
let fields = dialog.fields().clone();
let held = captured(app, &key);
let pattern = held["fill"].get("pattern").and_then(Value::as_str).and_then(|p| photocraft_engine::pattern_cmds::resolve(&app.session, p));
let (w, h) = pattern.as_ref().map_or((1, 1), |p| (p.width, p.height));
let Some(controls) = controls(script_of(&key), w, h) else { continue };
let preset = fields.text("preset").unwrap_or("custom").to_owned();
let last = held.get("lastPreset").and_then(Value::as_str).unwrap_or("custom").to_owned();
let Some(dialog) = app.framework.dialogs.get_mut_by_id::<HostedParamDialog>(id) else { continue };
let mut shown = fields.clone();
if preset == "default" && last != "default" {
for (k, v) in factory(&controls).iter() {
dialog.set_field(k.to_string(), v.clone());
shown.set(k.to_string(), v.clone());
}
} else if preset == "default" && !is_factory(&fields, &controls) {
dialog.set_field("preset", FieldValue::Text("custom".into()));
shown.set("preset", "custom");
}
let now = shown.text("preset").unwrap_or("custom").to_owned();
if let Some(held) = app.framework.captured.get_mut(&key) {
held["lastPreset"] = json!(now);
}
let picture = pattern.and_then(|p| preview(ctx, id, &p, &shown, &controls));
if let Some(dialog) = app.framework.dialogs.get_mut_by_id::<HostedParamDialog>(id) {
dialog.set_preview(Some(match picture {
Some(texture) => PreviewState::Ready(egui::load::SizedTexture::from_handle(&texture)),
None => PreviewState::Failed(Label::from(tl!("No pattern to preview"))),
}));
}
}
}
/// The preview of the values `f`: the script laid out over a sample area with pattern `p`, on white. The texture is
/// kept per dialog and drawn again only when the values or the pattern change.
fn preview(ctx: &egui::Context, id: DialogId, p: &photocraft_doc::Pattern, f: &DialogFields, controls: &[Control]) -> Option<egui::TextureHandle> {
let values: Vec<f64> = controls.iter().map(|c| c.clamp(f.number(c.key).unwrap_or(c.default))).collect();
let stamp = format!("{}:{values:?}", p.id);
let cache = egui::Id::unique(("fill-script-preview", id.value()));
if let Some((seen, texture)) = ctx.data(|d| d.get_temp::<(String, egui::TextureHandle)>(cache))
&& seen == stamp
{
return Some(texture);
}
let tile = photocraft_compose::pattern::Tile::new(p)?;
let get = |k: &str| controls.iter().zip(&values).find(|(c, _)| c.key == k).map_or(0.0, |(_, v)| *v);
let jitter = Jitter { color: get("colorRandomness") as f32, brightness: get("brightnessRandomness") as f32, seed: 1 };
let brick = BrickFill { scale: get("patternScale"), spacing: get("spacing"), offset: get("offsetBetweenRows"), angle: get("patternRotateAngle"), jitter };
let px = brick.render(&tile, p.width, p.height, photocraft_geom::Rect::new(0, 0, PREVIEW as i32, PREVIEW as i32));
let level = |v: f32| (v.clamp(0.0, 1.0) * 255.0).round() as u8;
let rgba: Vec<u8> = px.iter().flat_map(|q| [0, 1, 2].map(|c| level(q[c] * q[3] + (1.0 - q[3]))).into_iter().chain([255])).collect();
let image = egui::ColorImage::from_rgba_unmultiplied([PREVIEW as usize, PREVIEW as usize], &rgba);
let texture = ctx.load_texture("fill-script-preview", image, egui::TextureOptions::LINEAR);
ctx.data_mut(|d| d.insert_temp(cache, (stamp, texture.clone())));
Some(texture)
}
#[cfg(test)]
#[path = "fill_script_ui_tests.rs"]
mod tests;
@@ -0,0 +1,209 @@
//! #17428: Fill › Pattern has a Script check box and list (greyed until ticked); OK with Script on opens the script's own
//! dialog and only that dialog's OK fills. Preset › Default sets the factory values, a changed value turns Preset to
//! Custom, Reset puts back the opening values, and the values are remembered per script.
use craft::ui::patterns::form_dialogs::HostedParamDialog;
use egui::accesskit::Role;
use egui::vec2;
use egui_kittest::Harness;
use egui_kittest::kittest::{NodeT, Queryable};
use serde_json::{Value, json};
use crate::PhotocraftApp;
use crate::smart_filter_dialog::tests::{cancel, confirm, newest, open_count, pass, set};
type H = Harness<'static, Box<PhotocraftApp>>;
fn app() -> Box<PhotocraftApp> {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
app.run("file.new", json!({"width": 120, "height": 90, "background": "white"})).unwrap();
app.run("layer.new.layer", json!({})).unwrap();
app
}
fn harness(app: Box<PhotocraftApp>) -> H {
crate::theme::install_fonts(app.ctx());
crate::theme::apply(app.ctx(), &crate::theme::AppTheme::pro());
let mut h = Harness::builder()
.with_context(app.ctx().clone())
.with_size(vec2(1400.0, 900.0))
.with_step_dt(1.0 / 60.0)
.build_ui_state(|ui, app: &mut Box<PhotocraftApp>| crate::dialogs::run(app, ui), app);
h.run_steps(4);
h
}
fn click(h: &mut H, at: egui::Pos2) {
h.hover_at(at);
h.run_steps(1);
for pressed in [true, false] {
h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() });
h.run_steps(1);
}
}
fn past(app: &PhotocraftApp) -> usize {
app.session.active().unwrap().history.past_len()
}
fn alpha(app: &PhotocraftApp, x: i32, y: i32) -> f32 {
let st = app.session.active().unwrap();
st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap().rgba(x, y)[3]
}
fn top_key(app: &PhotocraftApp) -> Option<String> {
app.framework.dialogs.open_dialogs().pop().and_then(|d| d.key)
}
fn field(app: &PhotocraftApp, key: &str) -> Option<f64> {
app.framework.dialogs.get_by_id::<HostedParamDialog>(newest(app))?.fields().number(key)
}
fn text(app: &PhotocraftApp, key: &str) -> Option<String> {
app.framework.dialogs.get_by_id::<HostedParamDialog>(newest(app))?.fields().text(key).map(str::to_string)
}
/// Opens Fill with Contents Pattern and Script on (`script` chosen), and presses OK.
fn fill_with_script(app: &mut PhotocraftApp, script: &str) {
let id = super::super::fill_ui::open(app);
set(app, id, "contents", json!("pattern"));
set(app, id, "script", json!(true));
set(app, id, "scriptName", json!(script));
confirm(app, id);
pass(app);
}
/// Whether the Script list is greyed, or `None` without one.
fn list_greyed(h: &H) -> Option<bool> {
h.query_all_by_role(Role::ComboBox)
.find(|n| n.accesskit_node().label().is_some_and(|l| l.trim_end_matches(':') == "Script"))
.map(|n| n.accesskit_node().is_disabled())
}
#[test]
fn ok_in_fill_opens_the_script_dialog_and_only_its_ok_fills() {
let mut app = app();
let before = past(&app);
fill_with_script(&mut app, "brickFill");
assert_eq!(open_count(&app), 1, "Fill closed, the script dialog is open");
assert_eq!(top_key(&app).as_deref(), Some("edit.fill.script.brickFill"));
assert_eq!(past(&app), before, "nothing filled yet");
assert_eq!(text(&app, "preset").as_deref(), Some("default"));
assert_eq!(field(&app, "offsetBetweenRows"), Some(50.0));
let h = harness(app);
assert!(h.query_all_by_role(Role::Dialog).any(|n| n.accesskit_node().label().as_deref() == Some("Brick Fill")), "titled with the script's name");
let mut app = h.into_state();
let top = newest(&app);
confirm(&mut app, top);
assert_eq!(open_count(&app), 0);
assert_eq!(past(&app), before + 1, "one history state");
assert_eq!(app.session.active().unwrap().history.undo_label(), Some("Fill"));
assert!(alpha(&app, 3, 3) > 0.99);
}
#[test]
fn cancel_in_the_script_dialog_fills_nothing() {
let mut app = app();
let before = past(&app);
fill_with_script(&mut app, "brickFill");
let top = newest(&app);
cancel(&mut app, top);
assert_eq!(open_count(&app), 0);
assert_eq!(past(&app), before);
assert_eq!(alpha(&app, 3, 3), 0.0);
}
#[test]
fn preset_default_sets_the_factory_values_and_an_edit_turns_it_custom() {
let mut app = app();
fill_with_script(&mut app, "brickFill");
let id = newest(&app);
set(&mut app, id, "spacing", json!(7));
pass(&mut app);
assert_eq!(text(&app, "preset").as_deref(), Some("custom"));
set(&mut app, id, "preset", json!("default"));
pass(&mut app);
assert_eq!(field(&app, "spacing"), Some(0.0), "Default puts back the factory spacing");
assert_eq!(text(&app, "preset").as_deref(), Some("default"));
}
#[test]
fn values_are_remembered_per_script_and_reset_restores_the_opening_ones() {
let mut app = app();
fill_with_script(&mut app, "brickFill");
let id = newest(&app);
set(&mut app, id, "spacing", json!(6));
confirm(&mut app, id);
// The next Brick Fill opens on the confirmed values.
fill_with_script(&mut app, "brickFill");
assert_eq!(field(&app, "spacing"), Some(6.0));
assert_eq!(text(&app, "preset").as_deref(), Some("custom"));
let id = newest(&app);
set(&mut app, id, "spacing", json!(20));
pass(&mut app);
// Reset, clicked in the dialog, puts back the opening 6, not the factory 0.
let mut h = harness(app);
let reset = h.get_by_role_and_label(Role::Button, "Reset").rect().center();
click(&mut h, reset);
h.run_steps(3);
assert_eq!(field(h.state(), "spacing"), Some(6.0));
assert_eq!(open_count(h.state()), 1, "Reset keeps the dialog open");
}
#[test]
fn fill_lists_the_six_scripts_greyed_until_script_is_ticked() {
let mut app = app();
let id = super::super::fill_ui::open(&mut app);
set(&mut app, id, "contents", json!("pattern"));
let mut h = harness(app);
assert!(!h.get_by_role_and_label(Role::CheckBox, "Script").accesskit_node().is_disabled());
assert_eq!(list_greyed(&h), Some(true), "the list is greyed while Script is off");
set(h.state_mut(), id, "script", json!(true));
h.run_steps(3);
assert_eq!(list_greyed(&h), Some(false), "ticked, the list takes input");
}
#[test]
fn the_fill_dialog_remembers_the_last_script() {
let mut app = app();
let id = super::super::fill_ui::open(&mut app);
set(&mut app, id, "contents", json!("pattern"));
set(&mut app, id, "script", json!(true));
set(&mut app, id, "scriptName", json!("spiral"));
confirm(&mut app, id);
pass(&mut app);
// Spiral has no layout yet: the fill is refused as not supported instead of filling.
assert_eq!(alpha(&app, 3, 3), 0.0);
while open_count(&app) > 0 {
let top = newest(&app);
cancel(&mut app, top);
}
let id = super::super::fill_ui::open(&mut app);
let fields = app.framework.dialogs.get_by_id::<HostedParamDialog>(id).unwrap().fields().clone();
assert_eq!(fields.text("scriptName"), Some("spiral"));
}
#[test]
fn a_typed_value_past_the_range_is_clamped_with_the_range_alert() {
let mut app = app();
fill_with_script(&mut app, "brickFill");
let mut h = harness(app);
let at = h
.query_all_by_role(Role::SpinButton)
.find(|n| n.accesskit_node().label().is_some_and(|l| l.starts_with("Pattern Scale")))
.expect("the Pattern Scale field")
.rect()
.center();
click(&mut h, at);
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
h.event(egui::Event::Text("5".into()));
h.run_steps(1);
h.key_press(egui::Key::Tab);
h.run_steps(4);
let dialogs = h.state().framework.dialogs.open_dialogs();
let message =
dialogs.iter().find(|d| d.key.as_deref() == Some("alert")).and_then(|d| d.fields.as_ref()?.get("message").and_then(Value::as_str).map(str::to_string));
assert!(message.as_deref().is_some_and(|m| m.contains("Closest value inserted")), "{message:?}");
let script = dialogs.iter().find(|d| d.key.as_deref() == Some("edit.fill.script.brickFill")).map(|d| d.id).unwrap();
assert_eq!(h.state().framework.dialogs.get_by_id::<HostedParamDialog>(script).unwrap().fields().number("patternScale"), Some(1.25));
}
+20 -1
View File
@@ -70,6 +70,13 @@ fn rows(app: &PhotocraftApp, foreground: [f32; 3], first_pattern: Option<String>
contents,
Param::new("color", tl!("Color:"), ParamKind::color(Some(foreground))).visible_when("contents", "color"),
Param::new("pattern", tl!("Custom Pattern:"), ParamKind::pattern(first_pattern)).visible_when("contents", "pattern"),
// Script lays the pattern out tile by tile in the chosen script's own dialog, opened by OK (#17428).
Param::new("script", tl!("Script"), ParamKind::bool(false)).visible_when("contents", "pattern"),
Param::new("scriptName", tl!("Script"), ParamKind::choice(super::fill_script_ui::script_options(), Some("brickFill".into())))
.visible_when("contents", "pattern")
.enabled_when("script", true)
.hide_caption()
.beside_previous(),
Param::new("colorAdaptation", tl!("Color Adaptation"), ParamKind::bool(true)).visible_when("contents", "contentAware"),
];
rows.extend(blending_rows(app, preserve));
@@ -166,6 +173,9 @@ pub fn params(f: &DialogFields, held: &Value) -> Value {
if let Some(id) = f.text("pattern") {
p.insert("pattern".into(), json!(id));
}
if f.bool("script") == Some(true) {
p.insert("script".into(), json!(f.text("scriptName").unwrap_or("brickFill")));
}
}
"contentAware" => {
if let Some(on) = f.bool("colorAdaptation") {
@@ -198,7 +208,16 @@ pub(crate) fn check(app: &mut PhotocraftApp, result: &ParamResult) -> Result<(),
/// Fill with the confirmed choices; they are remembered only when the fill succeeded.
pub(crate) fn run(app: &mut PhotocraftApp, ctx: &egui::Context, result: ParamResult) {
let captured = captured(app, &result.key);
match app.run(COMMAND, params(&result.fields, &captured)) {
let p = params(&result.fields, &captured);
// With Script on, OK opens the script's dialog, whose OK fills; Cancel there fills nothing. The choice of script is
// remembered either way, as the reference application reopens on the last script.
if let Some(script) = p.get("script").and_then(Value::as_str).map(str::to_owned) {
remember_blending(ctx, &result);
if super::fill_script_ui::open(app, &script, p.clone(), &captured).is_some() {
return;
}
}
match app.run(COMMAND, p) {
Ok(_) => {
remember_blending(ctx, &result);
// The framework remembers visible parameter rows only; keep their ink companion in the same saved tier.
+19 -4
View File
@@ -29,6 +29,10 @@ const HARDNESS_TRAVEL: f32 = 400.0;
const OPACITY_TRAVEL: f32 = 200.0;
/// The overlay alpha of the preview tint.
const TINT_ALPHA: u8 = 110;
/// The Background Eraser's third readout row: the reference shows "Opacity : 50 %" there, the
/// tool's Tolerance after Reset Tool and not an opacity the tool has (#18053). Unmeasured for other
/// Tolerance values, so the row stays at 50 until they are (#18053).
const BACKGROUND_ERASER_READOUT_OPACITY: f64 = 50.0;
/// The brush resize drag of the painting tools, kept in `PhotocraftApp::brush_resize`. The painting tool takes it
/// out of the app for each call, so its methods get the app as an argument.
@@ -98,7 +102,7 @@ impl PaintResize {
return false;
}
self.key += 1;
self.hud(cx);
self.hud(app, cx);
true
}
@@ -108,7 +112,7 @@ impl PaintResize {
let Some(space) = cx.space() else { return };
let step = self.resize.track(&space.view, pointer.pos);
self.apply(app, step);
self.hud(cx);
self.hud(app, cx);
}
/// The button came up: the last values stay.
@@ -126,13 +130,20 @@ impl PaintResize {
/// Asks for the diameter and level readout beside the pointer while a resize runs. `hud`, not `readout`: Show
/// Transformation Values never hides it. The request lasts one pass, so the tool repeats it every pass.
pub(crate) fn hud(&self, cx: &mut ToolContext<'_>) {
/// The Background Eraser gets a third row, Opacity (#18053).
pub(crate) fn hud(&self, app: &PhotocraftApp, cx: &mut ToolContext<'_>) {
if !self.resize.active() {
return;
}
let words = cx.words::<CanvasControlWords>();
let rows = self.resize.readout_rows(&cx.units(), &words);
let mut rows = self.resize.readout_rows(&cx.units(), &words);
// The reference's third row is there beside a Hardness row; with "Vary Round Brush Hardness on HUD" off the
// level row is already Opacity, and a second one would repeat it.
if app.ui.tool == Tool::BackgroundEraser && varies_hardness(app) {
let opacity = cx.units().percent(BACKGROUND_ERASER_READOUT_OPACITY);
rows.push((words.opacity.clone(), opacity));
}
cx.hud(rows);
}
@@ -175,6 +186,10 @@ impl PaintResize {
#[cfg(test)]
mod tests;
#[cfg(test)]
#[path = "brush_resize_background_eraser_opacity_row_tests.rs"]
mod background_eraser_opacity_row_tests;
#[cfg(test)]
#[path = "../brush_resize_hardness_rate_tests.rs"]
mod brush_resize_hardness_rate_tests;
@@ -0,0 +1,116 @@
//! #18053: the Background Eraser's Ctrl+Alt+drag (Alt+right-drag) readout has a third row,
//! "Opacity : 50 %", after Diameter and Hardness, as the reference application does. The row does
//! not follow the drag or the tool's Tolerance (not measured), and the gesture still changes only
//! the diameter and the hardness, erases nothing and adds no history state.
use serde_json::json;
use super::*;
use crate::canvas::{ToolEvent, testing};
/// A 200 x 100 white document at 100 % zoom with `tool` active and a 40 px, `hardness`, 100 % opaque
/// brush. The window is made a Mac's: off macOS the host reports Ctrl as the command key, and the
/// Ctrl+Alt chord needs Ctrl its own key.
fn app(tool: Tool, hardness: f32) -> Box<PhotocraftApp> {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
app.run("file.new", json!({"width": 200, "height": 100, "background": "white"})).unwrap();
app.run("tools.setBrush", json!({"brush": {"size": 40, "hardness": hardness, "opacity": 1.0}})).unwrap();
app.ui.tool = tool;
app.sync_views();
testing::on_a_mac(&app);
app
}
fn chord() -> egui::Modifiers {
egui::Modifiers { alt: true, ctrl: true, ..Default::default() }
}
/// The rows the readout asked for at `ev`, as (label, value) pairs.
fn readout(app: &mut PhotocraftApp, ev: ToolEvent) -> Vec<(String, String)> {
crate::canvas::tool_event_response(app, ev, chord())
.readout
.map(|r| r.rows.into_iter().map(|(label, value)| (label.as_str().to_owned(), value)).collect())
.unwrap_or_default()
}
fn values(rows: &[(String, String)]) -> Vec<&str> {
rows.iter().map(|(_, value)| value.as_str()).collect()
}
/// Done when 1: after Reset Tool's brush, three rows in the order Diameter, Hardness, Opacity, and
/// the Opacity row reads 50 %.
#[test]
fn the_background_eraser_readout_has_a_fifty_percent_opacity_row() {
let mut a = app(Tool::BackgroundEraser, 1.0);
let got = readout(&mut a, ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 });
assert_eq!(
got,
vec![("Diameter:".to_owned(), "40 px".to_owned()), ("Hardness:".to_owned(), "100%".to_owned()), ("Opacity:".to_owned(), "50%".to_owned()),],
"three rows, in the reference's order"
);
readout(&mut a, ToolEvent::Up { x: 100.0, y: 50.0 });
}
/// Done when 2: horizontal and vertical movement leave the Opacity row at 50 %, the diameter and
/// the hardness following their own axes.
#[test]
fn the_opacity_row_stays_at_fifty_percent_through_the_drag() {
let mut a = app(Tool::BackgroundEraser, 0.5);
readout(&mut a, ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 });
let right = readout(&mut a, ToolEvent::Move { x: 130.0, y: 50.0, pressure: 1.0 });
assert_eq!(values(&right), vec!["100 px", "50%", "50%"], "rightward: a wider tip, the same rows");
// 400 screen points take the hardness from 0 % to 100 %, so 20 points down add 5 %.
let down = readout(&mut a, ToolEvent::Move { x: 130.0, y: 70.0, pressure: 1.0 });
assert_eq!(values(&down), vec!["100 px", "55%", "50%"], "downward: a softer tip, the opacity row unchanged");
let up = readout(&mut a, ToolEvent::Move { x: 130.0, y: 30.0, pressure: 1.0 });
assert_eq!(values(&up), vec!["100 px", "45%", "50%"], "upward: harder, the opacity row unchanged");
readout(&mut a, ToolEvent::Up { x: 130.0, y: 30.0 });
}
/// Done when 3: the row stays at 50 % for another Tolerance. The 50 is the Tolerance after Reset
/// Tool, but the reference's row was not measured for other values, so it does not follow it yet.
#[test]
fn another_tolerance_leaves_the_row_at_fifty_percent() {
let mut a = app(Tool::BackgroundEraser, 1.0);
a.ui.tool_options.bg_tolerance = 85.0;
let got = readout(&mut a, ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 });
assert_eq!(values(&got), vec!["40 px", "100%", "50%"], "Tolerance 85 %: the row still reads 50 %");
readout(&mut a, ToolEvent::Up { x: 100.0, y: 50.0 });
}
/// Done when 2: the gesture changes only the diameter and the hardness, erases nothing and adds no
/// history state.
#[test]
fn the_gesture_erases_nothing_and_adds_no_history_state() {
let mut a = app(Tool::BackgroundEraser, 0.5);
let history = a.session.active().unwrap().history.entries().len();
readout(&mut a, ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 });
readout(&mut a, ToolEvent::Move { x: 130.0, y: 70.0, pressure: 1.0 });
readout(&mut a, ToolEvent::Up { x: 130.0, y: 70.0 });
assert_ne!(a.session.tools.brush.size, 40.0, "the diameter changed");
assert!(a.session.tools.brush.hardness > 0.5, "the hardness changed");
assert_eq!(a.session.tools.brush.opacity, 1.0, "the brush's own opacity did not");
let st = a.session.active().unwrap();
assert_eq!(st.history.entries().len(), history, "no history state");
let surface = st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap();
assert_eq!(surface.pixel(100, 50)[3], 1.0, "the canvas was not erased");
}
/// Done when 1: every other painting tool keeps the framework's two rows, and with "Vary Round
/// Brush Hardness on HUD" off the Background Eraser's second row is already Opacity, so no third row
/// repeats it.
#[test]
fn only_the_background_eraser_with_the_hardness_row_gets_the_third_row() {
let mut pencil = app(Tool::Pencil, 1.0);
let got = readout(&mut pencil, ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 });
assert_eq!(values(&got), vec!["40 px", "100%"], "the Pencil keeps two rows");
readout(&mut pencil, ToolEvent::Up { x: 100.0, y: 50.0 });
let mut eraser = app(Tool::BackgroundEraser, 1.0);
eraser.run("prefs.set", json!({"path": "tools.varyRoundBrushHardnessOnHud", "value": false})).unwrap();
let got = readout(&mut eraser, ToolEvent::Down { x: 100.0, y: 50.0, pressure: 1.0 });
assert_eq!(values(&got), vec!["40 px", "100%"], "the level row is Opacity, and there is no second one");
readout(&mut eraser, ToolEvent::Up { x: 100.0, y: 50.0 });
}
+1 -1
View File
@@ -470,7 +470,7 @@ How each MCP tool maps onto control methods in bridge mode:
Bridge previews capture the app window; passing `index` is an error. Headless `doc_render_preview` supports `index` without changing the active document.
`doc_select` and `doc_close` work only in headless mode. The `ui_*` tools and `control_call` work only in bridge mode; in headless mode they return a tool error that explains how to start bridge mode.
`doc_select` and `doc_close` work only in headless mode. The `ui_*` tools and `control_call` work only in bridge mode. A headless server (`--headless`, or plain `mcp` without the suite's `AI-MCP` flag) does not list them, and calling one is a protocol error for an unknown tool. Plain `mcp` with the flag lists them; while it runs headless because the app is closed, they return a tool error that explains how to start bridge mode.
**Security note:** TCP control uses a bearer token, not client identity or general per-method
authorization. A client that possesses the token receives the non-filesystem control surface,