Merge queue batch: 7 PRs (#16130, #16564, #17288, #17340, #17303, #17338, #17336)
This commit is contained in:
David Mann authored and GitHub committed 2026-11-28 19:37:13 +01:00
commit b069277c49
35 files changed
+1671 -177

No files matched your search

Generated
+109 -98
View File
@@ -1365,7 +1365,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1406,7 +1406,7 @@ dependencies = [
[[package]]
name = "craft-affinity"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"crc32fast",
"flate2",
@@ -1427,7 +1427,7 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -1438,7 +1438,7 @@ dependencies = [
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"rustix 1.1.6",
]
@@ -1446,7 +1446,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1471,7 +1471,7 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"accesskit",
"bitflags 2.13.2",
@@ -1489,7 +1489,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1507,7 +1507,7 @@ dependencies = [
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"egui",
]
@@ -1515,7 +1515,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"md-5",
"rayon",
@@ -1524,12 +1524,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
[[package]]
name = "craft-color"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"serde",
]
@@ -1537,7 +1537,7 @@ dependencies = [
[[package]]
name = "craft-color-transform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-cms",
"craft-color",
@@ -1547,7 +1547,7 @@ dependencies = [
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1567,7 +1567,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-ai-agents",
"craft-atomic",
@@ -1575,7 +1575,6 @@ dependencies = [
"craft-flags",
"craft-platform",
"dirs",
"getrandom 0.3.4",
"log",
"serde",
"serde_json",
@@ -1584,8 +1583,9 @@ dependencies = [
[[package]]
name = "craft-control-protocol"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"getrandom 0.3.4",
"serde_json",
"subtle",
]
@@ -1593,7 +1593,7 @@ dependencies = [
[[package]]
name = "craft-crs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-metadata",
"craft-xml",
@@ -1603,7 +1603,7 @@ dependencies = [
[[package]]
name = "craft-crw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"thiserror 2.0.21",
]
@@ -1611,7 +1611,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"rayon",
]
@@ -1619,7 +1619,7 @@ dependencies = [
[[package]]
name = "craft-develop"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-color",
"craft-color-transform",
@@ -1634,7 +1634,7 @@ dependencies = [
[[package]]
name = "craft-develop-model"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-geom",
"craft-metadata",
@@ -1646,7 +1646,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"block2 0.6.2",
"craft-appkit",
@@ -1672,7 +1672,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"serde",
]
@@ -1680,7 +1680,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1699,12 +1699,12 @@ dependencies = [
[[package]]
name = "craft-eps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
[[package]]
name = "craft-file-formats"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-eps",
"craft-idml",
@@ -1722,7 +1722,7 @@ dependencies = [
[[package]]
name = "craft-flags"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-atomic",
"dirs",
@@ -1732,7 +1732,7 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1747,7 +1747,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1767,7 +1767,7 @@ dependencies = [
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
@@ -1776,7 +1776,7 @@ dependencies = [
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"cap-primitives",
"craft-atomic",
@@ -1799,12 +1799,12 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
[[package]]
name = "craft-geom"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"serde",
]
@@ -1812,7 +1812,7 @@ dependencies = [
[[package]]
name = "craft-heif"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"heic-rs",
"rayon",
@@ -1821,7 +1821,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1834,7 +1834,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"chrono",
"fixed_decimal",
@@ -1862,7 +1862,7 @@ dependencies = [
[[package]]
name = "craft-idml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1872,7 +1872,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-dds",
"craft-heif",
@@ -1900,7 +1900,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1918,12 +1918,12 @@ dependencies = [
[[package]]
name = "craft-ipp"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#af4e8181e69dd26d6f3537b881dd78ec466d374d"
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"thiserror 2.0.21",
]
@@ -1931,7 +1931,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1946,7 +1946,7 @@ dependencies = [
[[package]]
name = "craft-kra"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-xml",
"craft-zip",
@@ -1956,7 +1956,7 @@ dependencies = [
[[package]]
name = "craft-layers"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -1970,7 +1970,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1988,7 +1988,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"brotli-decompressor 6.3.2",
"chrono",
@@ -2000,7 +2000,7 @@ dependencies = [
[[package]]
name = "craft-ora"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-xml",
"craft-zip",
@@ -2010,7 +2010,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2026,11 +2026,11 @@ dependencies = [
[[package]]
name = "craft-pcraft-bundle"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"blake3",
"craft-atomic",
"craft-pcraft-format",
"craft-pcraft-format 0.1.0 (git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d)",
"craft-zip",
"ruzstd",
"thiserror 2.0.21",
@@ -2039,7 +2039,18 @@ dependencies = [
[[package]]
name = "craft-pcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"flate2",
"serde",
"serde_json",
"thiserror 2.0.21",
]
[[package]]
name = "craft-pcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"flate2",
"serde",
@@ -2050,7 +2061,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bytemuck",
"flate2",
@@ -2065,7 +2076,7 @@ dependencies = [
[[package]]
name = "craft-pdn"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -2074,7 +2085,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"async-channel",
"async-io",
@@ -2105,7 +2116,7 @@ dependencies = [
[[package]]
name = "craft-plist"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"thiserror 2.0.21",
]
@@ -2113,7 +2124,7 @@ dependencies = [
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2137,7 +2148,7 @@ dependencies = [
[[package]]
name = "craft-psd"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"encoding_rs",
"flate2",
@@ -2148,7 +2159,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"dispatch2",
"egui",
@@ -2161,7 +2172,7 @@ dependencies = [
[[package]]
name = "craft-raw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"chrono",
"craft-crw",
@@ -2179,7 +2190,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -2198,7 +2209,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2215,7 +2226,7 @@ dependencies = [
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-image-codecs",
"craft-xml",
@@ -2236,7 +2247,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2248,7 +2259,7 @@ dependencies = [
[[package]]
name = "craft-testkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"rustix 1.1.6",
]
@@ -2256,7 +2267,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-font-manager",
@@ -2279,7 +2290,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2294,7 +2305,7 @@ dependencies = [
[[package]]
name = "craft-theme-editor"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-theme",
@@ -2305,7 +2316,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2320,7 +2331,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2330,7 +2341,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2339,7 +2350,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2354,7 +2365,7 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"serde",
]
@@ -2362,7 +2373,7 @@ dependencies = [
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2376,7 +2387,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -2392,7 +2403,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2434,7 +2445,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2445,7 +2456,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2463,7 +2474,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2484,7 +2495,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2504,7 +2515,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2523,7 +2534,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -2555,7 +2566,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"winsafe",
]
@@ -2563,7 +2574,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"craft-appkit",
"craft-atomic",
@@ -2595,7 +2606,7 @@ dependencies = [
[[package]]
name = "craft-xcf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -2604,7 +2615,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -2614,7 +2625,7 @@ dependencies = [
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"flate2",
"thiserror 2.0.21",
@@ -4134,7 +4145,7 @@ dependencies = [
[[package]]
name = "hayro"
version = "0.7.1"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bytemuck",
"hayro-interpret",
@@ -4164,7 +4175,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -4182,7 +4193,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -4206,7 +4217,7 @@ checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -5299,7 +5310,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"arrayvec",
"kurbo 0.13.1",
@@ -6730,7 +6741,7 @@ dependencies = [
"craft-develop-model",
"craft-file-formats",
"craft-image-codecs",
"craft-pcraft-format",
"craft-pcraft-format 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff)",
"craft-print",
"craft-psd",
"craft-tracked",
@@ -6822,7 +6833,7 @@ dependencies = [
"blake3",
"craft-image-codecs",
"craft-pcraft-bundle",
"craft-pcraft-format",
"craft-pcraft-format 0.1.0 (git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d)",
"craft-zip",
"crc32fast",
"exacl",
@@ -9808,7 +9819,7 @@ dependencies = [
[[package]]
name = "vello_common"
version = "0.0.8"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bytemuck",
"fearless_simd",
@@ -9856,7 +9867,7 @@ dependencies = [
[[package]]
name = "vello_cpu"
version = "0.0.8"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
dependencies = [
"bytemuck",
"glifo 0.1.1",
@@ -11502,14 +11513,14 @@ source = "git+https://github.com/storytold/egui.git?rev=932a73b28560acb1a6955333
[[patch.unused]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
[[patch.unused]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
[[patch.unused]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
source = "git+https://github.com/storytold/craft-libs?rev=af4e8181e69dd26d6f3537b881dd78ec466d374d#af4e8181e69dd26d6f3537b881dd78ec466d374d"
+41 -41
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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", default-features = false }
craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d", default-features = false }
craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
# 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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] }
craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d", 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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
photocraft-compose = { path = "crates/compose" }
photocraft-gpu = { path = "crates/gpu" }
photocraft-paint = { path = "crates/paint" }
@@ -48,36 +48,36 @@ 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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-print = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-print = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
# HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784).
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["raster", "write-raster"] }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d", features = ["raster", "write-raster"] }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
# Keep the shared embedded-image validation API until the framework revision includes it.
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["tree-render", "tree-render-system-fonts"] }
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d", features = ["tree-render", "tree-render-system-fonts"] }
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
# Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563.
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
# 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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
# 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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["ui"] }
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d", features = ["ui"] }
thiserror = "2"
serde = { version = "1", features = ["derive", "rc"] }
serde_json = "1"
@@ -350,16 +350,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 = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
vello_common = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
hayro = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
vello_common = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "af4e8181e69dd26d6f3537b881dd78ec466d374d" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" }
emath = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" }
+2
View File
@@ -246,6 +246,8 @@ impl FxMaps {
}
}
#[cfg(test)]
mod drop_shadow_anti_alias_tests;
#[cfg(test)]
mod inner_shadow_anti_alias_tests;
#[cfg(test)]
@@ -0,0 +1,241 @@
//! #14881 - BUG-LAYER-STYLE-DROP-SHADOW-ANTI-ALIASED-IGNORED.
//!
//! Measured on the issue's test document: 400 x 300 px, 72 ppi, RGB 8 bit, white Background, a
//! pixel layer with an orange (255, 128, 0) rectangle at x 100..=299, y 75..=224, Global Light
//! 120 / 30. Black Drop Shadow, Multiply 100 %, Size 10, Distance 0, Spread 0, Noise 0, Contour
//! Gaussian. The tables are the R channel of the flattened image read from a layer edge outwards
//! (255 = no shadow): top = column x 200 from y 74 up, left = row y 150 from x 99, bottom = column
//! x 200 from y 225 down, right = row y 150 from x 300. Outside the layer the shadow multiplies
//! the white Background, so R = 255 x (1 - coverage).
//!
//! On main `shadow_map` read `Shadow::anti_alias` for the Inner Shadow only (#14934), so a Drop
//! Shadow gave one map both ways: every edge read 115 161 205 231 244 250 252 253 254. The
//! reference application's Anti-aliased profile is a drop shadow whose source sits a third of a
//! pixel towards the top-left, the same offset #14934 measured for the Inner Shadow: the top and
//! left edges read 98 147 191 223 241 249 252 254 255, the bottom and right 130 177 214 236 247
//! 252 254 254 255.
use super::*;
const DOC_W: usize = 400;
const DOC_H: usize = 300;
/// The layer's alpha over the whole document: solid over x 100..=299, y 75..=224.
fn document_shape() -> Map {
let mut m = Map::new(DOC_W, DOC_H, 0.0);
for y in 75..=224 {
for x in 100..=299 {
m.v[y * DOC_W + x] = 1.0;
}
}
m
}
fn curve(name: &str, pts: &[(f32, f32)]) -> Contour {
Contour::Custom {
name: name.into(),
points: pts.iter().map(|(input, output)| photocraft_doc::adjust::CurvePoint { input: *input, output: *output }).collect(),
// Every inner point of a built-in preset is a corner (the Contour picker stores it that
// way), so the curve is its polyline.
corners: (0..pts.len()).map(|i| i > 0 && i < pts.len() - 1).collect(),
}
}
/// The Gaussian contour as the built-in preset carries it (`layer_style::CONTOURS`).
fn gaussian() -> Contour {
curve(
"Gaussian",
&[
(0.0, 0.0),
(0.117, 0.023),
(0.172, 0.055),
(0.234, 0.117),
(0.305, 0.234),
(0.383, 0.414),
(0.523, 0.688),
(0.617, 0.812),
(0.703, 0.891),
(0.805, 0.953),
(1.0, 1.0),
],
)
}
/// A second built-in preset, to show the gate is "the measured contour", not "any curve".
fn cone() -> Contour {
curve(
"Cone",
&[
(0.0, 0.0),
(0.172, 0.477),
(0.195, 0.555),
(0.266, 0.711),
(0.383, 0.922),
(0.43, 0.969),
(0.477, 0.992),
(0.523, 0.992),
(0.57, 0.969),
(0.664, 0.859),
(0.703, 0.789),
(0.742, 0.711),
(0.836, 0.477),
(0.859, 0.398),
(0.914, 0.266),
(0.945, 0.156),
(0.977, 0.078),
(1.0, 0.0),
],
)
}
/// The issue's Drop Shadow: black, Multiply, 100 %, Global Light 120 / 30, Spread `spread`.
fn shadow(size: f32, distance: f32, spread: f32, contour: Contour, anti_aliased: bool) -> Shadow {
Shadow {
common: photocraft_doc::FxCommon::new(BlendMode::Multiply, 1.0),
color: photocraft_color::Color::BLACK,
angle: 120.0,
use_global_light: true,
distance,
spread,
size,
contour,
anti_alias: anti_aliased,
noise: 0.0,
knocks_out: false,
}
}
fn map(size: f32, distance: f32, spread: f32, contour: Contour, anti_aliased: bool) -> Map {
shadow_map(&document_shape(), &shadow(size, distance, spread, contour, anti_aliased), &GlobalLight::default(), false, (0, 0))
}
/// The R channel of the white Background under a black Multiply drop shadow of coverage `c`.
fn r(c: f32) -> f32 {
255.0 * (1.0 - c)
}
/// The nine R values outwards from each of the issue's four edges, in the order it reads them.
fn ramps(m: &Map) -> [Vec<f32>; 4] {
let line = |first: (i64, i64), step: (i64, i64)| (0..9).map(|k| r(m.get(first.0 + k * step.0, first.1 + k * step.1))).collect();
[line((200, 74), (0, -1)), line((99, 150), (-1, 0)), line((200, 225), (0, 1)), line((300, 150), (1, 0))]
}
/// Assert each edge's ramp against `want` within `tol` levels.
fn assert_edges(m: &Map, want: &[&[f32]; 4], tol: f32, what: &str) {
for ((side, got), w) in ["top", "left", "bottom", "right"].iter().zip(ramps(m)).zip(want) {
for (d, (got, want)) in got.iter().zip(*w).enumerate() {
assert!((got - want).abs() <= tol, "{what}, {side} edge, {d} px out: {got:.1} vs measured {want} (within {tol})");
}
}
}
/// A hash over every coverage value of a map: the map is bit-for-bit unchanged iff this is.
fn bit_hash(m: &Map) -> u64 {
let mut h: u64 = 0xcbf2_9ce4_8422_2325;
for v in &m.v {
h = (h ^ u64::from(v.to_bits())).wrapping_mul(0x0000_0100_0000_01b3);
}
h
}
/// Done when: on the issue's test document, Gaussian with Anti-aliased gives the measured
/// top/left and bottom/right profiles within 3 levels. *Why* the two pairs of edges differ is not
/// measured; one sub-pixel source offset reproduces both, as it does for the Inner Shadow.
#[test]
fn anti_aliased_gaussian_gives_both_measured_profiles() {
let tl: &[f32] = &[98.0, 147.0, 191.0, 223.0, 241.0, 249.0, 252.0, 254.0, 255.0];
let br: &[f32] = &[130.0, 177.0, 214.0, 236.0, 247.0, 252.0, 254.0, 254.0, 255.0];
assert_edges(&map(10.0, 0.0, 0.0, gaussian(), true), &[tl, tl, br, br], 3.0, "Size 10 Gaussian, Anti-aliased");
}
/// Done when: without Anti-aliased the profiles stay as today. These are the R values
/// `shadow_map` gave on main, and they sit within 3 levels of the issue's measured Anti-aliased
/// off profile, 114 163 205 231 244 251 253 254 255, on every edge.
#[test]
fn without_anti_alias_the_profiles_stay_as_today() {
let today: [i32; 9] = [115, 161, 205, 231, 244, 250, 252, 253, 254];
let measured: &[f32] = &[114.0, 163.0, 205.0, 231.0, 244.0, 251.0, 253.0, 254.0, 255.0];
let m = map(10.0, 0.0, 0.0, gaussian(), false);
for (side, got) in ["top", "left", "bottom", "right"].iter().zip(ramps(&m)) {
for (d, got) in got.iter().enumerate() {
assert_eq!(got.round() as i32, today[d], "Anti-aliased off moved the {side} edge, {d} px out: {got:.2}");
}
}
assert_edges(&m, &[measured, measured, measured, measured], 3.0, "Size 10 Gaussian, Anti-aliased off");
assert_eq!(bit_hash(&m), 0x5e49_20b6_9751_cc45, "the Size 10 Gaussian drop shadow map (Anti-aliased off) moved");
}
/// The offset is a third of a pixel, so the shadow reaches at most one pixel further at the top
/// and left: it stays inside the effect margin (`margin`: Size + Distance + 2) on every side.
#[test]
fn anti_aliased_stays_inside_the_effect_margin() {
let m = map(10.0, 0.0, 0.0, gaussian(), true);
for (x, y) in [(200i64, 75 - 12), (200, 224 + 12), (100 - 12, 150), (299 + 12, 150), (100 - 12, 75 - 12), (299 + 12, 224 + 12)] {
assert_eq!(m.get(x, y), 0.0, "Anti-aliased drop shadow beyond the effect margin at ({x},{y})");
}
}
/// Not measured: Anti-aliased with a contour other than Gaussian. Those keep today's map
/// bit-for-bit - the Linear default and a second built-in curve.
#[test]
fn other_contours_keep_todays_map() {
assert_eq!(bit_hash(&map(10.0, 0.0, 0.0, Contour::Linear, true)), 0x8dc3_4139_f452_da9d, "a Linear drop shadow with Anti-aliased moved");
assert_eq!(bit_hash(&map(10.0, 0.0, 0.0, Contour::Linear, false)), 0x8dc3_4139_f452_da9d, "a Linear drop shadow without Anti-aliased moved");
assert_eq!(bit_hash(&map(10.0, 0.0, 0.0, cone(), true)), bit_hash(&map(10.0, 0.0, 0.0, cone(), false)), "a Cone drop shadow moved with Anti-aliased");
}
/// The flag off leaves every other Size, Distance and Spread exactly as it was: whole-map hashes
/// `shadow_map` gave on main 610c86b969 before this change.
#[test]
fn the_off_path_is_bit_for_bit_unchanged() {
let hashes: [(f32, u64); 9] = [
(0.5, 0xa067_0cbe_8a34_6225),
(1.0, 0xa067_0cbe_8a34_6225),
(1.5, 0xdc2a_66a2_b0c4_a04d),
(2.0, 0x2b77_3190_0ec6_f501),
(3.0, 0x202a_f725_63f0_d551),
(6.0, 0x1ba8_550d_7781_8ee9),
(10.0, 0x5e49_20b6_9751_cc45),
(20.0, 0xf1a6_f4c4_f2f3_5d11),
(250.0, 0x0842_22f2_601f_bfb1),
];
for (size, want) in hashes {
assert_eq!(bit_hash(&map(size, 0.0, 0.0, gaussian(), false)), want, "the whole Size {size} drop shadow map (Anti-aliased off) moved");
}
assert_eq!(bit_hash(&map(10.0, 5.0, 0.0, gaussian(), false)), 0xda80_8e81_2a08_7185, "the Size 10 Distance 5 drop shadow map moved");
assert_eq!(bit_hash(&map(10.0, 0.0, 0.5, gaussian(), false)), 0x5419_4d5e_753c_77a1, "the Size 10 Spread 50 % drop shadow map moved");
}
/// The Inner Shadow's gate (`aa_shift`) applies unchanged: a Size whose blur is the identity
/// (Size 1, Size 2 at Spread 50 %) would turn the offset into the whole map, and a Spread that
/// dilates makes the CPU recompute its distance on the offset map while the GPU shifts a
/// whole-pixel field of the unshifted shape. None of them was measured, so they keep today's map.
#[test]
fn degenerate_and_dilating_neighbours_keep_todays_map() {
for (size, spread, what) in [(1.0, 0.0, "Size 1"), (2.0, 0.5, "Size 2 Spread 50 %"), (10.0, 0.5, "Size 10 Spread 50 %"), (10.0, 0.05, "Size 10 Spread 5 %")]
{
assert_eq!(
bit_hash(&map(size, 0.0, spread, gaussian(), true)),
bit_hash(&map(size, 0.0, spread, gaussian(), false)),
"the {what} drop shadow map moved with Anti-aliased"
);
}
}
/// Guard: the rule is in the inputs, not keyed to the measured Size 10. Every Size whose blur is
/// wider than the identity takes the offset at Spread 0, and so does a Distance other than 0.
#[test]
fn the_offset_follows_the_inputs_not_the_measured_size() {
for size in [1.5, 2.0, 3.0, 6.0, 20.0, 250.0] {
assert_ne!(
bit_hash(&map(size, 0.0, 0.0, gaussian(), true)),
bit_hash(&map(size, 0.0, 0.0, gaussian(), false)),
"Anti-aliased did nothing at Size {size}, Spread 0"
);
}
assert_ne!(
bit_hash(&map(10.0, 5.0, 0.0, gaussian(), true)),
bit_hash(&map(10.0, 5.0, 0.0, gaussian(), false)),
"Anti-aliased did nothing at Size 10, Distance 5"
);
}
@@ -188,15 +188,16 @@ fn anti_aliased_still_paints_nothing_outside_the_layer() {
}
/// Not measured: Anti-aliased with a contour other than Gaussian. Those keep today's map
/// bit-for-bit - the Linear default, a second built-in curve, and the Drop Shadow (its own item is
/// #14881). Hashes are the ones these maps had on upstream/main before the change.
/// bit-for-bit - the Linear default and a second built-in curve. Hashes are the ones these maps had
/// on upstream/main before the change. The Drop Shadow's off path is pinned here too; with the flag
/// on it takes the same offset since #14881 (`drop_shadow_anti_alias_tests`).
#[test]
fn other_contours_and_the_drop_shadow_keep_todays_map() {
fn other_contours_keep_todays_map() {
assert_eq!(bit_hash(&map(10.0, 0.0, 0.0, 0.0, Contour::Linear, true)), 0x2200_2b2d_61bc_9c2d, "a Linear-contour inner shadow with Anti-aliased moved");
assert_eq!(bit_hash(&map(10.0, 0.0, 0.0, 0.0, cone(), true)), 0xb86c_68a7_8a2f_e689, "a Cone-contour inner shadow with Anti-aliased moved");
let drop = |aa: bool| shadow_map(&document_shape(), &shadow(10.0, 0.0, 0.0, 0.0, gaussian(), aa), &GlobalLight::default(), false, (0, 0));
assert_eq!(bit_hash(&drop(false)), 0x5e49_20b6_9751_cc45, "the Drop Shadow Gaussian map (Anti-aliased off) moved");
assert_eq!(bit_hash(&drop(true)), 0x5e49_20b6_9751_cc45, "the Drop Shadow still ignores Anti-aliased (#14881)");
assert_ne!(bit_hash(&drop(true)), 0x5e49_20b6_9751_cc45, "the Drop Shadow honours Anti-aliased since #14881");
}
/// The flag off leaves every other Size, Distance and Choke exactly as it was. These are the whole
+4 -4
View File
@@ -502,10 +502,10 @@ pub fn spread_split(size: f32, spread: f32) -> (f32, f32) {
pub(super) fn shadow_map(shape: &Map, s: &Shadow, light: &GlobalLight, inner: bool, origin: (i32, i32)) -> Map {
let angle = if s.use_global_light { light.angle } else { s.angle };
let (dx, dy) = offset(angle, s.distance);
// #14934: an Anti-aliased Inner Shadow builds its map from the shape off-centre (`aa_shift`).
// Only the inner branch was measured, so a Drop Shadow keeps today's map (#14881 is its own),
// and `aa_shift` leaves every Choke that dilates and every Size whose blur is the identity.
let aa = aa_shift(inner && s.anti_alias, &s.contour, s.size, s.spread);
// #14934 (Inner Shadow) and #14881 (Drop Shadow): an Anti-aliased shadow builds its map from
// the shape off-centre (`aa_shift`); both measured the same third of a pixel. `aa_shift`
// leaves every Choke / Spread that dilates and every Size whose blur is the identity.
let aa = aa_shift(s.anti_alias, &s.contour, s.size, s.spread);
let src = if inner { shape.clone().map(|a| 1.0 - a) } else { shape.clone() };
let mut m = src.shifted(dx + aa, dy + aa, if inner { 1.0 } else { 0.0 });
let (r, bw) = spread_split(s.size, s.spread);
+45
View File
@@ -759,6 +759,51 @@ pub fn working_profile(mode: ColorMode) -> Arc<Profile> {
Arc::new(craft_cms::builtin::default_for(mode_space(mode)).unwrap_or(Builtin::Srgb.profile()).clone())
}
/// Resolve an export copy's working profile under the session's existing profile-read gate.
/// The actual spec is authorized so an implicit working space cannot hide an ICC path.
pub(crate) fn export_working_profile(s: &Session, mode: ColorMode) -> Result<Arc<Profile>> {
let _authorization = crate::jobs::render_authorization_scope(s.authorize);
if let Some(spec) = s.color().settings.working_spec(mode_space(mode)) {
crate::jobs::authorize_render_command("edit.profileInfo", &json!({"profile": spec}))?;
}
Ok(s.color().working(mode))
}
/// Refuse an export's implicit profile read before dispatch drops a floating selection.
pub(crate) fn check_export_working_profile(s: &Session, id: &str, p: &Value) -> Result<()> {
if !matches!(id, "file.export.layersToFiles" | "file.export.saveForWebLegacy" | "file.export.quickExport") {
return Ok(());
}
let Some(st) = s.active() else { return Ok(()) };
let doc = &st.doc;
if doc.icc_profile.is_some() || !matches!(doc.mode, ColorMode::Rgb | ColorMode::Grayscale) {
return Ok(());
}
let needed = match id {
"file.export.layersToFiles" => p.get("iccProfile").and_then(Value::as_bool) == Some(true),
"file.export.saveForWebLegacy" if doc.mode == ColorMode::Rgb => {
let settings = crate::web_cmds::WebSettings::from_params(p, id)?;
settings.embed_icc && !settings.convert_to_srgb
}
"file.export.quickExport" if doc.mode == ColorMode::Rgb => {
let prefs = s.prefs().export.clone();
let path =
p.get("path").and_then(Value::as_str).filter(|path| !path.is_empty()).map(str::to_owned).or_else(|| crate::web_cmds::quick_export_target(s));
let format = path.map(|path| {
crate::file_cmds::extension(&path).unwrap_or_else(|| {
serde_json::to_value(prefs.quick_export_format).ok().and_then(|value| value.as_str().map(str::to_owned)).unwrap_or_default()
})
});
!prefs.convert_to_srgb && format.as_deref() == Some("webp")
}
_ => false,
};
if needed {
export_working_profile(s, doc.mode)?;
}
Ok(())
}
/// Parses ICC bytes, caching by allocation so repeated lookups for the same document are free.
pub fn profile_from_bytes(bytes: &Arc<Vec<u8>>) -> std::result::Result<Arc<Profile>, craft_cms::CmsError> {
type Cache = Mutex<Vec<(Weak<Vec<u8>>, Arc<Profile>)>>;
@@ -71,7 +71,12 @@ pub fn export_layers_report_with(s: &Session, p: &Value, mut write: impl FnMut(&
return Err(EngineError::Other("Layers to Files needs a document with multiple layers.".into()));
}
let prefix = p.get("prefix").and_then(Value::as_str).map(str::to_string).unwrap_or_else(|| stem(&d.doc.name));
let doc = d.doc.clone();
let mut doc = d.doc.clone();
if icc == Some(true) && doc.icc_profile.is_none() && matches!(doc.mode, ColorMode::Rgb | ColorMode::Grayscale) {
// Only the exported copy gains a tag; the open document remains untagged.
let profile = crate::color_cmds::export_working_profile(s, doc.mode)?.to_bytes();
std::sync::Arc::make_mut(&mut doc).icc_profile = Some(profile);
}
let mut report = LayerExportReport::default();
// Every layer takes its panel-order index, even one skipped as hidden or as an adjustment,
// so a file keeps the same number whether Visible Layers Only is on or off (#13959).
@@ -4,6 +4,7 @@
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use super::*;
use crate::color_cmds::ColorExt;
fn session(mode: &str, depth: u32) -> Session {
let mut s = crate::session();
@@ -181,3 +182,87 @@ fn an_indexed_documents_files_follow_the_setting() {
assert!(layered.iter().all(|(_, icc)| icc.is_none()), "indexed layered tif: no profile");
assert_eq!(one(&mut s, "psd", json!({"iccProfile": true})).1, Some("RGB".into()), "indexed psd: the profile");
}
/// #17199: Include ICC describes an untagged layer in the session's working space,
/// without assigning that profile to the source document or changing its samples.
#[test]
fn include_icc_uses_the_working_space_only_for_untagged_layers() {
let export_profile = |s: &mut Session| {
let dir = tempfile::tempdir().unwrap();
let out = s.execute("file.export.layersToFiles", json!({"dir": dir.path().to_string_lossy(), "format": "png", "iccProfile": true})).unwrap();
let files = out["files"].as_array().unwrap();
assert_eq!(files.len(), 1);
let bytes = std::fs::read(files[0].as_str().unwrap()).unwrap();
photocraft_codecs::decode(&bytes).unwrap().icc.unwrap()
};
for (mode, key, working, tagged) in [("rgb", "workingRgb", "prophoto-compat", "display-p3"), ("grayscale", "workingGray", "gray-gamma-2.2", "sgray")] {
let mut s = session(mode, 8);
s.execute("edit.assignProfile", json!({"profile": "none"})).unwrap();
let mut settings = json!({});
settings[key] = json!(working);
s.execute("edit.colorSettings", settings).unwrap();
let original = s.active().unwrap().doc.clone();
assert!(original.icc_profile.is_none());
let samples = photocraft_compose::flatten(&original).px.to_vec();
let expected = s.color().working(original.mode).to_bytes();
assert_ne!(expected, crate::color_cmds::working_profile(original.mode).to_bytes(), "{mode}: the nondefault profile must distinguish the old fallback");
assert_eq!(export_profile(&mut s).as_slice(), expected.as_slice(), "{mode}");
assert!(s.active().unwrap().doc.icc_profile.is_none());
assert_eq!(photocraft_compose::flatten(&s.active().unwrap().doc).px.to_vec(), samples);
s.execute("edit.assignProfile", json!({"profile": tagged})).unwrap();
let own = s.active().unwrap().doc.icc_profile.clone().unwrap();
assert_ne!(own, expected);
assert_eq!(export_profile(&mut s).as_slice(), own.as_slice(), "{mode}: a tag wins over the working space");
assert_eq!(s.active().unwrap().doc.icc_profile.as_deref(), Some(own.as_ref()));
assert_eq!(photocraft_compose::flatten(&s.active().unwrap().doc).px.to_vec(), samples);
}
let mut s = session("rgb", 8);
s.execute("edit.assignProfile", json!({"profile": "none"})).unwrap();
s.execute("edit.colorSettings", json!({"workingRgb": "prophoto-compat"})).unwrap();
let expected = s.color().working(ColorMode::Rgb).to_bytes();
// An export may be authorized while a stored working-profile path is not. The inherited
// job gate must run before resolving that path, including APIs without Session::execute.
fn deny_profile_path(id: &str, params: &Value) -> crate::Result<()> {
if id == "edit.profileInfo" && params.get("profile").and_then(Value::as_str).is_some_and(|p| p.ends_with("blocked-working.icc")) {
return Err(EngineError::Other("denied working ICC read 17199".into()));
}
Ok(())
}
let profile_dir = tempfile::tempdir().unwrap();
let profile_path = profile_dir.path().join("blocked-working.icc");
std::fs::write(&profile_path, expected.as_slice()).unwrap();
s.execute("edit.colorSettings", json!({"workingRgb": profile_path.to_string_lossy()})).unwrap();
let _authorization = crate::jobs::render_authorization_scope(Some(deny_profile_path));
s.execute("select.rect", json!({"x": 0, "y": 0, "width": 2, "height": 2})).unwrap();
s.execute("select.float", json!({"dx": 2})).unwrap();
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some());
let document = s.active().unwrap().doc.clone();
let revision = s.active().unwrap().revision;
let history = s.active().unwrap().history.entries();
let mut writes = 0;
let error = export_layers_report_with(&s, &json!({"format": "png", "iccProfile": true}), |_, _| {
writes += 1;
Ok(())
})
.unwrap_err();
assert!(error.to_string().contains("denied working ICC read 17199"));
assert_eq!(writes, 0, "a rejected implicit profile read must not produce a layer file");
assert!(s.active().unwrap().doc.icc_profile.is_none());
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some(), "a denied profile read leaves the move floating");
assert!(std::sync::Arc::ptr_eq(&s.active().unwrap().doc, &document));
assert_eq!(s.active().unwrap().revision, revision);
assert_eq!(s.active().unwrap().history.entries(), history, "no History step is added");
let output = tempfile::tempdir().unwrap();
let error = s.execute("file.export.layersToFiles", json!({"dir": output.path().to_string_lossy(), "format": "png", "iccProfile": true})).unwrap_err();
assert!(error.to_string().contains("denied working ICC read 17199"));
assert_eq!(std::fs::read_dir(output.path()).unwrap().count(), 0);
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some(), "a denied profile read leaves the move floating");
assert!(std::sync::Arc::ptr_eq(&s.active().unwrap().doc, &document));
assert_eq!(s.active().unwrap().revision, revision);
assert_eq!(s.active().unwrap().history.entries(), history, "no History step is added");
}
@@ -119,6 +119,10 @@ pub(super) fn quick_export(s: &mut Session, p: &Value) -> Result<Value> {
// Keeping quality absent preserves the historical lossless Quick Export behavior.
let st = WebSettings::from_params(&Value::Object(o.clone()), cmd)?;
let (mut wdoc, _, _) = web_document(&doc, &json!({}), &st)?;
if !st.convert_to_srgb && doc.icc_profile.is_none() && doc.mode == photocraft_doc::ColorMode::Rgb {
// The regular WebP writer embeds ICC by default; do not let it guess sRGB.
wdoc.icc_profile = Some(crate::color_cmds::export_working_profile(s, doc.mode)?.to_bytes());
}
// The regular exporter embeds the document's XMP and EXIF as they are: give it only
// what the metadata choice keeps, as the Save for Web formats get.
wdoc.metadata.xmp = web_xmp(&doc, st.metadata).map(std::sync::Arc::from);
@@ -227,16 +227,28 @@ fn save_for_web_impl(s: &mut Session, p: &Value, write: &mut dyn FnMut(&str, &[u
let st = WebSettings::from_params(p, cmd)?;
// So are the slices: committing a floating move doesn't change them.
let pick = slice_pick(p, cmd, &s.active().ok_or(EngineError::NoDocument)?.doc)?;
// A refused implicit profile read must also leave a directly called platform export's move floating.
let working_profile = {
let doc = &s.active().ok_or(EngineError::NoDocument)?.doc;
if st.embed_icc && !st.convert_to_srgb && doc.icc_profile.is_none() && doc.mode == photocraft_doc::ColorMode::Rgb {
Some(crate::color_cmds::export_working_profile(s, doc.mode)?)
} else {
None
}
};
// Direct platform calls must export the moved selection as it appears on the canvas,
// just as Session::execute does before dispatching the native command.
crate::float_cmds::before_command(s, cmd)?;
let d = s.active().ok_or(EngineError::NoDocument)?;
let doc = d.doc.clone();
let mut doc = s.active().ok_or(EngineError::NoDocument)?.doc.clone();
if let Some(profile) = working_profile {
// Tag the post-move copy, never the open document.
std::sync::Arc::make_mut(&mut doc).icc_profile = Some(profile.to_bytes());
}
let (wdoc, sx, sy) = web_document(&doc, p, &st)?;
let buf = photocraft_compose::flatten(&wdoc);
let bw = wdoc.size.width as usize;
// An untagged document is treated as sRGB (see [`web_document`]); with Embed Color Profile
// on, the file says so, as Photoshop's does (#9325).
// Copies that retain the working space are tagged above. Keep the default sRGB tag for
// the remaining untagged web output (#9325).
let srgb = (st.embed_icc && wdoc.icc_profile.is_none()).then(|| craft_cms::Builtin::Srgb.profile().to_bytes().to_vec());
let icc = wdoc.icc_profile.as_deref().map(|v| v.as_slice()).or(srgb.as_deref());
let xmp = web_xmp(&doc, st.metadata);
@@ -1,4 +1,5 @@
use super::*;
use crate::color_cmds::ColorExt;
use photocraft_doc::{Layer, LayerContent};
fn tmp(name: &str) -> String {
@@ -1616,3 +1617,127 @@ fn a_whole_image_path_with_slice_numbers_is_refused() {
s.execute("file.export.saveForWebLegacy", json!({"format": "png24", "path": whole, "numbers": [1]})).unwrap();
assert_eq!(decode(&whole).dimensions(), (64, 48));
}
/// #17199: preserving document colours embeds their working interpretation; explicitly
/// converting for the web still names sRGB, and disabling embedding still omits ICC.
#[test]
fn save_for_web_embeds_the_working_rgb_only_when_preserving_document_colours() {
let mut s = session(8);
s.execute("edit.assignProfile", json!({"profile": "none"})).unwrap();
s.execute("edit.colorSettings", json!({"workingRgb": "prophoto-compat"})).unwrap();
let expected = s.color().working(photocraft_color::ColorMode::Rgb).to_bytes();
assert_ne!(expected, craft_cms::Builtin::Srgb.profile().to_bytes());
let original = s.active().unwrap().doc.clone();
let samples = photocraft_compose::flatten(&original).px.to_vec();
let dir = tmp("working-profile-17199");
let preserved = format!("{dir}/preserved.png");
s.execute("file.export.saveForWebLegacy", json!({"format": "png24", "convertToSrgb": false, "embedIcc": true, "path": preserved})).unwrap();
let preserved = decode(&preserved);
assert_eq!(preserved.icc.as_deref(), Some(expected.as_slice()));
let off = format!("{dir}/off.png");
s.execute("file.export.saveForWebLegacy", json!({"format": "png24", "convertToSrgb": false, "embedIcc": false, "path": off})).unwrap();
let off = decode(&off);
assert!(off.icc.is_none());
assert_eq!(off.data(), preserved.data(), "embedding describes the same samples");
let converted = format!("{dir}/srgb.png");
s.execute("file.export.saveForWebLegacy", json!({"format": "png24", "convertToSrgb": true, "embedIcc": true, "path": converted})).unwrap();
assert_eq!(
decode(&converted).icc.as_deref(),
Some(craft_cms::Builtin::Srgb.profile().to_bytes().as_slice()),
"an explicit web conversion keeps its sRGB destination tag"
);
assert_eq!(s.active().unwrap().doc.icc_profile, original.icc_profile);
assert_eq!(photocraft_compose::flatten(&s.active().unwrap().doc).px.to_vec(), samples);
// An export may be authorized while a stored working-profile path is not. The inherited
// job gate must run before resolving that path, including APIs without Session::execute.
fn deny_profile_path(id: &str, params: &Value) -> crate::Result<()> {
if id == "edit.profileInfo" && params.get("profile").and_then(Value::as_str).is_some_and(|p| p.ends_with("blocked-working.icc")) {
return Err(EngineError::Other("denied working ICC read 17199".into()));
}
Ok(())
}
let profile_dir = tempfile::tempdir().unwrap();
let profile_path = profile_dir.path().join("blocked-working.icc");
std::fs::write(&profile_path, expected.as_slice()).unwrap();
s.execute("edit.colorSettings", json!({"workingRgb": profile_path.to_string_lossy()})).unwrap();
let _authorization = crate::jobs::render_authorization_scope(Some(deny_profile_path));
s.execute("select.rect", json!({"x": 0, "y": 0, "width": 2, "height": 2})).unwrap();
s.execute("select.float", json!({"dx": 2})).unwrap();
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some());
let document = s.active().unwrap().doc.clone();
let revision = s.active().unwrap().revision;
let history = s.active().unwrap().history.entries();
let blocked = format!("{dir}/blocked.png");
let error = s.execute("file.export.saveForWebLegacy", json!({"format": "png24", "convertToSrgb": false, "embedIcc": true, "path": blocked})).unwrap_err();
assert!(error.to_string().contains("denied working ICC read 17199"));
assert!(!std::path::Path::new(&blocked).exists());
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some(), "a denied profile read leaves the move floating");
assert!(std::sync::Arc::ptr_eq(&s.active().unwrap().doc, &document));
assert_eq!(s.active().unwrap().revision, revision);
assert_eq!(s.active().unwrap().history.entries(), history, "no History step is added");
let mut writes = 0;
let error = save_for_web_with_writer(&mut s, &json!({"format": "png24", "convertToSrgb": false, "embedIcc": true, "path": blocked}), &mut |_, _| {
writes += 1;
Ok(())
})
.unwrap_err();
assert!(error.to_string().contains("denied working ICC read 17199"));
assert_eq!(writes, 0);
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some(), "a denied profile read leaves the move floating");
assert!(std::sync::Arc::ptr_eq(&s.active().unwrap().doc, &document));
assert_eq!(s.active().unwrap().revision, revision);
assert_eq!(s.active().unwrap().history.entries(), history, "no History step is added");
}
/// #17199: Quick WebP's regular encoder embeds by default, so a non-converting export
/// needs the same working-space interpretation even though Quick Export has no ICC toggle.
#[test]
fn quick_webp_without_conversion_embeds_the_untagged_working_rgb() {
let mut s = session(8);
s.execute("edit.assignProfile", json!({"profile": "none"})).unwrap();
s.execute("edit.colorSettings", json!({"workingRgb": "prophoto-compat"})).unwrap();
let expected = s.color().working(photocraft_color::ColorMode::Rgb).to_bytes();
assert_ne!(expected, craft_cms::Builtin::Srgb.profile().to_bytes());
let original = s.active().unwrap().doc.clone();
let samples = photocraft_compose::flatten(&original).px.to_vec();
s.execute("file.export.exportPreferences", json!({"quickExportFormat": "png", "convertToSrgb": false, "webpLossless": true, "metadata": "none"})).unwrap();
let path = format!("{}/working.webp", tmp("quick-working-profile-17199"));
s.execute("file.export.quickExport", json!({"path": path})).unwrap();
assert_eq!(decode(&path).icc.as_deref(), Some(expected.as_slice()));
assert_eq!(s.active().unwrap().doc.icc_profile, original.icc_profile);
assert_eq!(photocraft_compose::flatten(&s.active().unwrap().doc).px.to_vec(), samples);
s.execute("prefs.reset", json!({"path": "export"})).unwrap();
// An export may be authorized while a stored working-profile path is not. The inherited
// job gate must run before resolving that path, including APIs without Session::execute.
fn deny_profile_path(id: &str, params: &Value) -> crate::Result<()> {
if id == "edit.profileInfo" && params.get("profile").and_then(Value::as_str).is_some_and(|p| p.ends_with("blocked-working.icc")) {
return Err(EngineError::Other("denied working ICC read 17199".into()));
}
Ok(())
}
let profile_dir = tempfile::tempdir().unwrap();
let profile_path = profile_dir.path().join("blocked-working.icc");
std::fs::write(&profile_path, expected.as_slice()).unwrap();
s.execute("edit.colorSettings", json!({"workingRgb": profile_path.to_string_lossy()})).unwrap();
let _authorization = crate::jobs::render_authorization_scope(Some(deny_profile_path));
s.execute("file.export.exportPreferences", json!({"quickExportFormat": "png", "convertToSrgb": false, "webpLossless": true})).unwrap();
s.execute("select.rect", json!({"x": 0, "y": 0, "width": 2, "height": 2})).unwrap();
s.execute("select.float", json!({"dx": 2})).unwrap();
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some());
let document = s.active().unwrap().doc.clone();
let revision = s.active().unwrap().revision;
let history = s.active().unwrap().history.entries();
let blocked = format!("{}/blocked.webp", tmp("quick-blocked-profile-17199"));
let error = s.execute("file.export.quickExport", json!({"path": blocked})).unwrap_err();
assert!(error.to_string().contains("denied working ICC read 17199"));
assert!(!std::path::Path::new(&blocked).exists());
assert!(crate::float_cmds::floating(s.active().unwrap()).is_some(), "a denied profile read leaves the move floating");
assert!(std::sync::Arc::ptr_eq(&s.active().unwrap().doc, &document));
assert_eq!(s.active().unwrap().revision, revision);
assert_eq!(s.active().unwrap().history.entries(), history, "no History step is added");
}
+1
View File
@@ -188,6 +188,7 @@ pub fn register(install: &mut Install) {
// files
hooks.request_params.push(crate::file_cmds::batch_open_params);
hooks.check_params.push(crate::color_cmds::check_export_working_profile);
hooks.after_command.push(|s, id, _| crate::automate_cmds::after_command(s, id));
hooks.step_recorded.push(crate::actions_cmds::note_step_origin);
hooks.flush_recording.push(crate::actions_cmds::flush_recording);
+10 -10
View File
@@ -22,16 +22,16 @@ impl B {
// `× shape` step below would then remove the whole shadow, exactly as on the CPU. Both
// compositors expand the inverted shape by the ¼–½–¼ taps instead
// (`photocraft_compose::effects::size_one_kernel`, the kernel `shadow_map` applies).
// #14934: an Anti-aliased Inner Shadow takes the CPU's sub-pixel source offset, on the
// CPU's gate only (`fx::aa_shift`: the inner branch, the Gaussian contour, and a Size and
// Choke that leave the map a shift plus a blur that is not the identity). A Drop Shadow
// keeps today's map (#14881). At a Choke that dilates the CPU recomputes its dilation
// distance on the offset map while this builder shifts the whole-pixel field of the
// unshifted shape, and at a blur of width 1 the offset would be the whole map: both
// neighbours take no offset here — which covers the Size 1 case above —, which is what
// keeps them equal on both compositors
// (`anti_aliased_inner_shadow_gated_neighbours_match_the_cpu`).
let aa = fx::aa_shift(inner && s.anti_alias, &s.contour, s.size, s.spread);
// #14934 / #14881: an Anti-aliased Inner or Drop Shadow takes the CPU's sub-pixel source
// offset, on the CPU's gate only (`fx::aa_shift`: the Gaussian contour, and a Size and
// Choke / Spread that leave the map a shift plus a blur that is not the identity). At a
// Choke or Spread that dilates the CPU recomputes its dilation distance on the offset map
// while this builder shifts the whole-pixel field of the unshifted shape, and at a blur of
// width 1 the offset would be the whole map: both neighbours take no offset here — which
// covers the Size 1 case above —, which is what keeps them equal on both compositors
// (`anti_aliased_inner_shadow_gated_neighbours_match_the_cpu`,
// `anti_aliased_drop_shadow_gated_neighbours_match_the_cpu`).
let aa = fx::aa_shift(s.anti_alias, &s.contour, s.size, s.spread);
let src = self.shift(In::Shape, dx + aa, dy + aa, if inner { 1.0 } else { 0.0 }, inner);
let m = if inner && s.size == 1.0 && s.spread == 0.0 {
self.conv(src, fx::size_one_kernel())
+67 -4
View File
@@ -427,11 +427,74 @@ fn anti_aliased_inner_shadow_shifts_the_map_stage() {
// Unmeasured cases keep today's stage: the contour gate is the CPU's.
let linear = program(&Effect::InnerShadow(shadow(true, Contour::Linear)), &light, false);
assert_eq!(shift_stages(&linear)[0].p0, [0.0, 0.0, 1.0, 1.0], "a Linear inner shadow still ignores Anti-aliased (#14934 leaves that contour unmeasured)");
// A Drop Shadow (its own item is #14881) keeps its whole-pixel program either way.
let drop_on = program(&Effect::DropShadow(shadow(true, gaussian.clone())), &light, false);
// A Drop Shadow without Anti-aliased keeps its whole-pixel program: no shift at Distance 0.
let drop_off = program(&Effect::DropShadow(shadow(false, gaussian)), &light, false);
assert_eq!(shift_stages(&drop_on).len(), 0, "a Drop Shadow at Distance 0 takes no shift stage");
assert_eq!(drop_on.key, drop_off.key, "the Drop Shadow still ignores Anti-aliased (#14881 is its own item)");
assert_eq!(shift_stages(&drop_off).len(), 0, "a Drop Shadow at Distance 0 without Anti-aliased takes no shift stage");
}
/// #14881: the GPU's Drop Shadow program takes the same sub-pixel source offset as the CPU's
/// `shadow_map`, on the same gate as the Inner Shadow: the Gaussian contour and a Size and Spread
/// whose map is a shift plus a blur wider than the identity. At Distance 0 the flag off builds no
/// shift stage at all; the flag on adds one carrying the offset (no invert, empty outside).
#[test]
fn anti_aliased_drop_shadow_shifts_the_map_stage() {
use photocraft_doc::{Contour, FxCommon, Shadow};
let pts: [(f32, f32); 11] = [
(0.0, 0.0),
(0.117, 0.023),
(0.172, 0.055),
(0.234, 0.117),
(0.305, 0.234),
(0.383, 0.414),
(0.523, 0.688),
(0.617, 0.812),
(0.703, 0.891),
(0.805, 0.953),
(1.0, 1.0),
];
let gaussian = || Contour::Custom {
name: "Gaussian".into(),
points: pts.iter().map(|(input, output)| photocraft_doc::adjust::CurvePoint { input: *input, output: *output }).collect(),
corners: (0..pts.len()).map(|i| i > 0 && i < pts.len() - 1).collect(),
};
let shadow = |size: f32, spread: f32, distance: f32, contour: Contour, anti_aliased: bool| Shadow {
common: FxCommon::new(BlendMode::Multiply, 1.0),
color: photocraft_color::Color::BLACK,
angle: 0.0,
use_global_light: false,
distance,
spread,
size,
contour,
anti_alias: anti_aliased,
noise: 0.0,
knocks_out: false,
};
let shifts = |s: Shadow| -> (Vec<[f32; 4]>, u64) {
let p = program(&Effect::DropShadow(s), &GlobalLight::default(), false);
(p.stages.iter().filter(|s| s.kernel == Kernel::MShift).map(|s| s.p0).collect(), p.key)
};
let aa = photocraft_compose::effects::aa_shift(true, &gaussian(), 10.0, 0.0);
assert_eq!(aa, -1.0 / 3.0, "the CPU offset the GPU has to copy at the measured Size 10, Spread 0");
let off = shifts(shadow(10.0, 0.0, 0.0, gaussian(), false));
let on = shifts(shadow(10.0, 0.0, 0.0, gaussian(), true));
assert!(off.0.is_empty(), "a Drop Shadow at Distance 0 without Anti-aliased takes no shift stage: {:?}", off.0);
assert_eq!(on.0, vec![[aa, aa, 0.0, 0.0]], "the Anti-aliased drop shadow must shift its source by the CPU's offset");
assert_ne!(on.1, off.1, "the flag has to invalidate the cached program");
// Distance 5 at angle 0: the whole-pixel light offset (-5, 0) plus the third of a pixel.
let far = shifts(shadow(10.0, 0.0, 5.0, gaussian(), true));
assert_eq!(far.0, vec![[-5.0 + aa, aa, 0.0, 0.0]], "Distance 5 carries the light offset plus the sub-pixel offset");
// The gate: other contours, the identity blur and a Spread that dilates keep today's program.
for (s, what) in [
(shadow(10.0, 0.0, 0.0, Contour::Linear, true), "a Linear contour"),
(shadow(1.0, 0.0, 0.0, gaussian(), true), "Size 1"),
(shadow(2.0, 0.5, 0.0, gaussian(), true), "Size 2 Spread 50 %"),
(shadow(10.0, 0.5, 5.0, gaussian(), true), "Size 10 Spread 50 % at Distance 5"),
] {
let mut flag_off = s.clone();
flag_off.anti_alias = false;
assert_eq!(shifts(s), shifts(flag_off), "the {what} drop shadow program moved with Anti-aliased");
}
}
/// #14934 review: the GPU's gate is the CPU's rule, including its two degenerate neighbours. At
+76
View File
@@ -3811,3 +3811,79 @@ fn anti_aliased_inner_shadow_gated_neighbours_match_the_cpu() {
.unwrap_or_else(|e| panic!("{e}"));
}
}
// ---------------------------------------------------------------------------------------------
// #14881: the Drop Shadow's Anti-aliased checkbox has to reach the GPU map program too.
/// The #14881 test document: the #14934 canvas and orange rectangle under a black Multiply Drop
/// Shadow (Global Light 120 / 30, Noise 0, Contour Gaussian) with Size, Spread, Distance and
/// Anti-aliased as given.
fn drop_shadow_doc(size: f32, spread: f32, distance: f32, anti_aliased: bool) -> Document {
let mut d = inner_shadow_doc(size, spread, distance, anti_aliased);
if let Some(px) = d.layers.get_mut(1) {
px.effects.items = vec![Effect::DropShadow(Shadow {
common: FxCommon::new(BlendMode::Multiply, 1.0),
color: Color::BLACK,
angle: 120.0,
use_global_light: true,
distance,
spread,
size,
contour: gaussian_contour(),
anti_alias: anti_aliased,
noise: 0.0,
knocks_out: false,
})];
}
d
}
/// The nine R levels outwards from each of the issue's four edges of a 400 x 300 flatten.
fn drop_shadow_ramps(px: &[[f32; 4]]) -> [Vec<f32>; 4] {
let r = |x: i32, y: i32| px[(y * 400 + x) as usize][0] * 255.0;
let line = |first: (i32, i32), step: (i32, i32)| (0..9).map(|k| r(first.0 + k * step.0, first.1 + k * step.1)).collect();
[line((200, 74), (0, -1)), line((99, 150), (-1, 0)), line((200, 225), (0, 1)), line((300, 150), (1, 0))]
}
/// Done when (#14881): CPU and GPU agree with Anti-aliased on and off (whole-texture and paged
/// 256 px compositors), and the GPU's own ramps land on the measured profiles within 3 levels:
/// 98 147 191 223 241 249 252 254 255 at the top and left, 130 177 214 236 247 252 254 254 255 at
/// the bottom and right, while the flag off keeps the measured 114 163 205 231 244 251 253 254 255.
#[test]
fn anti_aliased_drop_shadow_matches_the_cpu_ramps() {
let Some(mut g) = gpu() else { return };
let gpu_on = check_full(&mut g, &drop_shadow_doc(10.0, 0.0, 0.0, true), "#14881 drop shadow, Anti-aliased").whole;
let gpu_off = check_full(&mut g, &drop_shadow_doc(10.0, 0.0, 0.0, false), "#14881 drop shadow, Anti-aliased off").whole;
let tl: &[f32] = &[98.0, 147.0, 191.0, 223.0, 241.0, 249.0, 252.0, 254.0, 255.0];
let br: &[f32] = &[130.0, 177.0, 214.0, 236.0, 247.0, 252.0, 254.0, 254.0, 255.0];
let plain: &[f32] = &[114.0, 163.0, 205.0, 231.0, 244.0, 251.0, 253.0, 254.0, 255.0];
for (px, wants, what) in [(&gpu_on, [tl, tl, br, br], "on"), (&gpu_off, [plain; 4], "off")] {
for ((side, got), want) in ["top", "left", "bottom", "right"].iter().zip(drop_shadow_ramps(px)).zip(wants) {
for (d, (got, want)) in got.iter().zip(want).enumerate() {
assert!((got - want).abs() <= 3.0, "GPU {side} edge, Anti-aliased {what}, {d} px out: {got:.1} vs measured {want}");
}
}
}
}
/// The gate's neighbours (#14881): Size 1, Size 2 at Spread 50 % and every Spread that dilates
/// take no offset, Size 2 / Spread 4 % / Distance 5 at Spread 0 take it; both compositors must
/// agree on each, plain and paged.
#[test]
fn anti_aliased_drop_shadow_gated_neighbours_match_the_cpu() {
let Some(mut g) = gpu() else { return };
let around = Rect::new(80, 55, 320, 245);
for (size, spread, distance, what) in [
(10.0, 0.5, 0.0, "Size 10 Spread 50 %"),
(10.0, 0.05, 0.0, "Size 10 Spread 5 %"),
(2.0, 0.5, 0.0, "Size 2 Spread 50 %"),
(1.0, 0.0, 0.0, "Size 1"),
(2.0, 0.0, 0.0, "Size 2 Spread 0 (offset on)"),
(10.0, 0.04, 0.0, "Size 10 Spread 4 % (dilates nothing, offset on)"),
(10.0, 0.0, 5.0, "Size 10 Spread 0 at Distance 5 (offset on)"),
(10.0, 0.5, 5.0, "Size 10 Spread 50 % at Distance 5 (gated)"),
] {
diff_rect(&mut g, &drop_shadow_doc(size, spread, distance, true), around, &format!("#14881 drop shadow, {what}, Anti-aliased"))
.unwrap_or_else(|e| panic!("{e}"));
}
}
@@ -0,0 +1,64 @@
//! #17312: own synthetic strokes must not leave the old radius-floor dots after Size Fade.
use photocraft_color::PixelFormat;
use photocraft_raster::Surface;
use crate::{BrushSettings, Control, Dynamic, Stroke, StrokePoint, dabs, render_stroke};
fn brush(steps: u32, minimum: f32) -> BrushSettings {
let mut brush = BrushSettings { size: 30.0, spacing: 1.5, seed: 17312, ..BrushSettings::default() };
brush.shape_dynamics.enabled = true;
brush.shape_dynamics.size = Dynamic { control: Control::Fade, fade_steps: steps, minimum, ..Dynamic::default() };
brush
}
fn points() -> Vec<StrokePoint> {
vec![StrokePoint::new(100.0, 100.0, 1.0), StrokePoint::new(700.0, 100.0, 1.0)]
}
#[test]
fn zero_minimum_size_fade_ends_after_the_last_nonzero_dab() {
for count in [5, 10] {
let brush = brush(count, 0.0);
let steps = dabs(&Stroke { brush: brush.clone(), points: points() });
assert_eq!(steps.len(), count as usize);
for (index, dab) in steps.iter().enumerate() {
let diameter = 30.0 * (1.0 - index as f32 / count as f32);
assert!((dab.radius * 2.0 - diameter).abs() < 1e-4);
}
let mut surface = Surface::new(PixelFormat::RGBA32F);
render_stroke(&mut surface, &brush, &points(), None, false, 1.0);
let last = steps.last().unwrap();
assert!(surface.rgba(last.center.x.round() as i32, 100)[3] > 0.0);
// This independent fix retains the baseline pitch; #17311 changes its spacing.
// Pixels beyond the last nonzero dab must stay clear, wherever that dab is placed.
let tail_start = (last.center.x + f64::from(last.radius) + 4.0).ceil() as i32;
for x in tail_start..=700 {
for y in 75..=125 {
assert_eq!(surface.rgba(x, y)[3], 0.0, "unexpected tail at {x},{y}, Fade{count}");
}
}
}
}
#[test]
fn a_positive_minimum_keeps_painting_past_the_fade() {
let steps = dabs(&Stroke { brush: brush(10, 0.3), points: points() });
assert!(steps.len() > 10);
assert!(steps.last().unwrap().center.x > 680.0);
assert!(steps.iter().skip(10).all(|dab| (dab.radius - 4.5).abs() < 1e-4));
}
#[test]
fn zero_pressure_and_roundness_fade_keep_their_existing_floors() {
let pressure = BrushSettings { size: 30.0, pressure_size: true, ..BrushSettings::default() };
let steps = dabs(&Stroke { brush: pressure, points: vec![StrokePoint::new(0.0, 0.0, 0.0), StrokePoint::new(10.0, 0.0, 0.0)] });
assert!(!steps.is_empty());
assert!(steps.iter().all(|dab| dab.radius == 0.5));
let mut roundness = brush(10, 0.0);
roundness.shape_dynamics.roundness = roundness.shape_dynamics.size;
roundness.shape_dynamics.size.control = Control::Off;
let steps = dabs(&Stroke { brush: roundness, points: points() });
assert!(steps.len() > 10);
assert!(steps.iter().skip(10).all(|dab| dab.radius == 15.0 && dab.roundness == 0.01));
}
+4
View File
@@ -642,6 +642,10 @@ impl DabBuilder {
1
};
let base_d = base_diameter(b, s);
// A zero Size Fade ends the stroke; pressure, jitter and other fades keep their floors.
if sd.enabled && sd.size.control == Control::Fade && sd.size.minimum <= 0.0 && base_d <= 0.0 {
return;
}
for _ in 0..count {
let i = self.next_index;
self.next_index += 1;
+3
View File
@@ -417,3 +417,6 @@ mod mixer_load_supply_tests;
#[cfg(test)]
mod smoothing_catch_up_default_tests;
#[cfg(test)]
mod brush_size_fade_end_tests;
@@ -77,7 +77,7 @@ fn shape_layer_filled(tool: Tool, filled: bool) -> Box<PhotocraftApp> {
app.ui.tool_options.shape_fill = filled;
app.ui.tool_options.stroke_width = 2.0;
let rect = craft::behavior::kurbo::Rect::new(40.0, 40.0, 120.0, 120.0);
let shape = if tool == Tool::Triangle { ShapeGeometry::Triangle { rect } } else { ShapeGeometry::Rect { rect, radii: [0.0; 4] } };
let shape = if tool == Tool::Triangle { ShapeGeometry::Triangle { rect, corner_radius: 0.0 } } else { ShapeGeometry::Rect { rect, radii: [0.0; 4] } };
crate::vector_ui::create_geometry(&mut app, &shape, crate::vector_ui::kind_of(tool), None).unwrap();
let st = app.session.active().unwrap();
assert_eq!(st.doc.layer(st.active_layer.unwrap()).unwrap().content.kind_name(), "Shape", "{tool:?} made a shape layer");
@@ -0,0 +1,97 @@
//! #16857: with View > Snap off and Smart Guides on, a Move-tool drag that lines an edge or centre up exactly with
//! another layer's still draws that smart guide, with no pull; Smart Guides off draws nothing, and Snap on keeps
//! snapping.
use craft::behavior::Axis;
use craft::behavior::geometry::SnapLine;
use serde_json::json;
use crate::canvas::{ToolEvent, tool_event, tool_event_response};
use crate::state::Tool;
use crate::{PhotocraftApp, Services};
/// The epic's test document: 1000 x 800, white Background, A red (100,100)-(300,260), C green (400,100)-(500,200)
/// and B blue (600,400)-(750,520) on top and active; the Move tool without Auto-Select, the view fitted (the test
/// window is smaller than the document at 100 %; an exact coincidence does not depend on the zoom).
fn test_document(snap: bool, smart_guides: bool) -> Box<PhotocraftApp> {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Services::default());
app.run("file.new", json!({"width": 1000, "height": 800})).unwrap();
app.sync_views();
for (name, rect, color) in [("A", [100, 100, 200, 160], "#ff0000"), ("C", [400, 100, 100, 100], "#00ff00"), ("B", [600, 400, 150, 120], "#0000ff")] {
app.run("layer.new.layer", json!({"name": name})).unwrap();
app.run("select.rect", json!({"x": rect[0], "y": rect[1], "width": rect[2], "height": rect[3]})).unwrap();
app.run("edit.fill", json!({"color": color})).unwrap();
}
app.run("select.deselect", json!({})).unwrap();
app.ui.tool = Tool::Move;
app.ui.tool_options.move_auto_select = false;
app.ui.extras.snap = snap;
app.ui.view.show.smart_guides = smart_guides;
app
}
/// B's bounds.
fn b_left(app: &PhotocraftApp) -> i32 {
let st = app.session.active().unwrap();
st.doc.layer(st.active_layer.unwrap()).unwrap().surface().unwrap().content_bounds().x0
}
/// Drags B from its centre (675, 460) by `dx` and returns the snap lines of the last move; B's left edge after the
/// release.
fn drag_b(app: &mut PhotocraftApp, dx: f64) -> (Vec<SnapLine>, i32) {
let m = egui::Modifiers::NONE;
tool_event(app, ToolEvent::Down { x: 675.0, y: 460.0, pressure: 1.0 }, m);
tool_event(app, ToolEvent::Move { x: 675.0 + dx / 2.0, y: 460.0, pressure: 1.0 }, m);
let lines = tool_event_response(app, ToolEvent::Move { x: 675.0 + dx, y: 460.0, pressure: 1.0 }, m).snapped;
tool_event(app, ToolEvent::Up { x: 675.0 + dx, y: 460.0 }, m);
(lines, b_left(app))
}
fn vertical_at(lines: &[SnapLine], x: f64) -> bool {
lines.iter().any(|l| l.along == Axis::Y && l.position == x && l.kind.is_smart())
}
#[test]
fn snap_off_draws_a_smart_guide_where_an_edge_lines_up_exactly() {
let mut app = test_document(false, true);
let (lines, left) = drag_b(&mut app, -500.0);
assert_eq!(left, 100, "B's left edge on A's");
assert!(vertical_at(&lines, 100.0), "x=100 (A's left) is drawn: {lines:?}");
}
#[test]
fn snap_off_draws_nothing_and_does_not_pull_four_pixels_away() {
let mut app = test_document(false, true);
let (lines, left) = drag_b(&mut app, -496.0);
assert_eq!(left, 104, "no pull with Snap off");
assert!(!vertical_at(&lines, 100.0), "nothing for A's left 4 px away: {lines:?}");
}
#[test]
fn snap_off_and_smart_guides_off_draw_nothing() {
let mut app = test_document(false, false);
let (lines, left) = drag_b(&mut app, -500.0);
assert_eq!(left, 100);
assert!(lines.is_empty(), "{lines:?}");
}
#[test]
fn snap_off_ctrl_draws_nothing() {
let mut app = test_document(false, true);
let m = egui::Modifiers::NONE;
let ctrl = if cfg!(target_os = "macos") { egui::Modifiers::CTRL } else { egui::Modifiers::COMMAND };
tool_event(&mut app, ToolEvent::Down { x: 675.0, y: 460.0, pressure: 1.0 }, m);
tool_event(&mut app, ToolEvent::Move { x: 425.0, y: 460.0, pressure: 1.0 }, ctrl);
let lines = tool_event_response(&mut app, ToolEvent::Move { x: 175.0, y: 460.0, pressure: 1.0 }, ctrl).snapped;
tool_event(&mut app, ToolEvent::Up { x: 175.0, y: 460.0 }, ctrl);
assert_eq!(b_left(&app), 100);
assert!(lines.is_empty(), "the suspend key hides the lines too: {lines:?}");
}
#[test]
fn snap_on_keeps_snapping_and_its_line() {
let mut app = test_document(true, true);
let (lines, left) = drag_b(&mut app, -496.0);
assert_eq!(left, 100, "Snap on pulls B's left onto A's");
assert!(vertical_at(&lines, 100.0), "{lines:?}");
}
+1 -1
View File
@@ -57,7 +57,7 @@ fn selection_moves(app: &PhotocraftApp) -> bool {
/// group does not snap to its own layers' starting edges), the type layer being edited (a paragraph-box handle drag
/// does not snap to the text it resizes, #6819), the layers of the open Free Transform and the shape layers the shape
/// scale box or a corner widget is pressing.
fn moving_set(app: &PhotocraftApp) -> Vec<LayerId> {
pub(crate) fn moving_set(app: &PhotocraftApp) -> Vec<LayerId> {
let mut set = Vec::new();
if moves_as_move_tool(app)
&& let Some(st) = app.session.active()
+26 -1
View File
@@ -11,7 +11,7 @@ use super::{FamilyTool, ToolScope};
use crate::PhotocraftApp;
use crate::canvas::document_display::CanvasHost;
use crate::state::Tool;
use craft::behavior::geometry::{ConstrainStyle, Directions, MoveGesture};
use craft::behavior::geometry::{ConstrainStyle, Directions, MoveGesture, SnapKinds};
use craft::behavior::kurbo::{self, Point};
use craft::behavior::{CancelReason, Cursor, CursorIcon, PaintedCursor, PointerGlyph};
use craft::keymap::{Chord, Key, Mods};
@@ -267,6 +267,24 @@ fn press_at(app: &mut PhotocraftApp, p: [f64; 2], mods: Mods, style: ConstrainSt
(ToolAction::Claimed, Some(run))
}
/// How far apart two coordinates may be and still line up exactly: the moved box sits on whole pixels.
const EXACT: f64 = 1e-6;
/// With View › Snap off and Smart Guides on, the smart guides of the edges and centres of `moved` (the box at the
/// offset the drag commits) that line up exactly with another layer's, as in the reference application: nothing
/// pulls, the line only marks the coincidence (#16857). Snap on draws its lines through `snap_rect`; Smart Guides off
/// or the suspend key held draws none.
fn exact_lines(app: &PhotocraftApp, cx: &mut ToolContext<'_>, moved: kurbo::Rect, mods: Mods) {
let Some(idx) = app.session.active_index() else { return };
let options = crate::canvas::snap_ui::snap(app, idx).options();
if options.on || !options.smart_guides || craft::ui::canvas::snap_suspended(mods, craft::keymap::Platform::current(), options.suspend, false) {
return;
}
let targets = crate::canvas::snap_ui::targets(app, idx, &crate::canvas::snap_ui::moving_set(app));
let (_, lines) = targets.snap_rect_of(moved, EXACT, SnapKinds::ALL);
cx.add_snapped(lines);
}
/// The drag to `pointer`: the ⇧ lock, the snap of the moving box, the ⌥ duplicate and, while the button is down
/// (`readout`), the readout; the release applies its last sample without one.
/// A pass applies only its own pointer sample, so a second pass of a frame moves the offset to
@@ -293,6 +311,10 @@ fn follow(run: &mut Run, app: &mut PhotocraftApp, pointer: &ToolPointer, cx: &mu
run.offset = (dx, dy);
run.delta = [f64::from(dx), f64::from(dy)];
run.moved = true;
if let Some(b) = run.box_rect {
let moved = kurbo::Rect::new(b[0], b[1], b[2], b[3]) + kurbo::Vec2::new(run.delta[0], run.delta[1]);
exact_lines(app, cx, moved, pointer.mods);
}
if readout {
let x_arrow = if dx < 0 { "←" } else { "→" };
let y_arrow = if dy < 0 { "↑" } else { "↓" };
@@ -466,3 +488,6 @@ impl CanvasTool for MoveRun<'_> {
#[cfg(test)]
#[path = "move_cursor_cross_tests.rs"]
mod move_cursor_cross_tests;
#[cfg(test)]
#[path = "../snap_off_lines_tests.rs"]
mod snap_off_lines_tests;
+2
View File
@@ -797,6 +797,8 @@ mod color_lookup_smart_edit_tests;
pub(crate) mod color_picker_preview;
pub mod color_picker_ui;
pub mod color_range_ui;
#[cfg(test)]
mod color_settings_policy_greying_tests;
pub mod color_table_ui;
pub(crate) mod conditional_mode_change_dialog;
pub mod count_group_name_ui;
@@ -0,0 +1,64 @@
//! #14245: in Color Settings, with the RGB, CMYK and Gray policies all Off, "Ask When Pasting" and "Missing
//! Profiles: Ask When Opening" are greyed with their values kept, and "Profile Mismatches: Ask When Opening" stays
//! enabled; any policy other than Off enables both again.
use craft::ui::dialog::DialogId;
use serde_json::{Value, json};
use crate::PhotocraftApp;
fn open() -> (Box<PhotocraftApp>, DialogId) {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
let id = crate::filter_dialog::open(&mut app, "edit.colorSettings").unwrap();
crate::dialogs::testing::show(&mut app);
(app, id)
}
fn set(app: &mut PhotocraftApp, id: DialogId, key: &str, value: Value) -> Result<(), String> {
let ctx = app.ctx().clone();
let r = app.framework.dialogs.set_json_field(&ctx, id, key, value);
crate::dialogs::testing::show(app);
r
}
fn field(app: &PhotocraftApp, id: DialogId, key: &str) -> Value {
app.framework.dialogs.open_dialogs().into_iter().find(|d| d.id == id).and_then(|d| d.fields).unwrap()[key].clone()
}
/// Whether the row `key` takes input: a disabled row refuses a value.
fn takes_input(app: &mut PhotocraftApp, id: DialogId, key: &str) -> bool {
let before = field(app, id, key);
let flipped = json!(!before.as_bool().unwrap());
let ok = set(app, id, key, flipped).is_ok();
if ok {
set(app, id, key, before).unwrap();
}
ok
}
fn all_off(app: &mut PhotocraftApp, id: DialogId) {
for key in ["policyRgb", "policyCmyk", "policyGray"] {
set(app, id, key, json!("off")).unwrap();
}
}
#[test]
fn all_policies_off_grey_the_paste_and_missing_boxes() {
let (mut app, id) = open();
let (paste, missing) = (field(&app, id, "askOnPaste"), field(&app, id, "askOnMissing"));
all_off(&mut app, id);
assert!(!takes_input(&mut app, id, "askOnPaste"), "Ask When Pasting is greyed");
assert!(!takes_input(&mut app, id, "askOnMissing"), "Missing Profiles is greyed");
assert!(takes_input(&mut app, id, "askOnMismatch"), "Ask When Opening stays enabled");
assert_eq!((field(&app, id, "askOnPaste"), field(&app, id, "askOnMissing")), (paste, missing), "their values are kept");
}
#[test]
fn any_policy_back_on_enables_them_again() {
for (key, value) in [("policyRgb", "preserve"), ("policyCmyk", "convert"), ("policyGray", "preserve")] {
let (mut app, id) = open();
all_off(&mut app, id);
set(&mut app, id, key, json!(value)).unwrap();
assert!(takes_input(&mut app, id, "askOnPaste") && takes_input(&mut app, id, "askOnMissing"), "{key} {value}");
}
}
+15 -4
View File
@@ -541,6 +541,15 @@ fn export_document(doc: &Document, f: &Map<String, Value>, max_side: Option<u32>
session.active().map(|d| (*d.doc).clone()).ok_or_else(|| "export failed".into())
}
/// Materialize the source interpretation only on the copy handed to an encoder.
fn export_for_encoding(doc: &Document, f: &Map<String, Value>, max_side: Option<u32>, source_profile: &Profile) -> Result<Document, String> {
let mut out = export_document(doc, f, max_side, source_profile)?;
if settings(f).embed_icc && out.icc_profile.is_none() && matches!(out.mode, ColorMode::Rgb | ColorMode::Grayscale) {
out.icc_profile = Some(source_profile.to_bytes());
}
Ok(out)
}
/// The exported pixel size: each side scaled and rounded on its own, never below 1 px. The
/// dialog's size label and `export_document` share it so the label names the file's real size.
fn scaled_size(w: f64, h: f64, scale: f64) -> (f64, f64) {
@@ -630,7 +639,7 @@ fn settings(f: &Map<String, Value>) -> ExportSettings {
/// The preview and size estimate share a single reduced document. Resizing every layer twice is
/// especially expensive for layered PSDs, even when the canvas itself is small.
fn preview_proxy(doc: &Document, f: &Map<String, Value>, source_profile: &Profile) -> Result<Document, String> {
export_document(doc, f, Some(if s_fmt(f) == "ico" { 256 } else { 512 }), source_profile)
export_for_encoding(doc, f, Some(if s_fmt(f) == "ico" { 256 } else { 512 }), source_profile)
}
fn scaled_estimate(bytes: usize, doc: &Document, proxy: &Document, f: &Map<String, Value>) -> u64 {
@@ -750,7 +759,7 @@ fn exact_estimate(doc: &Document, f: &Map<String, Value>, source_profile: &Profi
if !px.is_finite() || px > EXACT_ESTIMATE_PX {
return None;
}
let full = export_document(doc, f, None, source_profile).ok()?;
let full = export_for_encoding(doc, f, None, source_profile).ok()?;
let bytes = photocraft_io::export(&full, &format!("estimate.{}", s_fmt(f)), &settings(f).io_options()).ok()?.bytes;
u64::try_from(bytes.len()).ok()
}
@@ -1139,7 +1148,7 @@ fn export_sizes(app: &mut PhotocraftApp, f: &Map<String, Value>, rows: &[ScaleRo
/// Exports `doc` to `path` with the dialog settings `f` (Export As, and its replayed action step).
fn write_export(app: &mut PhotocraftApp, doc: &Document, f: &Map<String, Value>, path: &str, source_profile: &Profile) -> Result<Value, String> {
let out = export_document(doc, f, None, source_profile)?;
let out = export_for_encoding(doc, f, None, source_profile)?;
crate::app::ensure_memory_to_save(&out, path)?;
let export = app.services.export.as_ref().ok_or("no exporter configured")?;
let (bytes, warnings) = export(&out, path, &settings(f))?;
@@ -1214,7 +1223,7 @@ fn write_layer_file(
source_profile: &Profile,
path: &str,
) -> Result<Value, String> {
let out = export_document(doc, f, None, source_profile)?;
let out = export_for_encoding(doc, f, None, source_profile)?;
crate::app::ensure_memory_to_save(&out, path)?;
let export = app.services.export.as_ref().ok_or("no exporter configured")?;
let (bytes, warnings) = export(&out, path, settings)?;
@@ -1317,6 +1326,8 @@ mod preserve_details_tests;
mod srgb_default_tests;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod working_profile_tests;
#[cfg(test)]
mod jpg_progressive_tests;
@@ -0,0 +1,109 @@
//! Export As (#17199): Document Profile describes untagged pixels in the session working space.
use super::replay;
use crate::{PhotocraftApp, Services};
use craft::cms::{Builtin, Intent};
use photocraft_doc::{Color, ColorMode, Document, SampleType, Size};
use serde_json::json;
use std::{cell::RefCell, rc::Rc, sync::Arc};
type Writes = Rc<RefCell<Vec<Vec<u8>>>>;
fn app(mode: ColorMode, tagged: Option<Builtin>) -> (Box<PhotocraftApp>, Writes) {
let writes = Writes::default();
let captured = writes.clone();
let services = Services {
export: Some(Box::new(|doc, path, settings| {
photocraft_io::export(doc, path, &settings.io_options()).map(|result| (result.bytes, result.warnings)).map_err(|error| error.to_string())
})),
write: Some(Box::new(move |_, bytes| {
captured.borrow_mut().push(bytes.to_vec());
Ok(())
})),
..Default::default()
};
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), services);
app.session
.execute(
"edit.colorSettings",
json!({"workingRgb": Builtin::ProPhotoCompat.id(), "workingGray": Builtin::GrayGamma22.id(), "policyRgb": "off", "policyGray": "off"}),
)
.unwrap();
let (left, right) = match mode {
ColorMode::Grayscale => ([0.25, 0.25, 0.25, 1.0], [0.65, 0.65, 0.65, 1.0]),
_ => ([200.0 / 255.0, 30.0 / 255.0, 30.0 / 255.0, 1.0], [30.0 / 255.0, 60.0 / 255.0, 200.0 / 255.0, 1.0]),
};
let mut doc = Document::with_background("working-profile", Size::new(8, 4), mode, SampleType::U8, Color::rgba(left[0], left[1], left[2], left[3]));
let surface = doc.layers[0].surface_mut().unwrap();
surface.fill_rect(photocraft_geom::Rect::from_xywh(4, 0, 4, 4), &photocraft_raster::from_rgba(&surface.format(), right));
doc.icc_profile = tagged.map(|profile| profile.profile().to_bytes());
// Add the exact fixture without an import-policy conversion or mismatch prompt.
app.session.add_document(doc, None);
(app, writes)
}
fn pixels(doc: &Document) -> Vec<[f32; 4]> {
let surface = doc.layers[0].surface().unwrap();
(0..doc.size.height).flat_map(|y| (0..doc.size.width).map(move |x| surface.rgba(x as i32, y as i32))).collect()
}
fn replay_png(app: &mut PhotocraftApp, writes: &Writes, profile: &str, embed: bool) -> Document {
replay(app, &json!({"path": "out.png", "format": "png", "profile": profile, "embedProfile": embed, "transparency": true, "metadata": "none"})).unwrap();
let bytes = writes.borrow_mut().pop().expect("replay writes the encoded PNG");
photocraft_io::import("out.png", &bytes).unwrap().document
}
#[test]
fn document_profile_png_embeds_working_or_tagged_rgb_and_gray_without_changing_pixels() {
for (mode, working, own) in [(ColorMode::Rgb, Builtin::ProPhotoCompat, Builtin::DisplayP3), (ColorMode::Grayscale, Builtin::GrayGamma22, Builtin::SGray)] {
for tagged in [None, Some(own)] {
let (mut app, writes) = app(mode, tagged);
let source = app.session.active().unwrap().doc.clone();
let before = (*source).clone();
assert_eq!(source.icc_profile, tagged.map(|profile| profile.profile().to_bytes()), "the fixture keeps its original tag state");
let samples = pixels(&source);
let expected_icc = tagged.unwrap_or(working).profile().to_bytes();
for embed in [true, false] {
let output = replay_png(&mut app, &writes, "document", embed);
assert_eq!(output.size, source.size);
assert_eq!(output.mode, mode);
assert_eq!(
output.icc_profile.as_ref().map(|icc| icc.as_slice()),
embed.then_some(expected_icc.as_slice()),
"{mode:?} {tagged:?} embed={embed}"
);
assert_eq!(pixels(&output), samples, "Document Profile must tag without converting the samples");
assert!(Arc::ptr_eq(&source, &app.session.active().unwrap().doc), "export must retain the source document");
assert_eq!(pixels(&source), samples, "the source samples stay unchanged");
assert_eq!(*source, before, "export must not change the source ICC or pixels");
}
}
}
}
#[test]
fn explicit_srgb_png_converts_from_working_rgb_and_gray_and_keeps_embedding_optional() {
for (mode, working) in [(ColorMode::Rgb, Builtin::ProPhotoCompat), (ColorMode::Grayscale, Builtin::GrayGamma22)] {
let (mut app, writes) = app(mode, None);
let source = app.session.active().unwrap().doc.clone();
let before = (*source).clone();
assert!(source.icc_profile.is_none(), "the conversion source is actually untagged");
let original_pixels = pixels(&source);
let mut expected = before.clone();
expected.icc_profile = Some(working.profile().to_bytes());
photocraft_engine::color_cmds::convert_document(&mut expected, Builtin::Srgb.profile(), Intent::Perceptual, true).unwrap();
let samples = pixels(&expected);
assert_ne!(samples, original_pixels, "the fixture must distinguish conversion from working-profile tagging");
let srgb = Builtin::Srgb.profile().to_bytes();
for embed in [true, false] {
let output = replay_png(&mut app, &writes, "srgb", embed);
assert_eq!(output.size, source.size);
assert_eq!(output.mode, ColorMode::Rgb);
assert_eq!(output.icc_profile.as_ref().map(|icc| icc.as_slice()), embed.then_some(srgb.as_slice()), "{mode:?} embed={embed}");
assert_eq!(pixels(&output), samples, "explicit sRGB must keep its pixel conversion, not just change the tag");
assert!(Arc::ptr_eq(&source, &app.session.active().unwrap().doc));
assert_eq!(pixels(&source), original_pixels, "the source samples stay unchanged");
assert_eq!(*source, before, "export must not change the source ICC or pixels");
}
}
}
+9 -1
View File
@@ -582,7 +582,8 @@ fn builder(
let key = command.to_owned();
let canvas = app.session.active_index().map(|idx| crate::canvas::document_display::CanvasHost::primary(app, idx).canvas_id());
move |fields: &mut DialogFields| {
let mut dialog = ParamDialog::command(key.clone(), title.clone(), params.clone())
let params = if key == "edit.colorSettings" { color_settings_greying(&params, fields) } else { params.clone() };
let mut dialog = ParamDialog::command(key.clone(), title.clone(), params)
.values(Bind::bound(fields))
.reset_to(reset.clone())
.layout(ParamLayout::Stacked)
@@ -603,6 +604,13 @@ fn builder(
}
}
/// Color Settings with the RGB, CMYK and Gray policies all Off: "Ask When Pasting" and "Missing Profiles" are greyed,
/// their values kept; "Ask When Opening" stays (#14245). A row that may hold no value takes no input.
fn color_settings_greying(params: &[Param], fields: &DialogFields) -> Vec<Param> {
let all_off = ["policyRgb", "policyCmyk", "policyGray"].iter().all(|key| fields.text(key) == Some("off"));
params.iter().map(|p| if all_off && matches!(p.key.as_str(), "askOnPaste" | "askOnMissing") { p.clone().disabled() } else { p.clone() }).collect()
}
/// Opens `command`'s schema dialog using the current settings and editing target. The dialog's key
/// is the command; Match Color captures its destination document and layer.
pub fn open(app: &mut PhotocraftApp, command: &str) -> Result<DialogId, String> {
@@ -769,6 +769,15 @@ pub fn finish_custom_shape(app: &mut PhotocraftApp, rect: [f64; 4], keep: bool,
"shape.presets.place",
json!({"preset": name, "rect": rect, "keepAspect": keep, "fill": fill, "stroke": stroke, "useAlignedRendering": app.ui.tool_options.align_edges}),
);
if let Some(r) = &r {
// Remember which layer this drag placed: the canvas box with its eight handles goes on the
// shape just drawn (#13472). The command's answer names the layer.
let doc = app.session.active().map(|st| st.doc.id);
let layer = r.get("layer").and_then(Value::as_u64);
if let (Some(doc), Some(layer)) = (doc, layer) {
app.ui.presets_ui.placed_custom_shape = Some((doc, layer));
}
}
if r.is_none() && !photocraft_engine::presets::shapes::all_groups(&app.session).iter().any(|g| g.items.iter().any(|s| s.name == name)) {
let template = "No custom shape \"{name}\": pick one in the options bar or Window › Shapes";
app.ui.status = crate::i18n::fmt(tl!(template), &[("name", &name)]);
@@ -37,6 +37,10 @@ pub struct PresetUi {
pub current_tool_only: bool,
/// Custom Shape tool: the shape it draws.
pub custom_shape: String,
/// Custom Shape tool: the layer its last drag placed, in that document; with that tool active the
/// canvas box and its eight handles go on that layer alone (#13472). Never restored into another session.
#[serde(skip)]
pub placed_custom_shape: Option<(photocraft_doc::DocId, u64)>,
/// Folder/group order per panel, by name (#3658), like the dock's `tabOrder` (#2272). A panel
/// with no entry keeps the library's order; unknown names are ignored and groups missing from
/// a list follow it in library order. Saved with the UI state.
+14 -1
View File
@@ -73,7 +73,10 @@ fn salt(app: &PhotocraftApp) -> Option<(DocId, u64, Tool)> {
fn box_shows(app: &PhotocraftApp) -> bool {
app.ui.transform.is_none()
&& app.ui.view.shows(app.ui.view.show.target_path)
&& matches!(app.ui.tool, Tool::PathSelection | Tool::Rectangle | Tool::EllipseShape | Tool::Triangle | Tool::Polygon | Tool::Star | Tool::Line)
&& matches!(
app.ui.tool,
Tool::PathSelection | Tool::Rectangle | Tool::EllipseShape | Tool::Triangle | Tool::Polygon | Tool::Star | Tool::Line | Tool::CustomShape
)
}
/// The shape layers the box or a corner widget is editing: the selected shape layers while one of them holds a press.
@@ -107,6 +110,16 @@ fn selection(app: &PhotocraftApp, flat_ok: bool) -> Option<(Vec<u64>, [f64; 4])>
if ids.is_empty() {
return None;
}
// #13472: with the Custom Shape tool, the box goes on the layer that tool last placed, and on no other
// selection. A placed custom shape is a plain path shape in the document, like a Pen or Make Shape one,
// so those layers keep today's no-box look with this tool (not measured); the placement record lives in
// the Shapes panel's state, set by the tool's own drag.
if app.ui.tool == Tool::CustomShape {
let (doc, placed) = app.ui.presets_ui.placed_custom_shape?;
if st.doc.id != doc || ids != [LayerId(placed)] {
return None;
}
}
let mut layers = Vec::with_capacity(ids.len());
let mut rect: Option<[f64; 4]> = None;
for &id in ids {
+3
View File
@@ -250,6 +250,9 @@ mod rectangle_gear_tests;
#[cfg(test)]
mod rectangle_click_in_shape_tests;
#[cfg(test)]
mod custom_shape_live_box_tests;
#[cfg(test)]
use pen_resume::pen_finish_on_redo;
pub(crate) use pen_resume::{FinishedPen, pen_history_enabled, pen_history_step};
@@ -0,0 +1,389 @@
//! #13472: the Custom Shape tool shows the just-placed shape's bounding box with its eight handles, as the
//! Rectangle tool does (#11107): the press lands on a handle (the tool draws no new shape), a drag scales the
//! shape with one History step named "Transform Path" and no Free Transform session opens, and the box follows
//! the shape the tool just placed. Pen and Make Shape path layers keep today's no-box look with this tool
//! (not measured), and the box over the other tools' selections is the shape controls' own tests' concern.
use craft::draw::ui::VectorMode;
use egui::Modifiers;
use photocraft_doc::LayerContent;
use serde_json::json;
use crate::PhotocraftApp;
use crate::canvas::testing;
use crate::state::Tool;
const NONE: Modifiers = Modifiers::NONE;
/// The box every test places the preset in: a square, so a corner handle (which scales by the drag's
/// projection on the box diagonal) follows the drag exactly.
const SQUARE: [f64; 4] = [400.0, 300.0, 600.0, 500.0];
/// A 1000 × 700 document, the Custom Shape tool active with the built-in Star picked.
fn app() -> Box<PhotocraftApp> {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({"width": 1000, "height": 700, "background": "white"})).unwrap();
app.ui.presets_ui.custom_shape = "Star".into();
app.ui.tool = Tool::CustomShape;
app.run("view.fitOnScreen", json!({})).unwrap();
testing::frame(&mut app);
app
}
/// The Custom Shape tool's own drag from `[x0, y0]` to `[x1, y1]`: it places the preset as a path shape layer
/// and makes it the active layer. The id of that layer comes back.
fn place(app: &mut PhotocraftApp, [x0, y0, x1, y1]: [f64; 4]) -> u64 {
let before = layer_count(app);
testing::press(app, [x0, y0], NONE);
testing::move_to(app, [(x0 + x1) / 2.0, (y0 + y1) / 2.0], NONE);
testing::release(app, [x1, y1], NONE);
let id = app.session.active().unwrap().active_layer.expect("the placed shape is the active layer").0;
assert_eq!(layer_count(app), before + 1, "the drag placed one shape layer");
let st = app.session.active().unwrap();
assert!(matches!(st.doc.layer(photocraft_doc::LayerId(id)).unwrap().content, LayerContent::Shape(_)), "a shape layer");
id
}
fn layer_count(app: &PhotocraftApp) -> usize {
app.session.active().unwrap().doc.layers.len()
}
fn bounds(app: &PhotocraftApp, id: u64) -> (f64, f64, f64, f64) {
let st = app.session.active().unwrap();
let LayerContent::Shape(sh) = &st.doc.layer(photocraft_doc::LayerId(id)).unwrap().content else { panic!("a shape layer") };
sh.path.control_bounds().unwrap()
}
fn near(got: (f64, f64, f64, f64), want: [f64; 4]) {
let got = [got.0, got.1, got.2, got.3];
assert!(got.iter().zip(want).all(|(g, w)| (g - w).abs() <= 1.0), "{got:?} vs {want:?}");
}
fn past(app: &PhotocraftApp) -> usize {
app.session.active().unwrap().history.past_len()
}
fn last_step(app: &PhotocraftApp) -> Option<String> {
app.session.active().unwrap().history.entries().last().cloned()
}
/// A press at `from`, two moves and a release at `to`, as a mouse does it.
fn drag(app: &mut PhotocraftApp, from: [f64; 2], to: [f64; 2]) {
testing::press(app, from, NONE);
testing::move_to(app, [(from[0] + to[0]) / 2.0, (from[1] + to[1]) / 2.0], NONE);
testing::move_to(app, to, NONE);
testing::release(app, to, NONE);
}
/// A handle drag on the handle at `at`: the press lands `press` outside it (3 px, so a corner-radius widget
/// never takes it), and the cursor moves `delta` from there. A corner keeps the grab offset — it moves by the
/// cursor's delta rather than to the cursor (craft-libs `4a52a22e7`, on main since `35b60e9341`) — so the box
/// moves exactly `delta`.
fn drag_handle(app: &mut PhotocraftApp, at: [f64; 2], press: [f64; 2], delta: [f64; 2]) {
drag(app, [at[0] + press[0], at[1] + press[1]], [at[0] + press[0] + delta[0], at[1] + press[1] + delta[1]]);
}
#[test]
fn the_placed_shape_shows_a_box_whose_corner_handle_scales_it_in_one_step() {
let mut app = app();
let id = place(&mut app, SQUARE);
let (x0, y0, x1, y1) = bounds(&app, id);
let steps = past(&app);
let layers = layer_count(&app);
// The bottom-right handle, pressed 3 px outside the box as in the box controls' tests, its cursor moved 30 px in.
// Before the fix the press falls through to the tool: a second Star is placed, not a scale.
drag_handle(&mut app, [x1, y1], [3.0, 3.0], [-30.0, -30.0]);
assert_eq!(past(&app), steps + 1, "one History step");
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "the handle scaled the shape");
assert_eq!(layer_count(&app), layers, "the press took the handle, not the canvas: no new placement");
assert!(app.ui.transform.is_none(), "no Free Transform session opens");
near(bounds(&app, id), [x0, y0, x1 - 30.0, y1 - 30.0]);
}
/// The eight handles, clockwise from the top left: each pressed 3 px outside the box along its outside
/// normal and dragged 10 px in, scaling with one "Transform Path" step and undoing back to the placed box.
const HANDLE_PRESS: [[f64; 2]; 8] = [[-3.0, -3.0], [0.0, -3.0], [3.0, -3.0], [3.0, 0.0], [3.0, 3.0], [0.0, 3.0], [-3.0, 3.0], [-3.0, 0.0]];
const HANDLE_DRAG: [[f64; 2]; 8] = [[10.0, 10.0], [0.0, 10.0], [-10.0, 10.0], [-10.0, 0.0], [-10.0, -10.0], [0.0, -10.0], [10.0, -10.0], [10.0, 0.0]];
#[test]
fn the_box_has_eight_handles_and_every_one_scales_the_shape() {
let mut app = app();
let id = place(&mut app, SQUARE);
let layers = layer_count(&app);
for n in 0..8 {
// The handle that sits on the placed box: corners on both edges, sides at their middle.
let (x0, y0, x1, y1) = bounds(&app, id);
let (bx, by) = ([x0, (x0 + x1) / 2.0, x1, x1, x1, (x0 + x1) / 2.0, x0, x0][n], [y0, y0, y0, (y0 + y1) / 2.0, y1, y1, y1, (y0 + y1) / 2.0][n]);
let steps = past(&app);
if n % 2 == 0 {
drag_handle(&mut app, [bx, by], HANDLE_PRESS[n], HANDLE_DRAG[n]);
} else {
// A side follows the cursor instead of keeping the grab offset, so its cursor ends 10 px in from
// the handle while the press still lands 3 px outside the box.
drag(&mut app, [bx + HANDLE_PRESS[n][0], by + HANDLE_PRESS[n][1]], [bx + HANDLE_DRAG[n][0], by + HANDLE_DRAG[n][1]]);
}
assert_eq!(past(&app), steps + 1, "handle {n}: one History step");
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "handle {n}: the handle scaled");
assert_eq!(layer_count(&app), layers, "handle {n}: no new placement, the press took the handle");
near(bounds(&app, id), expected_box([x0, y0, x1, y1], n));
// Back to the placed box for the next handle.
app.run("edit.undo", json!({})).unwrap();
near(bounds(&app, id), [x0, y0, x1, y1]);
}
}
/// The box after handle `n` (clockwise from the top left) moved 10 px in, on a square box where the
/// corner's projection rule leaves the corner exactly at the drag's delta.
fn expected_box(mut r: [f64; 4], n: usize) -> [f64; 4] {
const IN: f64 = 10.0;
if matches!(n, 0 | 6..=7) {
r[0] += IN;
}
if matches!(n, 2..=4) {
r[2] -= IN;
}
if matches!(n, 0..=2) {
r[1] += IN;
}
if matches!(n, 4..=6) {
r[3] -= IN;
}
r
}
/// The whole app in a kittest window on its own context, as the guide-cursor tests drive one: the input
/// above ran on that same context, and the pointer now reaches the canvas controls through window events.
fn harness(app: Box<PhotocraftApp>) -> egui_kittest::Harness<'static, Box<PhotocraftApp>> {
let ctx = app.ctx().clone();
let mut h = egui_kittest::Harness::builder().with_context(ctx).with_size(egui::vec2(1440.0, 900.0)).with_max_steps(64).build_eframe(move |_cc| app);
h.run_steps(4);
h
}
/// The window's cursor icon after resting the pointer at document point `[x, y]`.
fn hover_cursor(h: &mut egui_kittest::Harness<'static, Box<PhotocraftApp>>, x: f64, y: f64) -> egui::CursorIcon {
let p = testing::to_screen(h.state(), [x, y]);
h.event(egui::Event::PointerMoved(p));
h.run_steps(2);
h.output().platform_output.cursor_icon
}
const HANDLE_ARROW: [egui::CursorIcon; 2] = [egui::CursorIcon::ResizeNwSe, egui::CursorIcon::ResizeNeSw];
/// The Background layer: `layer.select` never leaves the selection empty, so a test leaves the placed shape
/// by selecting this one.
fn background(app: &PhotocraftApp) -> u64 {
app.session.active().unwrap().doc.layers.iter().find(|l| !matches!(l.content, LayerContent::Shape(_))).expect("the Background layer").id.0
}
#[test]
fn the_handle_cursor_shows_on_the_placed_shape_and_clears_on_deselect() {
let mut app = app();
let id = place(&mut app, SQUARE);
let bg = background(&app);
let (_x0, _y0, x1, y1) = bounds(&app, id);
let mut h = harness(app);
// The bottom-right handle, 3 px outside the box: the box's diagonal resize arrow. Before the fix
// there is no box: the tool's own cursor shows.
assert!(HANDLE_ARROW.contains(&hover_cursor(&mut h, x1 + 3.0, y1 + 3.0)), "the box's handle arrow on the handle");
// The placed layer leaves the selection: the box is gone and the spot shows the tool's cursor again.
h.state_mut().run("layer.select", json!({"layer": bg})).unwrap();
h.run_steps(2);
let icon = hover_cursor(&mut h, x1 + 3.0, y1 + 3.0);
assert!(!HANDLE_ARROW.contains(&icon), "left the selection: no handle cursor ({icon:?})");
// Selected again: the handle arrow is back.
h.state_mut().run("layer.select", json!({"layer": id})).unwrap();
h.run_steps(2);
assert!(HANDLE_ARROW.contains(&hover_cursor(&mut h, x1 + 3.0, y1 + 3.0)), "selected again: the handle arrow");
}
#[test]
fn the_box_returns_when_the_just_placed_layer_is_selected_again() {
let mut app = app();
let id = place(&mut app, SQUARE);
let bg = background(&app);
let (x0, y0, x1, y1) = bounds(&app, id);
// Select away from the shape the tool just placed, and back, with no other placement between: its box
// shows, and its handle scales it.
app.run("layer.select", json!({"layer": bg})).unwrap();
testing::frame(&mut app);
app.run("layer.select", json!({"layer": id})).unwrap();
testing::frame(&mut app);
let steps = past(&app);
drag_handle(&mut app, [x1, y1], [3.0, 3.0], [-30.0, -30.0]);
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "selected again: the handle scaled");
assert_eq!(past(&app), steps + 1, "one History step");
near(bounds(&app, id), [x0, y0, x1 - 30.0, y1 - 30.0]);
}
#[test]
fn a_new_shape_moves_the_box_and_the_older_shape_keeps_todays_look() {
let mut app = app();
let _first = place(&mut app, [100.0, 100.0, 300.0, 300.0]);
let second = place(&mut app, [500.0, 300.0, 700.0, 500.0]);
// The just-placed shape shows its box: its handle scales it. Before the fix the press places instead.
let sb = bounds(&app, second);
let steps = past(&app);
let layers = layer_count(&app);
drag_handle(&mut app, [sb.2, sb.3], [3.0, 3.0], [-30.0, -30.0]);
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "the new shape's handle scaled");
assert_eq!(past(&app), steps + 1, "one History step");
assert_eq!(layer_count(&app), layers, "no new placement");
near(bounds(&app, second), [sb.0, sb.1, sb.2 - 30.0, sb.3 - 30.0]);
// A third placement takes the box: its handle scales.
let third = place(&mut app, [100.0, 400.0, 300.0, 600.0]);
let tb = bounds(&app, third);
let steps = past(&app);
drag_handle(&mut app, [tb.2, tb.3], [3.0, 3.0], [-30.0, -30.0]);
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "the newest shape's handle scaled");
assert_eq!(past(&app), steps + 1, "one History step");
// The scaled second shape is an older custom shape layer now: with this tool it keeps today's look —
// its corner is the tool's again, and its bounds stay.
let sb = bounds(&app, second);
let layers = layer_count(&app);
drag(&mut app, [sb.2 + 3.0, sb.3 + 3.0], [sb.2 - 20.0, sb.3 - 20.0]);
assert_eq!(layer_count(&app), layers + 1, "the older shape shows no box: its corner places a new shape");
near(bounds(&app, second), [sb.0, sb.1, sb.2, sb.3]);
}
#[test]
fn undoing_the_placement_ends_the_box() {
let mut app = app();
let id = place(&mut app, SQUARE);
app.run("edit.undo", json!({})).unwrap();
testing::frame(&mut app);
assert!(app.session.active().unwrap().doc.layer(photocraft_doc::LayerId(id)).is_none(), "the layer is gone");
// Redo brings the layer and its record back: the box is active again and the handle scales it.
app.run("edit.redo", json!({})).unwrap();
testing::frame(&mut app);
let (x0, y0, x1, y1) = bounds(&app, id);
let steps = past(&app);
let layers = layer_count(&app);
drag_handle(&mut app, [x1, y1], [3.0, 3.0], [-30.0, -30.0]);
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "redone: the handle scaled");
assert_eq!(past(&app), steps + 1, "one History step");
assert_eq!(layer_count(&app), layers, "no new placement");
near(bounds(&app, id), [x0, y0, x1 - 30.0, y1 - 30.0]);
// Undo the scale and the placement: where the handle was the tool draws again, and no "Transform Path".
app.run("edit.undo", json!({})).unwrap();
app.run("edit.undo", json!({})).unwrap();
testing::frame(&mut app);
let steps = past(&app);
let layers = layer_count(&app);
drag(&mut app, [SQUARE[2] + 3.0, SQUARE[3] + 3.0], [SQUARE[2] - 30.0, SQUARE[3] - 30.0]);
assert_eq!(layer_count(&app), layers + 1, "the press placed a new shape");
assert_ne!(last_step(&app).as_deref(), Some("Transform Path"), "nothing scaled");
assert_eq!(past(&app), steps + 1, "one step: the placement");
}
/// The record names one layer: with the placed shape selected AMONG several layers the box is inactive, and
/// the press at its box's bottom-right corner reaches the tool. Guard test, passes before and after (with
/// this tool no selection showed a box before the fix).
#[test]
fn selecting_the_shape_among_several_keeps_the_box_inactive() {
let mut app = app();
let id = place(&mut app, SQUARE);
let bg = background(&app);
app.run("layer.select", json!({"layer": bg, "mode": "add"})).unwrap();
testing::frame(&mut app);
assert_eq!(app.session.active().unwrap().selected_layers().len(), 2, "both layers are selected");
let (x0, y0, x1, y1) = bounds(&app, id);
let steps = past(&app);
let layers = layer_count(&app);
drag(&mut app, [x1 + 3.0, y1 + 3.0], [x1 - 30.0, y1 - 30.0]);
assert_eq!(layer_count(&app), layers + 1, "the press placed a new shape: the multi-layer selection shows no box");
assert_ne!(last_step(&app).as_deref(), Some("Transform Path"), "nothing scaled");
assert_eq!(past(&app), steps + 1, "one step: the placement");
near(bounds(&app, id), [x0, y0, x1, y1]);
}
/// The placement record is UI state only: it is not saved with the panels, and a restored state carries no
/// record (the rule of `clone_cursor`, same shape of assertion). Does not compile without the change.
#[test]
fn the_placement_record_is_not_saved() {
let mut app = app();
place(&mut app, SQUARE);
assert!(app.ui.presets_ui.placed_custom_shape.is_some(), "the placement left a record");
let saved = serde_json::to_value(&app.ui.presets_ui).unwrap();
assert!(saved.get("placed_custom_shape").is_none(), "the key is not in the saved JSON");
let restored: crate::preset_panels::PresetUi = serde_json::from_value(saved).unwrap();
assert!(restored.placed_custom_shape.is_none(), "the restored state carries no record");
}
/// A Pen path committed to a shape layer (the Pen tool in Shape mode): with the Custom Shape tool it keeps
/// today's look (not measured) — a press at its box's corner draws a new custom shape rather than scaling it.
#[test]
fn a_pen_shape_layer_keeps_todays_look_with_the_custom_shape_tool() {
let mut app = app();
app.ui.tool_options.vector_mode = VectorMode::Shape;
app.ui.tool = Tool::Pen;
for at in [[200.0, 200.0], [300.0, 200.0], [300.0, 300.0]] {
testing::click(&mut app, at, NONE);
}
assert!(crate::vector_ui::pen_commit(&mut app, true), "the Pen path committed");
let id = app.session.active().unwrap().active_layer.expect("the committed layer is active").0;
let LayerContent::Shape(sh) = &app.session.active().unwrap().doc.layer(photocraft_doc::LayerId(id)).unwrap().content else { panic!("a shape layer") };
assert!(sh.live.is_none(), "the Pen layer is a plain path shape");
app.ui.tool = Tool::CustomShape;
testing::frame(&mut app);
assert_no_box_with_custom_shape_tool(&mut app, id);
}
/// Make Shape from the work path: the same pin for the Pen options bar / paths panel route.
#[test]
fn a_make_shape_layer_keeps_todays_look_with_the_custom_shape_tool() {
let mut app = app();
app.ui.tool = Tool::Pen;
for at in [[200.0, 200.0], [300.0, 200.0], [300.0, 300.0]] {
testing::click(&mut app, at, NONE);
}
assert!(crate::vector_ui::make_shape(&mut app).is_ok(), "Make Shape made the layer");
let id = app.session.active().unwrap().active_layer.expect("the new layer is active").0;
app.ui.tool = Tool::CustomShape;
testing::frame(&mut app);
assert_no_box_with_custom_shape_tool(&mut app, id);
}
fn assert_no_box_with_custom_shape_tool(app: &mut PhotocraftApp, id: u64) {
let (x0, y0, x1, y1) = bounds(app, id);
let steps = past(app);
let layers = layer_count(app);
drag(app, [x1 + 3.0, y1 + 3.0], [x1 - 20.0, y1 - 20.0]);
near(bounds(app, id), [x0, y0, x1, y1]);
assert_eq!(past(app), steps + 1, "one step: the placement, not a scale");
assert_eq!(layer_count(app), layers + 1, "the press placed a new shape: the path layer shows no box");
assert_ne!(last_step(app).as_deref(), Some("Transform Path"), "nothing scaled");
}
/// A preset placed without the tool's drag (the Shapes panel's click and drop run `shape.presets.place`
/// themselves): with the Custom Shape tool it keeps today's look — the box follows the tool's own placement,
/// which is what the issue measured.
#[test]
fn a_shape_placed_by_the_panel_keeps_todays_look() {
let mut app = app();
app.run("shape.presets.place", json!({"preset": "Star", "rect": [400.0, 300.0, 200.0, 200.0], "keepAspect": false})).unwrap();
let id = app.session.active().unwrap().active_layer.expect("the placed layer is active").0;
assert!(matches!(app.session.active().unwrap().doc.layer(photocraft_doc::LayerId(id)).unwrap().content, LayerContent::Shape(_)), "a shape layer");
testing::frame(&mut app);
assert_no_box_with_custom_shape_tool(&mut app, id);
}
/// Path Selection and the Rectangle tool take the box over a custom shape layer as they do today: the fix
/// only adds the Custom Shape tool itself.
#[test]
fn the_other_shape_tools_box_the_custom_shape_layer_as_ever() {
for tool in [Tool::PathSelection, Tool::Rectangle] {
let mut app = app();
let id = place(&mut app, SQUARE);
let (x0, y0, x1, y1) = bounds(&app, id);
app.ui.tool = tool;
testing::frame(&mut app);
let steps = past(&app);
let layers = layer_count(&app);
drag_handle(&mut app, [x1, y1], [3.0, 3.0], [-30.0, -30.0]);
assert_eq!(last_step(&app).as_deref(), Some("Transform Path"), "{tool:?}: the handle scaled");
assert_eq!(past(&app), steps + 1, "{tool:?}: one History step");
assert_eq!(layer_count(&app), layers, "{tool:?}: no new layer");
near(bounds(&app, id), [x0, y0, x1 - 30.0, y1 - 30.0]);
}
}
+5 -2
View File
@@ -155,7 +155,7 @@ fn snapped(geometry: &ShapeGeometry, keep_angle: bool, whole: bool) -> Option<Sh
Some(match geometry {
ShapeGeometry::Rect { rect, radii } => ShapeGeometry::Rect { rect: whole_box(rect, whole)?, radii: *radii },
ShapeGeometry::Ellipse { rect } => ShapeGeometry::Ellipse { rect: whole_box(rect, whole)? },
ShapeGeometry::Triangle { rect } => ShapeGeometry::Triangle { rect: whole_box(rect, whole)? },
ShapeGeometry::Triangle { rect, corner_radius } => ShapeGeometry::Triangle { rect: whole_box(rect, whole)?, corner_radius: *corner_radius },
ShapeGeometry::Polygon { rect, sides, star_ratio } => ShapeGeometry::Polygon { rect: whole_box(rect, whole)?, sides: *sides, star_ratio: *star_ratio },
ShapeGeometry::Custom { rect, keep_proportions } => ShapeGeometry::Custom { rect: whole_box(rect, whole)?, keep_proportions: *keep_proportions },
ShapeGeometry::Line { from, to, weight } => {
@@ -210,7 +210,10 @@ fn geometry_params(app: &PhotocraftApp, geometry: &ShapeGeometry, kind: ShapeKin
ShapeGeometry::Rect { rect, .. } => json!({"kind": "rect", "rect": box_of(rect)}),
ShapeGeometry::Ellipse { rect } => json!({"kind": "ellipse", "rect": box_of(rect)}),
// The Triangle tool's triangle fills its box (#13350).
ShapeGeometry::Triangle { rect } => json!({"kind": "triangle", "rect": box_of(rect)}),
ShapeGeometry::Triangle { rect, corner_radius } if *corner_radius > 0.0 => {
json!({"kind": "triangle", "rect": box_of(rect), "cornerRadius": corner_radius})
}
ShapeGeometry::Triangle { rect, .. } => json!({"kind": "triangle", "rect": box_of(rect)}),
ShapeGeometry::Polygon { rect, sides, star_ratio } => {
let mut p = json!({"kind": if kind == ShapeKind::Star { "star" } else { "polygon" }, "rect": box_of(rect), "sides": sides});
if kind == ShapeKind::Star || *star_ratio < 1.0 {
@@ -73,3 +73,18 @@ fn the_dialog_and_the_drag_send_the_same_triangle() {
assert_eq!(a["live"], b["live"]);
assert_eq!(anchors(&a), [(450.0, 300.0), (500.0, 400.0), (400.0, 400.0)]);
}
#[test]
fn a_rounded_triangle_keeps_its_corner_radius() {
use craft::draw::geometry::ShapeGeometry;
use photocraft_doc::{LayerContent, vector::LiveShape};
for radius in [0.0, 12.0] {
let mut app = app(800, 600);
let geometry = ShapeGeometry::Triangle { rect: craft::behavior::kurbo::Rect::new(400.0, 300.0, 600.0, 400.0), corner_radius: radius };
super::shapes::create_geometry(&mut app, &geometry, super::shapes::kind_of(Tool::Triangle), None).unwrap();
let st = app.session.active().unwrap();
let LayerContent::Shape(shape) = &st.doc.layer(st.active_layer.unwrap()).unwrap().content else { panic!("expected a shape layer") };
let Some(LiveShape::Triangle { corner_radius, .. }) = &shape.live else { panic!("expected a live triangle") };
assert_eq!(*corner_radius, radius, "the drag's corner radius reaches the triangle");
}
}