Merge remote-tracking branch 'origin/main' into pr-4304

This commit is contained in:
Dylan M. Taylor committed 2026-11-18 09:15:54 -05:00
commit 2abd2881b9
44 files changed
+1281 -573

No files matched your search

Generated
+50 -28
View File
@@ -1213,7 +1213,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9b
[[package]]
name = "craft-crw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845"
source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e"
dependencies = [
"thiserror 2.0.21",
]
@@ -1314,6 +1314,7 @@ dependencies = [
"craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-video 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"crc32fast",
"exr",
"flate2",
@@ -1375,6 +1376,23 @@ dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "craft-media"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845"
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e"
dependencies = [
"brotli-decompressor 6.0.1",
"chrono",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"quick-xml 0.41.0",
"serde",
]
[[package]]
name = "craft-metadata"
version = "0.1.0"
@@ -1440,12 +1458,12 @@ dependencies = [
[[package]]
name = "craft-raw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845"
source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e"
dependencies = [
"chrono",
"craft-crw",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"jxl-oxide",
"miniz_oxide 0.9.1",
"rayon",
@@ -1455,6 +1473,15 @@ dependencies = [
"zune-jpeg",
]
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e#3a6613f058e355a4fd8d196b2f385260bd4b4a8e"
dependencies = [
"serde",
"thiserror 2.0.21",
]
[[package]]
name = "craft-tiff"
version = "0.1.0"
@@ -1526,12 +1553,21 @@ name = "craft-video"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6#5c91598ccc86537a779f438d520fa6406c26efe6"
dependencies = [
"craft-media",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6)",
"rav1e",
"rayon",
"thiserror 2.0.21",
]
[[package]]
name = "craft-video"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845#c28356d400aed7575b04ec1551b4665107cfe845"
dependencies = [
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"thiserror 2.0.21",
]
[[package]]
name = "craft-window"
version = "0.1.0"
@@ -1546,9 +1582,10 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18#f0f4758c01581d79577b9bf5046c06f4e77b1f18"
source = "git+https://github.com/storytold/craft-libs?rev=2d4b8b8ecd79f87c847961901c40305e7f448d6f#2d4b8b8ecd79f87c847961901c40305e7f448d6f"
dependencies = [
"quick-xml 0.41.0",
"serde",
"thiserror 2.0.21",
]
@@ -3981,10 +4018,10 @@ dependencies = [
"craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f)",
"craft-jxl",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"craft-psd",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-video",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"craft-video 0.1.0 (git+https://github.com/storytold/craft-libs?rev=5c91598ccc86537a779f438d520fa6406c26efe6)",
"dhat",
"jpeg-encoder 0.7.1",
"lightcraft-color",
@@ -4064,7 +4101,7 @@ dependencies = [
"craft-mime",
"craft-pdf",
"craft-plist",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"crc32fast",
"fs4",
"harfrust 0.13.3",
@@ -4221,10 +4258,10 @@ version = "0.21.1"
dependencies = [
"chrono",
"craft-heif",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"craft-psd",
"craft-raw",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"lightcraft-geom",
"proptest",
"serde",
@@ -4281,7 +4318,7 @@ dependencies = [
"craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-jxl",
"craft-raw",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845)",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e)",
"dhat",
"jixel",
"lightcraft-color",
@@ -8646,18 +8683,3 @@ dependencies = [
"syn 3.0.6",
"winnow",
]
[[patch.unused]]
name = "egui_demo_lib"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"
[[patch.unused]]
name = "egui_inspection"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"
[[patch.unused]]
name = "egui_system_font_provider"
version = "0.37.0"
source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"
+5 -8
View File
@@ -16,20 +16,20 @@ craft-pdf-print = { package = "craft-pdf", git = "https://github.com/storytold/c
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["serde"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7" }
# Canon CRW decoder shared with the other Craft apps
craft-crw = { git = "https://github.com/storytold/craft-libs", rev = "94777dcf7f8962476e96b049d08d22e25b9330c2" }
craft-crw = { git = "https://github.com/storytold/craft-libs", rev = "2d4b8b8ecd79f87c847961901c40305e7f448d6f" }
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "7f30d664695cd5ce14fc30659d36c3e32f234247" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18", version = "0.1.0" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f30bb10de10d8436ca9b39fe94e3bb67", features = ["frames"] }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f", default-features = false, features = ["decode", "encode"] }
jixel = "=0.3.4"
# Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949)
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" }
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "3a6613f058e355a4fd8d196b2f385260bd4b4a8e" }
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" }
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "5c91598ccc86537a779f438d520fa6406c26efe6", features = ["av1", "av1-large-encode", "threads"] }
# Isolate AVIF threading from the existing PNG/TIFF/WebP shared revision.
craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", default-features = false, features = ["avif", "threads"] }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "2d4b8b8ecd79f87c847961901c40305e7f448d6f" }
# 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 = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] }
craft-window = { git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["egui"] }
@@ -48,8 +48,8 @@ lightcraft-wincolor = { path = "crates/wincolor" }
lightcraft-color = { path = "crates/color" }
lightcraft-raster = { path = "crates/raster" }
# TIFF/IFD: the shared reader and writer (moved from crates/tiff; craft-libs#783).
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" }
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "3a6613f058e355a4fd8d196b2f385260bd4b4a8e" }
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "3a6613f058e355a4fd8d196b2f385260bd4b4a8e" }
lightcraft-raw = { path = "crates/raw" }
lightcraft-codecs = { path = "crates/codecs" }
lightcraft-meta = { path = "crates/meta" }
@@ -206,8 +206,5 @@ egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc79968
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }
+1 -2
View File
@@ -499,8 +499,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft
Without it LightCraft builds and runs the same, but Chinese and Japanese text have no glyphs. Fonts are never committed to this
repo — what goes there is described in the [craft-fonts README](https://github.com/storytold/craft-fonts#readme).
**Interface language:** **Edit → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Polski, Čeština, Italiano, ქართული, Svenska, Suomi, Bahasa Indonesia, Tiếng Việt) or **Settings → General →
Language**; the choice applies immediately and persists. See [docs/localization.md](docs/localization.md).
**Interface language:** **Settings → General → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Polski, Čeština, Italiano, ქართული, Svenska, Suomi, Bahasa Indonesia, Tiếng Việt); the choice applies immediately and persists. See [docs/localization.md](docs/localization.md).
**Logs:** the desktop app writes its log to standard error and to `logs/lightcraft.log` in its settings folder
(Linux `$XDG_CONFIG_HOME/lightcraft/logs/`, by default `~/.config/lightcraft/logs/`; macOS
+1 -2
View File
@@ -422,8 +422,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft
不指定它时,LightCraft 构建和运行的方式完全相同,只是中文和日文文字没有字形。字体从不提交到
本仓库。
**界面语言:** **编辑 → 语言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français)或 **设置 → 一般 →
语言**;选择立即生效并会保留。见 [docs/localization.md](docs/localization.md)。
**界面语言:** **设置 → 一般 → 语言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français);选择立即生效并会保留。见 [docs/localization.md](docs/localization.md)。
**日志:** 桌面应用把日志写到标准错误,以及设置文件夹里的 `logs/lightcraft.log`
(Linux `$XDG_CONFIG_HOME/lightcraft/logs/`,默认 `~/.config/lightcraft/logs/`;macOS
+1 -2
View File
@@ -447,8 +447,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft
不指定它時,LightCraft 一樣能建置與執行,只是中文和日文文字沒有字形。字型從不提交到
本儲存庫,字型的收錄規範記載在該儲存庫:見 [craft-fonts README](https://github.com/storytold/craft-fonts#readme)。
**介面語言:** **編輯 → 語言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français、Українська、Čeština、ქართული)或 **設定 → 一般 →
語言**;選擇後立即生效並會保留。詳見 [docs/localization.md](docs/localization.md)。
**介面語言:** **設定 → 一般 → 語言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français、Українська、Čeština、ქართული);選擇後立即生效並會保留。詳見 [docs/localization.md](docs/localization.md)。
**記錄檔:** 桌面應用程式會把記錄檔寫到標準錯誤輸出,以及設定資料夾裡的 `logs/lightcraft.log`
(Linux `$XDG_CONFIG_HOME/lightcraft/logs/`,預設為 `~/.config/lightcraft/logs/`;macOS
+1
View File
@@ -45,6 +45,7 @@ covers a whole directory), or if a licence file referenced in the Licence column
| `crates/ui-egui/locales/sv.json`, `crates/ui-egui/locales/sv-formats.json` | Swedish interface catalogs | LightCraft contributors | original work: clean-room Swedish translations of English source phrases | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-10-15 | none |
| `crates/ui-egui/locales/fi.json`, `crates/ui-egui/locales/fi-formats.json` | Finnish interface catalogs | @roopeg with Claude Code (AI-assisted; native-speaker review by @roopeg) | original work: translations of the English source phrases, using common Finnish photo-editing vocabulary; no external translation material | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-10-17 | count-neutral labels for Finnish partitive agreement, Finnish dates and times (`20.9.2026`, `16:04`), reviewed placeholders |
| `crates/ui-egui/locales/vi.json`, `crates/ui-egui/locales/vi-formats.json` | Vietnamese interface catalogs | @duydev (DUY Tran Nhat) with AI assistance (Cursor) | original work: translations of English source phrases; no external translation material | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-10-13 | plural-neutral counts, Vietnamese dates and weekdays, reviewed placeholders |
| `crates/codecs/tests/fixtures/quad-444-gbr-lossless.avif` | AVIF decode test fixture: a 33×17 lossless 8-bit 4:4:4 AV1 still with the identity (GBR) matrix, four flat colour quadrants | craft-libs contributors | [craft-libs 59b4f1e8 `crates/image-codecs/tests/fixtures/avif/quad-444-gbr-lossless.avif`](https://github.com/storytold/craft-libs/blob/59b4f1e8c2909fbcacba491b219958f4a976d5f8/crates/image-codecs/tests/fixtures/avif/quad-444-gbr-lossless.avif) (storytold/craft-libs#1601), encoded with FFmpeg/libaom from a synthetic RGB source as described in `crates/codecs/tests/fixtures/avif-README.md`; no third-party image content | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | 2026-11-16 | none: byte-identical copy of the craft-libs fixture; decodes exactly to its four-colour `quad-source.rgb` |
Notes
- egui's default fonts (Hack, Ubuntu Light, Noto Emoji, egui-icons and emoji-icon-font) come from the
+2 -2
View File
@@ -40,8 +40,8 @@ jxl = ["dep:craft-jxl"]
# distributors choose it at build time (HEVC patents are a distributor's call, same policy as
# PhotoCraft); `cargo xtask ci` clippies and tests it (`--features heif`), releases don't ship it yet.
heif = ["dep:craft-heif"]
## AVIF/AV1 encoding via craft-image-codecs / craft-video (pure Rust). Native targets only; a no-op on wasm32.
avif = ["dep:craft-video", "dep:craft-avif-encode"]
## AVIF/AV1 encoding via craft-image-codecs / craft-video (pure Rust), plus the shared AVIF decoder. Native targets only; a no-op on wasm32.
avif = ["dep:craft-video", "dep:craft-avif-encode", "craft-image-codecs/avif-decode"]
[dev-dependencies]
# tests record why they skip (`cargo xtask ci` lists the skips)
+2 -2
View File
@@ -114,8 +114,8 @@ Run `cargo test --release -p lightcraft-codecs --test it bench:: -- --ignored --
## Gaps / limitations
- **AVIF decode**: no permissively licensed, pure-Rust AV1 decoder exists today (dav1d is C;
rav1d-safe is AGPL). Files are sniffed and rejected with `Error::Unsupported`.
- **AVIF decode** uses the shared pure-Rust AV1 decoder on native builds with the `avif` feature.
Animated AVIF, depth and gain-map auxiliary images, and progressive/layered images are unsupported.
- **HEIC** needs the `heif` feature (off by default: HEVC patents are the distributor's call);
without it, `Error::Unsupported` says the build has no HEIC support. 4:2:2 and 4:4:4 HEIF
(Canon/Sony HIF) is refused: heic-rs 0.1.1 loses sync on those bitstreams.
+262
View File
@@ -0,0 +1,262 @@
//! AVIF container and pixel decoding via shared image codecs.
use crate::{DecodeOptions, Decoded, Error, Format, Result};
const F: Format = Format::Avif;
#[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))]
pub(crate) fn header(_: &[u8]) -> Result<(u32, u32, u16)> {
Err(Error::Unsupported(F, "AVIF decoding is not included in this build"))
}
#[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))]
pub(crate) fn decode(_: &[u8], _: &DecodeOptions) -> Result<Decoded> {
Err(Error::Unsupported(F, "AVIF decoding is not included in this build"))
}
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
fn err(e: craft_image_codecs::CodecError) -> Error {
match e {
craft_image_codecs::CodecError::LimitExceeded(_) => Error::TooLarge(0, 0),
craft_image_codecs::CodecError::Unsupported { .. } => Error::Unsupported(F, "unsupported AVIF"),
other => Error::Malformed(F, other.to_string()),
}
}
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
pub(crate) fn header(bytes: &[u8]) -> Result<(u32, u32, u16)> {
let (w, h) = craft_image_codecs::probe_size(bytes).map_err(err)?;
Ok((w, h, 1))
}
// Match craft-video's AV1 store: 128-sample superblocks plus 160 samples of edge padding,
// three u16 planes, eight references, the current picture, and at most eight workers + two
// in-flight pictures. Keep a hard byte ceiling even when the caller permits many pixels.
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
fn picture_store_budget(width: u32, height: u32) -> u64 {
let padded = |n: u32| u64::from(n).div_ceil(128) * 128 + 160;
padded(width).saturating_mul(padded(height)).saturating_mul(PICTURE_STORE_BYTES_PER_SAMPLE).min(PICTURE_STORE_CAP)
}
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
const PICTURE_STORE_BYTES_PER_SAMPLE: u64 = 3 * 2 * (8 + 1 + 8 + 2);
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
const PICTURE_STORE_CAP: u64 = if cfg!(target_pointer_width = "64") { 4 << 30 } else { 1 << 30 };
/// The picture-store budget for any stored AV1 canvas the pixel limit admits. `probe_size` reports
/// the size after `clap`, but the decoder builds the stored (pre-crop) canvas, which the shared
/// decoder checks against `max_pixels` from its `ispe` before decoding. A canvas of at most
/// `max_pixels` samples with AV1's 65,536-sample edge limit has `w + h <= min(max_pixels + 1, 2^17)`,
/// and each padded edge is under `edge + 288`, so the padded area is below
/// `max_pixels + 288 * (w + h) + 288^2`.
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
fn stored_picture_store_budget(max_pixels: u64) -> u64 {
let edge_sum = max_pixels.saturating_add(1).min(2 * 65_536);
let area = max_pixels.saturating_add(edge_sum.saturating_mul(288)).saturating_add(288 * 288);
area.saturating_mul(PICTURE_STORE_BYTES_PER_SAMPLE).min(PICTURE_STORE_CAP)
}
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
pub(crate) fn decode(bytes: &[u8], opts: &DecodeOptions) -> Result<Decoded> {
use crate::convert::{Buf, Meta, Model, Raw, check_size, finish};
use crate::space::SourceSpace;
let (w, h, _) = header(bytes)?;
check_size(F, w as u64, h as u64, opts)?;
let options = craft_image_codecs::DecodeOptions {
limits: craft_image_codecs::Limits {
max_width: u32::MAX,
max_height: u32::MAX,
max_pixels: opts.max_pixels,
max_alloc: stored_picture_store_budget(opts.max_pixels).max(picture_store_budget(w, h)),
},
keep_orientation: false,
};
let (img, bit_depth) = craft_image_codecs::decode_avif_with_depth(bytes, &options).map_err(err)?;
let (w, h) = (img.width(), img.height());
check_size(F, w as u64, h as u64, opts)?;
let buf = match img.sample_type() {
craft_image_codecs::SampleType::U8 => Buf::U8(img.as_u8().ok_or_else(|| Error::Malformed(F, "expected 8-bit samples".into()))?.to_vec()),
craft_image_codecs::SampleType::U16 => Buf::U16(img.to_u16_samples().ok_or_else(|| Error::Malformed(F, "expected 16-bit samples".into()))?),
craft_image_codecs::SampleType::F32 => Buf::F32(img.to_f32_samples().ok_or_else(|| Error::Malformed(F, "expected float samples".into()))?),
_ => return Err(Error::Unsupported(F, "unsupported AVIF sample type")),
};
let hint = img.cicp.and_then(|c| SourceSpace::from_cicp(c.primaries, c.transfer));
let raw = Raw { width: w as usize, height: h as usize, model: Model::Rgb, alpha: img.layout().has_alpha(), premultiplied: false, buf, bit_depth };
let meta = Meta { icc: img.icc, exif: img.meta.exif, xmp: img.meta.xmp, orientation: Some(1), hint, ..Default::default() };
let mut decoded = finish(F, raw, meta, (w, h), opts)?;
// AV1 stores integer samples even when HDR transfer decoding produces linear float pixels.
decoded.float = false;
Ok(decoded)
}
#[cfg(all(test, feature = "avif", not(target_arch = "wasm32")))]
mod tests {
use super::*;
const FIXTURE: &[u8] = include_bytes!("../tests/fixtures/quad-444-gbr-lossless.avif");
#[test]
fn production_entrypoints_decode_avif_and_enforce_pixel_budget() {
assert!(F.can_decode());
assert_eq!(crate::sniff(FIXTURE), Some(F));
let header = crate::read_header(FIXTURE).unwrap();
assert_eq!((header.width, header.height, header.orientation), (33, 17, 1));
let decoded = crate::decode(FIXTURE, DecodeOptions::default()).unwrap();
assert_eq!((decoded.source_width, decoded.source_height), (33, 17));
assert_eq!(decoded.bit_depth, 8);
let exact = DecodeOptions { max_pixels: 33 * 17, ..DecodeOptions::default() };
let decoded = crate::decode(FIXTURE, exact).unwrap();
assert_eq!((decoded.source_width, decoded.source_height), (33, 17));
assert!(!decoded.float);
let opts = DecodeOptions { max_pixels: 33 * 17 - 1, ..DecodeOptions::default() };
assert!(matches!(crate::decode(FIXTURE, opts), Err(Error::TooLarge(..))));
}
#[test]
fn picture_store_budget_accounts_for_padding_and_stays_bounded() {
assert_eq!(picture_store_budget(33, 17), 288 * 288 * 6 * 19);
let cap = if cfg!(target_pointer_width = "64") { 4 << 30 } else { 1 << 30 };
assert_eq!(picture_store_budget(u32::MAX, u32::MAX), cap);
assert_eq!(stored_picture_store_budget(u64::MAX), cap);
// Every canvas the pixel limit admits fits, whatever its shape.
for max_pixels in [1u64, 561, 512 * 512, 1 << 20] {
let budget = stored_picture_store_budget(max_pixels);
for (w, h) in [(1, max_pixels), (max_pixels, 1), (max_pixels.isqrt(), max_pixels.isqrt())] {
let (w, h) = (w.min(65_536) as u32, h.min(65_536) as u32);
assert!(picture_store_budget(w, h) <= budget, "{w}x{h} under {max_pixels}");
}
}
}
/// `probe_size` reports the `clap`-cropped size; the decoder still builds the stored canvas.
/// A 512×512 picture cropped to 16×16 must decode with the default options and at a pixel
/// limit that covers the stored canvas, and fail as too large below it.
#[test]
fn cropped_avif_decodes_with_a_budget_for_its_stored_canvas() {
let pixels = [90u8, 140, 200].repeat(512 * 512);
let image = crate::encode::EncodeImage::new(512, 512, 3, crate::encode::Samples::U8(&pixels));
let full = crate::encode::encode_avif(&image, 60, 10, &crate::encode::EncodeMeta::default()).unwrap();
let cropped = with_clap(&full, 16, 16);
assert_eq!(crate::read_header(&cropped).map(|h| (h.width, h.height)).unwrap(), (16, 16));
// The old budget, sized from the cropped 16×16, is below what the stored canvas needs.
assert!(picture_store_budget(16, 16) < picture_store_budget(512, 512));
let decoded = crate::decode(&cropped, DecodeOptions::default()).unwrap();
assert_eq!((decoded.source_width, decoded.source_height), (16, 16));
let exact = DecodeOptions { max_pixels: 512 * 512, ..DecodeOptions::default() };
assert_eq!(crate::decode(&cropped, exact).map(|d| (d.source_width, d.source_height)).unwrap(), (16, 16));
let below = DecodeOptions { max_pixels: 512 * 512 - 1, ..DecodeOptions::default() };
assert!(crate::decode(&cropped, below).is_err());
}
fn be32(b: &[u8], at: usize) -> usize {
u32::from_be_bytes([b[at], b[at + 1], b[at + 2], b[at + 3]]) as usize
}
fn put32(b: &mut [u8], at: usize, v: usize) {
b[at..at + 4].copy_from_slice(&(v as u32).to_be_bytes());
}
/// Child boxes of `b[start..end]`: (offset, size, type).
fn boxes(b: &[u8], start: usize, end: usize) -> Vec<(usize, usize, [u8; 4])> {
let mut out = Vec::new();
let mut at = start;
while at + 8 <= end {
let size = be32(b, at);
out.push((at, size, [b[at + 4], b[at + 5], b[at + 6], b[at + 7]]));
at += size;
}
out
}
fn find(b: &[u8], start: usize, end: usize, kind: &[u8; 4]) -> (usize, usize) {
boxes(b, start, end).into_iter().find(|x| &x.2 == kind).map_or((0, 0), |x| (x.0, x.1))
}
/// Adds a centred `clap` of `w × h` to the primary item of a single-item AVIF from the encoder,
/// fixing the enclosing box sizes and the `iloc` offsets into `mdat`.
fn with_clap(file: &[u8], w: u32, h: u32) -> Vec<u8> {
let mut b = file.to_vec();
let (meta, meta_size) = find(&b, 0, b.len(), b"meta");
let children = meta + 12;
let (iprp, _) = find(&b, children, meta + meta_size, b"iprp");
let (ipco, ipco_size) = find(&b, iprp + 8, iprp + be32(&b, iprp), b"ipco");
let index = boxes(&b, ipco + 8, ipco + ipco_size).len() + 1;
let mut clap = Vec::new();
for v in [w, 1, h, 1, 0, 1, 0, 1] {
clap.extend_from_slice(&v.to_be_bytes());
}
let clap = [&((8 + clap.len()) as u32).to_be_bytes()[..], b"clap", &clap].concat();
// ipma: version/flags, entry count, then item id, association count, associations.
let (ipma, ipma_size) = find(&b, iprp + 8, iprp + be32(&b, iprp), b"ipma");
let (version, flags) = (b[ipma + 8], b[ipma + 11]);
assert_eq!(be32(&b, ipma + 12), 1, "one item");
let id_len = if version < 1 { 2 } else { 4 };
let count_at = ipma + 16 + id_len;
let wide = flags & 1 == 1;
let assoc_end = count_at + 1 + b[count_at] as usize * if wide { 2 } else { 1 };
assert_eq!(assoc_end, ipma + ipma_size);
let assoc: Vec<u8> = if wide { (0x8000u16 | index as u16).to_be_bytes().to_vec() } else { vec![0x80 | index as u8] };
let grow = clap.len() + assoc.len();
b[count_at] += 1;
b.splice(assoc_end..assoc_end, assoc.iter().copied());
b.splice(ipco + ipco_size..ipco + ipco_size, clap.iter().copied());
// ipco precedes ipma inside iprp, so ipma moved by the clap's length.
for (at, by) in [(meta, grow), (iprp, grow), (ipco, clap.len()), (ipma + clap.len(), assoc.len())] {
let size = be32(&b, at);
put32(&mut b, at, size + by);
}
// iloc (version 0 or 1): shift every absolute extent offset by the growth of `meta`.
let (iloc, _) = find(&b, children, meta + be32(&b, meta), b"iloc");
let v = b[iloc + 8];
let (offset_size, length_size, base_size) = ((b[iloc + 12] >> 4) as usize, (b[iloc + 12] & 15) as usize, (b[iloc + 13] >> 4) as usize);
let index_size = if v >= 1 { (b[iloc + 13] & 15) as usize } else { 0 };
let mut at = iloc + 14;
let items = if v < 2 {
let n = u16::from_be_bytes([b[at], b[at + 1]]) as usize;
at += 2;
n
} else {
let n = be32(&b, at);
at += 4;
n
};
let read = |b: &[u8], at: usize, n: usize| b[at..at + n].iter().fold(0usize, |acc, &x| acc << 8 | x as usize);
let write = |b: &mut [u8], at: usize, n: usize, v: usize| {
for i in 0..n {
b[at + i] = (v >> (8 * (n - 1 - i))) as u8;
}
};
for _ in 0..items {
at += if v < 2 { 2 } else { 4 };
if v >= 1 {
at += 2;
}
at += 2;
let base = read(&b, at, base_size);
if base_size > 0 && base > 0 {
write(&mut b, at, base_size, base + grow);
}
at += base_size;
let extents = u16::from_be_bytes([b[at], b[at + 1]]) as usize;
at += 2;
for _ in 0..extents {
at += index_size;
let off = read(&b, at, offset_size);
if base == 0 && offset_size > 0 {
write(&mut b, at, offset_size, off + grow);
}
at += offset_size + length_size;
}
}
b
}
#[test]
fn hdr_avif_round_trips_highlights_through_public_decoder() {
let pixels = vec![2.0f32; 16 * 16 * 3];
for transfer in [crate::encode::HdrTransfer::Pq, crate::encode::HdrTransfer::Hlg] {
let bytes = crate::encode::encode_avif_hdr(16, 16, &pixels, 95, 10, &crate::encode::EncodeMeta::default(), transfer).unwrap();
let decoded = crate::decode(&bytes, DecodeOptions::default()).unwrap();
assert_eq!(decoded.bit_depth, 10);
assert!(!decoded.float, "AV1 source samples are integer for {transfer:?}");
assert!(decoded.image.data.iter().any(|pixel| pixel[0] > 1.0), "HDR highlights were lost");
}
}
#[test]
fn avif_alpha_survives_public_round_trip() {
let pixels = [200u8, 100, 50, 96].repeat(16 * 16);
let image = crate::encode::EncodeImage::new(16, 16, 4, crate::encode::Samples::U8(&pixels));
let bytes = crate::encode::encode_avif(&image, 95, 10, &crate::encode::EncodeMeta::default()).unwrap();
let decoded = crate::decode(&bytes, DecodeOptions::default()).unwrap();
let alpha = decoded.alpha.expect("alpha plane");
assert!((alpha.data[0] - 96.0 / 255.0).abs() < 0.04);
}
}
+4 -1
View File
@@ -18,6 +18,7 @@
#![forbid(unsafe_code)]
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
mod avif_decode;
mod convert;
pub mod display;
pub mod encode;
@@ -221,6 +222,7 @@ pub fn read_header_unguarded(bytes: &[u8], format: Format) -> Result<Header> {
Format::WebP => webp::header(bytes)?,
Format::Psd => psd::header(bytes)?,
Format::Heif => heif::header(bytes)?,
Format::Avif => avif_decode::header(bytes)?,
Format::Gif | Format::Bmp => other::header(bytes, format)?,
// rare here (or, for JPEG XL, without a header reader yet): a small decode, as before
_ => {
@@ -257,7 +259,8 @@ pub fn decode_unguarded(bytes: &[u8], format: Format, opts: &DecodeOptions) -> R
#[cfg(not(feature = "jxl"))]
Format::Jxl => unsupported(),
Format::Heif => heif::decode(bytes, &opts),
Format::Avif | Format::RawTiffLike | Format::RawOther => unsupported(),
Format::Avif => avif_decode::decode(bytes, &opts),
Format::RawTiffLike | Format::RawOther => unsupported(),
}
}
+2 -1
View File
@@ -76,7 +76,8 @@ impl Format {
Format::Jxl => Some("built without the `jxl` feature"),
#[cfg(not(feature = "heif"))]
Format::Heif => Some(crate::heif::NOT_IN_BUILD),
Format::Avif => Some("no pure-Rust, permissively licensed AV1 decoder yet"),
#[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))]
Format::Avif => Some("AVIF decoding is not included in this build"),
Format::RawTiffLike | Format::RawOther => Some("camera raw: decode with lightcraft-raw"),
_ => None,
}
+12
View File
@@ -0,0 +1,12 @@
# AVIF decode fixtures
Small AVIF files from an independent encoder (libaom through FFmpeg 7.1), for `src/codecs/avif_decode.rs`.
- `quad-source.rgb`: the 33×17 source, raw RGB24 four-colour quadrants (red, green, blue, near-white).
- `quad-420-bt709.avif`: 8-bit 4:2:0, limited range, BT.709 matrix, odd size (FFmpeg leaves the primaries and transfer unspecified):
`ffmpeg -f rawvideo -pix_fmt rgb24 -s 33x17 -i quad-source.rgb -c:v libaom-av1 -crf 12 -still-picture 1 -pix_fmt yuv420p -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 -color_range tv quad-420-bt709.avif`
- `quad-420-bt709.dav1d.yuv`: that file's AV1 picture as libdav1d decodes it, planar 8-bit 4:2:0 (Y, then Cb, then Cr):
`ffmpeg -c:v libdav1d -i quad-420-bt709.avif -f rawvideo -pix_fmt yuv420p quad-420-bt709.dav1d.yuv`
- `quad-444-gbr-lossless.avif`: lossless 8-bit 4:4:4 with the identity (GBR) matrix, full range:
`ffmpeg -f rawvideo -pix_fmt rgb24 -s 33x17 -i quad-source.rgb -c:v libaom-av1 -crf 0 -still-picture 1 -pix_fmt gbrp -colorspace rgb -color_range pc quad-444-gbr-lossless.avif`.
It decodes to `quad-source.rgb` exactly.
Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

+2 -1
View File
@@ -664,7 +664,8 @@ fn avif_encode_native() {
if cfg!(feature = "avif") {
let b = r.unwrap();
assert_eq!(sniff(&b), Some(Format::Avif));
assert!(matches!(decode(&b, DecodeOptions::default()), Err(Error::Unsupported(Format::Avif, _))));
let decoded = decode(&b, DecodeOptions::default()).unwrap();
assert_eq!((decoded.source_width, decoded.source_height), (64, 48));
} else {
assert!(r.is_err());
}
+2 -2
View File
@@ -16,8 +16,8 @@ pub const EXTENSIONS: &[&str] = &[
"srw", "psd", "psb", "jxl", "gif", "bmp",
// Decoded when built with the codecs' `heif` feature; otherwise the import reports them as
// failed with the reason ("HEIC/HEIF support isn't included in this build").
"heic", "heif", "avif", // no AV1 decoder yet: reported as failed, like a HEIC without the feature
"iiq", "crw", "mrw", "x3f", "kdc", "mos", "erf", "3fr", "fff", "mef",
"heic", "heif", // AVIF decoding is available in native builds with the codecs' `avif` feature.
"avif", "iiq", "crw", "mrw", "x3f", "kdc", "mos", "erf", "3fr", "fff", "mef",
];
pub fn is_supported(path: &Path) -> bool {
+6 -4
View File
@@ -129,11 +129,13 @@ fn golden(process: ProcessVersion) -> u64 {
h
}
/// V1 and V2 render byte for byte as they do on main before adding process V3. The hashes were captured
/// on main at e2d18b5fb (before `light_v3`) on macOS aarch64, where they are checked: the renders
/// V1 and V2 render byte for byte as they do on main after #3509's intentional 8-bit dithering.
/// The hashes were captured on unchanged main at a220d3eb on macOS aarch64, where they are checked: the renders
/// call the platform's `powf` / `exp2` / `log2`, whose last bit can differ on other platforms, so
/// elsewhere the test only prints them. Before updating them during a rebase, run this exact fixture
/// on main and confirm that both hashes match. This PR must not change V1 or V2 rendering.
/// on main and confirm that both hashes match. Restoring only the pre-#3509 quantizer on that
/// baseline reproduces the original e2d18b5fb goldens (0x5bf0a7c8579f3f34, 0x87a3598c15979e4d)
/// exactly: only the intended final quantization change requires this baseline update.
#[test]
fn v1_and_v2_render_as_before_v3() {
let got = [golden(ProcessVersion(1)), golden(ProcessVersion(2))];
@@ -143,7 +145,7 @@ fn v1_and_v2_render_as_before_v3() {
}
}
const GOLDEN: [u64; 2] = [0x5bf0_a7c8_579f_3f34, 0x87a3_598c_1597_9e4d];
const GOLDEN: [u64; 2] = [0x4830_59a3_ad92_326c, 0x9653_aed0_ea32_aff3];
fn on(process: Process, s: &DevelopSettings) -> DevelopSettings {
DevelopSettings { process: process.version(), ..s.clone() }
+151 -389
View File
@@ -1,11 +1,9 @@
//! Writing DNG files from a [`RawImage`] (uncompressed or lossless-JPEG tiles), used for DNG export and for
//! bit-exact decoder round-trip tests. The raw image is stored in IFD0 (allowed by DNG 1.7 §"File Structure").
use crate::{RawData, RawError, RawImage, Result, ljpeg, opcodes};
use craft_tiff::tags::{self as t, compression, photometric};
use craft_tiff::writer::{rational, srational};
use craft_tiff::{ByteOrder, IfdBuilder, ImageData, TiffWriter, Value};
use lightcraft_color::Mat3;
use crate::{RawData, RawError, RawImage, Result};
pub use craft_raw::dngwrite::f32_to_f16;
use craft_tiff::ByteOrder;
use rayon::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -90,69 +88,6 @@ fn lossy_source(raw: &RawImage, long_edge: Option<u32>) -> Result<RawImage> {
/// the sensor origin instead of the ActiveArea (the reader keeps their original reading).
pub const SOFTWARE: &str = "LightCraft DNG 2";
/// zlib level of Deflate tiles. On a 67 MP focus-stack merge (half floats) level 6 took 7× as long as level 1
/// (3.9 s vs 0.55 s on 4 cores) to save 3 % of the file (266 vs 275 MB); 5–12 % on raw and rendered DNGs.
const DEFLATE_LEVEL: u8 = 1;
/// Largest Deflate tile edge the writer pads to (`tile` is caller-supplied in [`DngCompression::Deflate`]):
/// square-tile buffers grow with the square, so an unclamped edge lets a request pad a tiny valid image into
/// a multi-gigabyte buffer and billions of edge-replicate iterations. 2048² samples (≤ 24 MB of f32) is far
/// above the 256 default and every real tile this writer makes.
const MAX_DEFLATE_TILE: u32 = 2048;
/// `tile` aligned down to a multiple of 16 and clamped to [`MAX_DEFLATE_TILE`].
fn deflate_tile(tile: u32) -> usize {
(tile.max(16) & !15).min(MAX_DEFLATE_TILE) as usize
}
/// IEEE 754 binary32 → binary16 (round to nearest even; overflow → ±inf, NaN kept).
pub fn f32_to_f16(v: f32) -> u16 {
let b = v.to_bits();
let sign = ((b >> 16) & 0x8000) as u16;
let exp = ((b >> 23) & 0xff) as i32;
let man = b & 0x7f_ffff;
if exp == 0xff {
return sign | 0x7c00 | if man != 0 { 0x200 } else { 0 };
}
let e = exp - 127 + 15;
if e >= 0x1f {
return sign | 0x7c00;
}
if e <= 0 {
if e < -10 {
return sign;
}
// subnormal half
let m = man | 0x80_0000;
let shift = (14 - e) as u32;
let half = m >> shift;
let rem = m & ((1 << shift) - 1);
let mid = 1 << (shift - 1);
let r = if rem > mid || (rem == mid && half & 1 == 1) { half + 1 } else { half };
return sign | r as u16;
}
let half = ((e as u32) << 10) | (man >> 13);
let rem = man & 0x1fff;
let r = if rem > 0x1000 || (rem == 0x1000 && half & 1 == 1) { half + 1 } else { half };
sign | r as u16
}
/// Apply the floating-point predictor (inverse of `unpack::undo_float_predictor`) to one row of
/// `n` big-endian samples of `bytes_per` bytes: split into byte planes (most significant first), then
/// byte-difference with `stride` samples.
fn float_predict(row: &[u8], n: usize, bytes_per: usize, stride: usize) -> Vec<u8> {
let mut planes = vec![0u8; row.len()];
for i in 0..n {
for b in 0..bytes_per {
planes[b * n + i] = row[i * bytes_per + b];
}
}
for i in (stride..planes.len()).rev() {
planes[i] = planes[i].wrapping_sub(planes[i - stride]);
}
planes
}
#[derive(Clone, Debug, PartialEq)]
pub struct DngWriteOptions {
pub compression: DngCompression,
@@ -167,15 +102,7 @@ impl Default for DngWriteOptions {
}
}
fn srat_mat(m: &Mat3) -> Value {
Value::SRational(m.0.iter().flatten().map(|&v| srational(v)).collect())
}
fn rat_vec(v: &[f64]) -> Value {
Value::Rational(v.iter().map(|&x| rational(x)).collect())
}
/// Serialise `raw` as a DNG.
/// Serialise `raw` as a DNG. Development, resize and the lossy transfer curve remain application policy.
pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result<Vec<u8>> {
raw.validate()?;
let lossy;
@@ -186,320 +113,66 @@ pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result<Vec<u8>> {
}
_ => raw,
};
let (w, h, cpp) = (raw.width, raw.height, raw.cpp);
let mut ifd = IfdBuilder::new();
ifd.set(t::NEW_SUBFILE_TYPE, Value::Long(vec![0]));
ifd.set(t::IMAGE_WIDTH, Value::Long(vec![w as u32]));
ifd.set(t::IMAGE_LENGTH, Value::Long(vec![h as u32]));
ifd.set(t::SAMPLES_PER_PIXEL, Value::Short(vec![cpp as u16]));
ifd.set(t::PLANAR_CONFIGURATION, Value::Short(vec![1]));
ifd.set(t::PHOTOMETRIC, Value::Short(vec![if raw.cfa.is_some() { photometric::CFA } else { photometric::LINEAR_RAW }]));
ifd.set(t::DNG_VERSION, Value::Byte(vec![1, 4, 0, 0]));
ifd.set(t::DNG_BACKWARD_VERSION, Value::Byte(vec![1, 3, 0, 0]));
let make = raw.metadata.make.as_deref().unwrap_or_default();
let model = raw.metadata.model.as_deref().unwrap_or_default();
if !make.is_empty() {
ifd.set(t::MAKE, Value::Ascii(make.to_owned()));
}
if !model.is_empty() {
ifd.set(t::MODEL, Value::Ascii(model.to_owned()));
}
let model_includes_make = !make.is_empty()
&& model.get(..make.len()).is_some_and(|prefix| prefix.eq_ignore_ascii_case(make))
&& model.get(make.len()..).is_some_and(|suffix| suffix.chars().next().is_none_or(|c| !c.is_alphanumeric() && c != '_'));
let unique = if model_includes_make || make.is_empty() {
model.to_owned()
} else if model.is_empty() {
make.to_owned()
} else {
format!("{make} {model}")
let color = &raw.color;
let matrices = |pair: &[Option<lightcraft_color::Mat3>; 2]| pair.map(|matrix| matrix.map(|m| m.0));
let cinema = craft_raw::CinemaTags::default();
let view = craft_raw::dngwrite::DngImage {
width: raw.width,
height: raw.height,
cpp: raw.cpp,
data: &raw.data,
cfa: raw.cfa.as_ref(),
bits: raw.bits,
linearized: raw.linearized,
// The app model stores already-decoded samples, not a pending source table.
linearization_table: None,
black: &raw.black,
white: &raw.white,
active_area: raw.active_area,
crop: raw.crop,
orientation: craft_raw::Orientation::from_exif(raw.orientation.to_exif()),
color: craft_raw::dngwrite::DngColor {
illuminant: color.illuminant,
color_matrix: matrices(&color.color_matrix),
forward_matrix: matrices(&color.forward_matrix),
camera_calibration: matrices(&color.camera_calibration),
analog_balance: color.analog_balance,
as_shot_neutral: color.as_shot_neutral,
as_shot_white_xy: color.as_shot_white_xy.map(|xy| [xy.x, xy.y]),
baseline_exposure: color.baseline_exposure,
baseline_sharpness: color.baseline_sharpness,
profile: &color.profile,
},
wb_multipliers: raw.wb_multipliers,
opcodes: &raw.opcodes,
make: raw.metadata.make.as_deref(),
model: raw.metadata.model.as_deref(),
unique_model: None,
cinema: &cinema,
unknown_camera_model: Some("LightCraft"),
};
ifd.set(t::UNIQUE_CAMERA_MODEL, Value::Ascii(if unique.is_empty() { "LightCraft".into() } else { unique }));
ifd.set(t::ORIENTATION, Value::Short(vec![raw.orientation.to_exif()]));
ifd.set(t::SOFTWARE, Value::Ascii(SOFTWARE.into()));
let xmp = opts.xmp.clone().unwrap_or_else(|| lightcraft_meta::write_xmp(&raw.metadata, None));
ifd.set(t::XMP, Value::Byte(xmp.into_bytes()));
if let Some(cfa) = &raw.cfa {
ifd.set(t::CFA_REPEAT_PATTERN_DIM, Value::Short(vec![cfa.height as u16, cfa.width as u16]));
// the tag is anchored at the ActiveArea's top-left, `raw.cfa` at the sensor origin
let a = raw.active_area;
ifd.set(t::CFA_PATTERN_EP, Value::Byte(cfa.shifted(a.x, a.y).pattern));
ifd.set(t::CFA_PLANE_COLOR, Value::Byte(vec![0, 1, 2]));
ifd.set(t::CFA_LAYOUT, Value::Short(vec![1]));
}
let b = &raw.black;
ifd.set(t::BLACK_LEVEL_REPEAT_DIM, Value::Short(vec![b.repeat_rows as u16, b.repeat_cols as u16]));
let mut bl: Vec<f64> = b.values.iter().map(|&v| v as f64).collect();
if bl.len() == 1 && cpp > 1 {
bl = vec![bl[0]; cpp];
}
ifd.set(t::BLACK_LEVEL, rat_vec(&bl));
if !b.delta_h.is_empty() {
ifd.set(t::BLACK_LEVEL_DELTA_H, Value::SRational(b.delta_h.iter().map(|&v| srational(v as f64)).collect()));
}
if !b.delta_v.is_empty() {
ifd.set(t::BLACK_LEVEL_DELTA_V, Value::SRational(b.delta_v.iter().map(|&v| srational(v as f64)).collect()));
}
let white: Vec<u32> = (0..cpp).map(|s| raw.white_at(s).round().clamp(0.0, u32::MAX as f32) as u32).collect();
if matches!(raw.data, RawData::F32(_)) {
ifd.set(t::WHITE_LEVEL, rat_vec(&(0..cpp).map(|s| raw.white_at(s) as f64).collect::<Vec<_>>()));
} else {
ifd.set(t::WHITE_LEVEL, Value::Long(white));
}
let a = raw.active_area;
ifd.set(t::ACTIVE_AREA, Value::Long(vec![a.y as u32, a.x as u32, (a.y + a.height) as u32, (a.x + a.width) as u32]));
ifd.set(t::DEFAULT_CROP_ORIGIN, Value::Long(vec![raw.crop.x as u32, raw.crop.y as u32]));
ifd.set(t::DEFAULT_CROP_SIZE, Value::Long(vec![raw.crop.width as u32, raw.crop.height as u32]));
let c = &raw.color;
for (i, tag) in [t::CALIBRATION_ILLUMINANT_1, t::CALIBRATION_ILLUMINANT_2].into_iter().enumerate() {
if c.color_matrix[i].is_some() {
ifd.set(tag, Value::Short(vec![c.illuminant[i]]));
}
}
for (pair, tags) in [
(&c.color_matrix, [t::COLOR_MATRIX_1, t::COLOR_MATRIX_2]),
(&c.forward_matrix, [t::FORWARD_MATRIX_1, t::FORWARD_MATRIX_2]),
(&c.camera_calibration, [t::CAMERA_CALIBRATION_1, t::CAMERA_CALIBRATION_2]),
] {
for i in 0..2 {
if let Some(m) = &pair[i] {
ifd.set(tags[i], srat_mat(m));
}
}
}
if let Some(v) = c.analog_balance {
ifd.set(t::ANALOG_BALANCE, rat_vec(&v));
}
if let Some(v) = c.as_shot_neutral {
ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&v));
} else if let Some(xy) = c.as_shot_white_xy {
ifd.set(t::AS_SHOT_WHITE_XY, rat_vec(&[xy.x, xy.y]));
} else if let Some(m) = raw.wb_multipliers.filter(|m| m.iter().all(|v| *v > 0.0 && v.is_finite())) {
// vendor raws (NEF, ARW…) carry white balance as multipliers: the DNG neutral is their reciprocal
ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&m.map(|v| 1.0 / v as f64)));
}
ifd.set(t::BASELINE_EXPOSURE, Value::SRational(vec![srational(c.baseline_exposure)]));
if let Some(v) = c.baseline_sharpness {
ifd.set(t::BASELINE_SHARPNESS, rat_vec(&[v]));
}
write_profile_tags(&mut ifd, raw, opts.order);
write_opcode_tags(&mut ifd, raw);
match (&raw.data, opts.compression) {
(RawData::F32(v), DngCompression::Deflate { tile, half }) => {
let tile = deflate_tile(tile);
let bp = if half { 2 } else { 4 };
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![(bp * 8) as u16; cpp]));
ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE]));
ifd.set(t::PREDICTOR, Value::Short(vec![3]));
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * cpp * bp);
let mut row = Vec::with_capacity(tile * cpp * bp);
for y in 0..tile {
let sy = (ty + y).min(h - 1);
row.clear();
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..cpp {
let f = v[(sy * w + sx) * cpp + s];
if half {
row.extend_from_slice(&f32_to_f16(f).to_be_bytes());
} else {
row.extend_from_slice(&f.to_bits().to_be_bytes());
}
}
}
buf.extend_from_slice(&float_predict(&row, tile * cpp, bp, cpp));
}
miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL)
})
.collect();
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
(RawData::F32(v), _) => {
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![32; cpp]));
ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE]));
let mut bytes = Vec::with_capacity(v.len() * 4);
for &x in v {
let mut tmp = Vec::with_capacity(4);
opts.order.put_u32(&mut tmp, x.to_bits());
bytes.extend_from_slice(&tmp);
}
ifd.set_image(ImageData::Strips { rows_per_strip: h as u32, strips: vec![bytes] });
}
(RawData::U16(v), DngCompression::LossyJpeg { tile, quality, .. }) => {
// `lossy_source` made 3-sample 8-bit codes
let tile = (tile.clamp(16, 4096) & !15) as usize;
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![8; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::LOSSY_JPEG]));
ifd.set(t::LINEARIZATION_TABLE, Value::Short(lossy_linearization()));
let quality = quality.clamp(1, 100);
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * 3);
for y in 0..tile {
let sy = (ty + y).min(h - 1);
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..3 {
buf.push(v.get((sy * w + sx) * cpp + s.min(cpp - 1)).map_or(0, |&c| c.min(255) as u8));
}
}
}
let ic_img = craft_image_codecs::Image::from_u8(tile as u32, tile as u32, craft_image_codecs::ChannelLayout::Rgb, buf)
.map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))?;
let opts = craft_image_codecs::EncodeOptions { jpeg_quality: quality, ..Default::default() };
craft_image_codecs::encode(&ic_img, craft_image_codecs::Format::Jpeg, &opts)
.map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))
})
.collect::<Result<_>>()?;
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
(RawData::U16(v), _) => {
let maxv = v.iter().copied().max().unwrap_or(0);
let bits = (16 - maxv.leading_zeros()).max(raw.bits.min(16)).max(2) as u8;
ifd.set(
t::BITS_PER_SAMPLE,
Value::Short(vec![if matches!(opts.compression, DngCompression::Uncompressed) { 16 } else { bits as u16 }; cpp]),
);
match opts.compression {
DngCompression::Uncompressed => {
ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE]));
let rows = (65536 / (w * cpp * 2)).clamp(1, h);
let strips = v
.chunks(rows * w * cpp)
.map(|s| {
let mut b = Vec::with_capacity(s.len() * 2);
s.iter().for_each(|&x| opts.order.put_u16(&mut b, x));
b
})
.collect();
ifd.set_image(ImageData::Strips { rows_per_strip: rows as u32, strips });
}
DngCompression::Deflate { tile, .. } => {
let tile = deflate_tile(tile);
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![16; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE]));
ifd.set(t::PREDICTOR, Value::Short(vec![2]));
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * cpp * 2);
let mut row = vec![0u16; tile * cpp];
for y in 0..tile {
let sy = (ty + y).min(h - 1);
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..cpp {
row[x * cpp + s] = v[(sy * w + sx) * cpp + s];
}
}
for i in (cpp..row.len()).rev() {
row[i] = row[i].wrapping_sub(row[i - cpp]);
}
row.iter().for_each(|&x| opts.order.put_u16(&mut buf, x));
}
miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL)
})
.collect();
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
// handled above (the data is converted first)
DngCompression::LossyJpeg { .. } => return Err(RawError::Unsupported("lossy DNG of this data".into())),
DngCompression::Lj92 { tile } => {
let tile = (tile.max(2) & !1) as usize;
if tile > 65534 {
return Err(RawError::Limit("tile too large"));
}
ifd.set(t::COMPRESSION, Value::Short(vec![compression::JPEG]));
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * cpp);
for y in 0..tile {
let sy = (ty + y).min(h - 1);
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..cpp {
buf.push(v[(sy * w + sx) * cpp + s]);
}
}
}
if cpp == 1 {
ljpeg::encode(&buf, tile / 2, tile, 2, bits, 1, 0)
} else {
ljpeg::encode(&buf, tile, tile, cpp, bits, 1, 0)
}
})
.collect();
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
}
}
}
Ok(TiffWriter::new(opts.order, false).write(&[ifd])?)
}
fn write_profile_tags(ifd: &mut IfdBuilder, raw: &RawImage, order: ByteOrder) {
// The source's own profile look travels with its data (conversions, smart previews, merges).
let profile = &raw.color.profile;
let table_tags = |ifd: &mut IfdBuilder, table: &crate::profile::HsvTable, dims: u16, enc: u16| {
ifd.set(dims, Value::Long(vec![table.hue_divisions as u32, table.sat_divisions as u32, table.val_divisions as u32]));
if table.srgb_value {
ifd.set(enc, Value::Long(vec![1]));
}
let compression = match opts.compression {
DngCompression::Uncompressed | DngCompression::LossyJpeg { .. } => craft_raw::DngCompression::Uncompressed,
DngCompression::Lj92 { tile } => craft_raw::DngCompression::Lj92 { tile },
DngCompression::Deflate { tile, half } => craft_raw::DngCompression::Deflate { tile, half },
};
let flat = |table: &crate::profile::HsvTable| Value::Float(table.data.iter().flatten().copied().collect());
match &profile.hue_sat_map {
[Some(first), second] => {
table_tags(ifd, first, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING);
ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(first));
if let Some(second) = second.as_ref().filter(|second| {
(second.hue_divisions, second.sat_divisions, second.val_divisions) == (first.hue_divisions, first.sat_divisions, first.val_divisions)
}) {
ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_2, flat(second));
}
}
[None, Some(table)] => {
table_tags(ifd, table, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING);
ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(table));
}
[None, None] => {}
}
if let Some(table) = &profile.look_table {
table_tags(ifd, table, t::PROFILE_LOOK_TABLE_DIMS, t::PROFILE_LOOK_TABLE_ENCODING);
ifd.set(t::PROFILE_LOOK_TABLE_DATA, flat(table));
}
if let Some(curve) = &profile.tone_curve {
ifd.set(t::PROFILE_TONE_CURVE, Value::Float(curve.points.iter().flatten().copied().collect()));
}
if let Some(map) = &profile.gain_table_map {
// The raw IFD is IFD 0 here, where both tag versions are valid.
let (version2, bytes) = map.to_bytes(order);
ifd.set(if version2 { t::PROFILE_GAIN_TABLE_MAP_2 } else { t::PROFILE_GAIN_TABLE_MAP }, Value::Undefined(bytes));
}
}
fn write_opcode_tags(ifd: &mut IfdBuilder, raw: &RawImage) {
for (list, tag) in [(&raw.opcodes.list1, t::OPCODE_LIST_1), (&raw.opcodes.list2, t::OPCODE_LIST_2), (&raw.opcodes.list3, t::OPCODE_LIST_3)] {
if !list.is_empty() {
ifd.set(tag, Value::Undefined(opcodes::write_list(list)));
}
let options = craft_raw::DngWriteOptions {
compression,
order: opts.order,
software: SOFTWARE.into(),
xmp: Some(opts.xmp.clone().unwrap_or_else(|| lightcraft_meta::write_xmp(&raw.metadata, None))),
};
if let DngCompression::LossyJpeg { tile, quality, .. } = opts.compression {
let encode = |pixels: Vec<u8>, tile: u32, quality: u8| {
let image = craft_image_codecs::Image::from_u8(tile, tile, craft_image_codecs::ChannelLayout::Rgb, pixels)
.map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))?;
let options = craft_image_codecs::EncodeOptions { jpeg_quality: quality, ..Default::default() };
craft_image_codecs::encode(&image, craft_image_codecs::Format::Jpeg, &options)
.map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))
};
craft_raw::dngwrite::write_lossy_dng(&view, &options, tile, quality, &lossy_linearization(), &encode)
} else {
craft_raw::dngwrite::write_dng_view(&view, &options)
}
}
@@ -566,11 +239,100 @@ pub fn write_rendered_dng(
write_dng(&raw, &DngWriteOptions { compression: DngCompression::Deflate { tile: 256, half: true }, order, xmp })
}
#[cfg(test)]
#[path = "dngwrite_legacy_tests.rs"]
mod legacy;
#[cfg(test)]
mod tests {
use super::*;
use crate::{BlackLevel, OpcodeLists, RawData, RawFormat, RawImage, Rect};
use crate::{Cfa, ColorData, Mat3, Orientation};
fn mosaic(w: usize, h: usize) -> RawImage {
let data: Vec<u16> = (0..w * h)
.map(|i| {
let (x, y) = (i % w, i / w);
let c = (x % 2) + (y % 2);
(64.0 + 3000.0 * (x as f32 / w as f32) * (0.5 + c as f32 * 0.25) + 500.0 * (y as f32 / h as f32)) as u16
})
.collect();
let color = ColorData {
illuminant: [21, 0],
color_matrix: [Some(Mat3([[0.7, -0.1, -0.05], [-0.4, 1.2, 0.2], [-0.1, 0.2, 0.6]])), None],
as_shot_neutral: Some([0.5, 1.0, 0.7]),
..Default::default()
};
RawImage {
format: RawFormat::Dng,
width: w,
height: h,
cpp: 1,
data: RawData::U16(data),
cfa: Some(Cfa::bayer("RGGB").unwrap()),
bits: 12,
black: BlackLevel::uniform(64.0),
white: vec![4095.0],
active_area: Rect::new(0, 0, w, h),
crop: Rect::new(2, 2, w - 4, h - 4),
orientation: Orientation::Rotate90,
color,
wb_multipliers: None,
linearized: false,
opcodes: OpcodeLists::default(),
metadata: Default::default(),
lens_metadata: Default::default(),
pixel_aspect: 1.0,
}
}
#[test]
fn shared_writer_matches_frozen_application_bytes() {
let raw = mosaic(20, 16);
for order in [ByteOrder::Little, ByteOrder::Big] {
for (compression, old_compression) in [
(DngCompression::Uncompressed, legacy::DngCompression::Uncompressed),
(DngCompression::Lj92 { tile: 16 }, legacy::DngCompression::Lj92 { tile: 16 }),
(DngCompression::Deflate { tile: 16, half: false }, legacy::DngCompression::Deflate { tile: 16, half: false }),
(
DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: None },
legacy::DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: None },
),
(
DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: Some(8) },
legacy::DngCompression::LossyJpeg { tile: 32, quality: 95, long_edge: Some(8) },
),
] {
let options = DngWriteOptions { compression, order, xmp: None };
let old_options = legacy::DngWriteOptions { compression: old_compression, order, xmp: None };
assert_eq!(write_dng(&raw, &options).unwrap(), legacy::write_dng(&raw, &old_options).unwrap());
}
}
let rgb = (0..4 * 4 * 3).map(|i| i as f32 / 48.0).collect::<Vec<_>>();
let metadata = lightcraft_meta::Metadata::default();
for space in [lightcraft_color::SRGB, lightcraft_color::PROPHOTO] {
assert_eq!(
write_rendered_dng(4, 4, &rgb, &space, &metadata, None).unwrap(),
legacy::write_rendered_dng(4, 4, &rgb, &space, &metadata, None).unwrap()
);
}
}
#[test]
fn shared_writer_keeps_padding_and_declared_white_guards() {
let mut raw = mosaic(20, 16);
raw.white = vec![65535.0];
let options = DngWriteOptions { compression: DngCompression::Lj92 { tile: 16 }, ..Default::default() };
let bytes = write_dng(&raw, &options).unwrap();
let tiff = craft_tiff::Tiff::parse(&bytes).unwrap();
assert_eq!(tiff.all_ifds()[0].u16(craft_tiff::tags::BITS_PER_SAMPLE), Some(16));
for tile in [2050, u32::MAX] {
let options = DngWriteOptions { compression: DngCompression::Lj92 { tile }, ..Default::default() };
assert!(matches!(write_dng(&raw, &options), Err(RawError::Limit("tile too large"))));
}
}
/// Deflate tiles of `tile × tile` pad into a square buffer that grows with the square: a
/// caller-supplied edge of `u32::MAX` would make the writer pad an 8 × 8 image into billions of
/// edge-replicate iterations and a multi-gigabyte buffer. The clamp keeps the bounded shape — same
+571
View File
@@ -0,0 +1,571 @@
// Frozen application writer, test-only parity oracle.
// Source: storytold/lightcraft main 2dcb258ba40738230a07484a95eb27dc84ed66fe.
// Original DNG writer: Brandon Thomas (05450c79); lossy/rendered paths:
// Andrew Frahn (cc3eb1c8, a1d7c488), with subsequent fixes preserved verbatim.
//! Writing DNG files from a [`RawImage`] (uncompressed or lossless-JPEG tiles), used for DNG export and for
//! bit-exact decoder round-trip tests. The raw image is stored in IFD0 (allowed by DNG 1.7 §"File Structure").
use crate::{RawData, RawError, RawImage, Result, ljpeg, opcodes};
use craft_tiff::tags::{self as t, compression, photometric};
use craft_tiff::writer::{rational, srational};
use craft_tiff::{ByteOrder, IfdBuilder, ImageData, TiffWriter, Value};
use lightcraft_color::Mat3;
use rayon::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DngCompression {
Uncompressed,
/// Lossless JPEG tiles of `tile × tile` pixels (`tile` even). CFA tiles are encoded as two interleaved
/// components of half the tile width (the common DNG layout), linear data with one component per sample.
Lj92 {
tile: u32,
},
/// Deflate (zlib) tiles of `tile × tile` pixels. Floating-point data is stored as 16-bit (`half`) or
/// 32-bit IEEE floats with the floating-point predictor (TIFF predictor 3, Adobe TIFF Technical Note 3);
/// integer data with horizontal differencing (predictor 2). 16-bit float is what HDR merges usually use.
Deflate {
tile: u32,
half: bool,
},
/// Lossy DNG (DNG 1.4 compression 34892): the raw data demosaiced to linear camera RGB (with `OpcodeList3`
/// and the default crop applied), scaled down to at most `long_edge` pixels on the long side when given,
/// then stored as 8-bit baseline JPEG tiles of `tile × tile` pixels at JPEG `quality` (1–100). The 8-bit
/// codes follow a 1/2.2 power curve that a `LinearizationTable` maps back to linear 16-bit values, so
/// shadows keep their precision. The colour tags (matrices, white balance, profile look) are kept.
LossyJpeg {
tile: u32,
quality: u8,
long_edge: Option<u32>,
},
}
/// Gamma of the 8-bit codes in a lossy DNG (own choice: perceptually close to even steps, like sRGB).
const LOSSY_GAMMA: f64 = 2.2;
/// The 256-entry `LinearizationTable` of a lossy DNG: code → linear 16-bit value.
fn lossy_linearization() -> Vec<u16> {
(0..256u32).map(|i| ((i as f64 / 255.0).powf(LOSSY_GAMMA) * 65535.0).round() as u16).collect()
}
/// The image a lossy DNG stores: `raw` developed to linear camera RGB (white = 1), scaled to fit
/// `long_edge`, as 8-bit codes (in `u16` samples) on the [`LOSSY_GAMMA`] curve, with the levels,
/// geometry and opcode lists that this data needs (black 0, white 65535 after linearization).
fn lossy_source(raw: &RawImage, long_edge: Option<u32>) -> Result<RawImage> {
let mut rgb = raw.develop(crate::Method::Ahd)?;
if let Some(edge) = long_edge.map(|e| e.max(1) as usize) {
let long = rgb.width.max(rgb.height);
if long > edge {
let s = edge as f64 / long as f64;
let w = ((rgb.width as f64 * s).round() as usize).max(1);
let h = ((rgb.height as f64 * s).round() as usize).max(1);
rgb = lightcraft_raster::resample::resize(&rgb, w, h, lightcraft_raster::resample::Filter::Lanczos3);
}
}
let (w, h) = (rgb.width, rgb.height);
if w == 0 || h == 0 {
return Err(RawError::Corrupt("empty image".into()));
}
let inv = 1.0 / LOSSY_GAMMA as f32;
let data: Vec<u16> = rgb
.data
.par_iter()
.flat_map_iter(|px| px.map(|v| if v.is_finite() { (v.clamp(0.0, 1.0).powf(inv) * 255.0).round() as u16 } else { 0 }))
.collect();
let full = crate::Rect::new(0, 0, w, h);
Ok(RawImage {
width: w,
height: h,
cpp: 3,
data: RawData::U16(data),
cfa: None,
bits: 8,
black: crate::BlackLevel::default(),
white: vec![65535.0],
active_area: full,
crop: full,
// list 1 and 2 work on the undemosaiced data and list 3 is applied by `develop`
opcodes: crate::OpcodeLists::default(),
linearized: true,
..raw.clone()
})
}
/// Software tag of the DNGs this writer makes. A bare "LightCraft" marks older files, whose CFAPattern is anchored at
/// the sensor origin instead of the ActiveArea (the reader keeps their original reading).
pub const SOFTWARE: &str = "LightCraft DNG 2";
/// zlib level of Deflate tiles. On a 67 MP focus-stack merge (half floats) level 6 took 7× as long as level 1
/// (3.9 s vs 0.55 s on 4 cores) to save 3 % of the file (266 vs 275 MB); 5–12 % on raw and rendered DNGs.
const DEFLATE_LEVEL: u8 = 1;
/// Largest Deflate tile edge the writer pads to (`tile` is caller-supplied in [`DngCompression::Deflate`]):
/// square-tile buffers grow with the square, so an unclamped edge lets a request pad a tiny valid image into
/// a multi-gigabyte buffer and billions of edge-replicate iterations. 2048² samples (≤ 24 MB of f32) is far
/// above the 256 default and every real tile this writer makes.
const MAX_DEFLATE_TILE: u32 = 2048;
/// `tile` aligned down to a multiple of 16 and clamped to [`MAX_DEFLATE_TILE`].
fn deflate_tile(tile: u32) -> usize {
(tile.max(16) & !15).min(MAX_DEFLATE_TILE) as usize
}
/// IEEE 754 binary32 → binary16 (round to nearest even; overflow → ±inf, NaN kept).
pub fn f32_to_f16(v: f32) -> u16 {
let b = v.to_bits();
let sign = ((b >> 16) & 0x8000) as u16;
let exp = ((b >> 23) & 0xff) as i32;
let man = b & 0x7f_ffff;
if exp == 0xff {
return sign | 0x7c00 | if man != 0 { 0x200 } else { 0 };
}
let e = exp - 127 + 15;
if e >= 0x1f {
return sign | 0x7c00;
}
if e <= 0 {
if e < -10 {
return sign;
}
// subnormal half
let m = man | 0x80_0000;
let shift = (14 - e) as u32;
let half = m >> shift;
let rem = m & ((1 << shift) - 1);
let mid = 1 << (shift - 1);
let r = if rem > mid || (rem == mid && half & 1 == 1) { half + 1 } else { half };
return sign | r as u16;
}
let half = ((e as u32) << 10) | (man >> 13);
let rem = man & 0x1fff;
let r = if rem > 0x1000 || (rem == 0x1000 && half & 1 == 1) { half + 1 } else { half };
sign | r as u16
}
/// Apply the floating-point predictor (inverse of `unpack::undo_float_predictor`) to one row of
/// `n` big-endian samples of `bytes_per` bytes: split into byte planes (most significant first), then
/// byte-difference with `stride` samples.
fn float_predict(row: &[u8], n: usize, bytes_per: usize, stride: usize) -> Vec<u8> {
let mut planes = vec![0u8; row.len()];
for i in 0..n {
for b in 0..bytes_per {
planes[b * n + i] = row[i * bytes_per + b];
}
}
for i in (stride..planes.len()).rev() {
planes[i] = planes[i].wrapping_sub(planes[i - stride]);
}
planes
}
#[derive(Clone, Debug, PartialEq)]
pub struct DngWriteOptions {
pub compression: DngCompression,
pub order: ByteOrder,
/// XMP packet to embed (tag 700); defaults to one generated from the image metadata.
pub xmp: Option<String>,
}
impl Default for DngWriteOptions {
fn default() -> Self {
Self { compression: DngCompression::Lj92 { tile: 256 }, order: ByteOrder::Little, xmp: None }
}
}
fn srat_mat(m: &Mat3) -> Value {
Value::SRational(m.0.iter().flatten().map(|&v| srational(v)).collect())
}
fn rat_vec(v: &[f64]) -> Value {
Value::Rational(v.iter().map(|&x| rational(x)).collect())
}
/// Serialise `raw` as a DNG.
pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result<Vec<u8>> {
raw.validate()?;
let lossy;
let raw = match opts.compression {
DngCompression::LossyJpeg { long_edge, .. } => {
lossy = lossy_source(raw, long_edge)?;
&lossy
}
_ => raw,
};
let (w, h, cpp) = (raw.width, raw.height, raw.cpp);
let mut ifd = IfdBuilder::new();
ifd.set(t::NEW_SUBFILE_TYPE, Value::Long(vec![0]));
ifd.set(t::IMAGE_WIDTH, Value::Long(vec![w as u32]));
ifd.set(t::IMAGE_LENGTH, Value::Long(vec![h as u32]));
ifd.set(t::SAMPLES_PER_PIXEL, Value::Short(vec![cpp as u16]));
ifd.set(t::PLANAR_CONFIGURATION, Value::Short(vec![1]));
ifd.set(t::PHOTOMETRIC, Value::Short(vec![if raw.cfa.is_some() { photometric::CFA } else { photometric::LINEAR_RAW }]));
ifd.set(t::DNG_VERSION, Value::Byte(vec![1, 4, 0, 0]));
ifd.set(t::DNG_BACKWARD_VERSION, Value::Byte(vec![1, 3, 0, 0]));
let make = raw.metadata.make.as_deref().unwrap_or_default();
let model = raw.metadata.model.as_deref().unwrap_or_default();
if !make.is_empty() {
ifd.set(t::MAKE, Value::Ascii(make.to_owned()));
}
if !model.is_empty() {
ifd.set(t::MODEL, Value::Ascii(model.to_owned()));
}
let model_includes_make = !make.is_empty()
&& model.get(..make.len()).is_some_and(|prefix| prefix.eq_ignore_ascii_case(make))
&& model.get(make.len()..).is_some_and(|suffix| suffix.chars().next().is_none_or(|c| !c.is_alphanumeric() && c != '_'));
let unique = if model_includes_make || make.is_empty() {
model.to_owned()
} else if model.is_empty() {
make.to_owned()
} else {
format!("{make} {model}")
};
ifd.set(t::UNIQUE_CAMERA_MODEL, Value::Ascii(if unique.is_empty() { "LightCraft".into() } else { unique }));
ifd.set(t::ORIENTATION, Value::Short(vec![raw.orientation.to_exif()]));
ifd.set(t::SOFTWARE, Value::Ascii(SOFTWARE.into()));
let xmp = opts.xmp.clone().unwrap_or_else(|| lightcraft_meta::write_xmp(&raw.metadata, None));
ifd.set(t::XMP, Value::Byte(xmp.into_bytes()));
if let Some(cfa) = &raw.cfa {
ifd.set(t::CFA_REPEAT_PATTERN_DIM, Value::Short(vec![cfa.height as u16, cfa.width as u16]));
// the tag is anchored at the ActiveArea's top-left, `raw.cfa` at the sensor origin
let a = raw.active_area;
ifd.set(t::CFA_PATTERN_EP, Value::Byte(cfa.shifted(a.x, a.y).pattern));
ifd.set(t::CFA_PLANE_COLOR, Value::Byte(vec![0, 1, 2]));
ifd.set(t::CFA_LAYOUT, Value::Short(vec![1]));
}
let b = &raw.black;
ifd.set(t::BLACK_LEVEL_REPEAT_DIM, Value::Short(vec![b.repeat_rows as u16, b.repeat_cols as u16]));
let mut bl: Vec<f64> = b.values.iter().map(|&v| v as f64).collect();
if bl.len() == 1 && cpp > 1 {
bl = vec![bl[0]; cpp];
}
ifd.set(t::BLACK_LEVEL, rat_vec(&bl));
if !b.delta_h.is_empty() {
ifd.set(t::BLACK_LEVEL_DELTA_H, Value::SRational(b.delta_h.iter().map(|&v| srational(v as f64)).collect()));
}
if !b.delta_v.is_empty() {
ifd.set(t::BLACK_LEVEL_DELTA_V, Value::SRational(b.delta_v.iter().map(|&v| srational(v as f64)).collect()));
}
let white: Vec<u32> = (0..cpp).map(|s| raw.white_at(s).round().clamp(0.0, u32::MAX as f32) as u32).collect();
if matches!(raw.data, RawData::F32(_)) {
ifd.set(t::WHITE_LEVEL, rat_vec(&(0..cpp).map(|s| raw.white_at(s) as f64).collect::<Vec<_>>()));
} else {
ifd.set(t::WHITE_LEVEL, Value::Long(white));
}
let a = raw.active_area;
ifd.set(t::ACTIVE_AREA, Value::Long(vec![a.y as u32, a.x as u32, (a.y + a.height) as u32, (a.x + a.width) as u32]));
ifd.set(t::DEFAULT_CROP_ORIGIN, Value::Long(vec![raw.crop.x as u32, raw.crop.y as u32]));
ifd.set(t::DEFAULT_CROP_SIZE, Value::Long(vec![raw.crop.width as u32, raw.crop.height as u32]));
let c = &raw.color;
for (i, tag) in [t::CALIBRATION_ILLUMINANT_1, t::CALIBRATION_ILLUMINANT_2].into_iter().enumerate() {
if c.color_matrix[i].is_some() {
ifd.set(tag, Value::Short(vec![c.illuminant[i]]));
}
}
for (pair, tags) in [
(&c.color_matrix, [t::COLOR_MATRIX_1, t::COLOR_MATRIX_2]),
(&c.forward_matrix, [t::FORWARD_MATRIX_1, t::FORWARD_MATRIX_2]),
(&c.camera_calibration, [t::CAMERA_CALIBRATION_1, t::CAMERA_CALIBRATION_2]),
] {
for i in 0..2 {
if let Some(m) = &pair[i] {
ifd.set(tags[i], srat_mat(m));
}
}
}
if let Some(v) = c.analog_balance {
ifd.set(t::ANALOG_BALANCE, rat_vec(&v));
}
if let Some(v) = c.as_shot_neutral {
ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&v));
} else if let Some(xy) = c.as_shot_white_xy {
ifd.set(t::AS_SHOT_WHITE_XY, rat_vec(&[xy.x, xy.y]));
} else if let Some(m) = raw.wb_multipliers.filter(|m| m.iter().all(|v| *v > 0.0 && v.is_finite())) {
// vendor raws (NEF, ARW…) carry white balance as multipliers: the DNG neutral is their reciprocal
ifd.set(t::AS_SHOT_NEUTRAL, rat_vec(&m.map(|v| 1.0 / v as f64)));
}
ifd.set(t::BASELINE_EXPOSURE, Value::SRational(vec![srational(c.baseline_exposure)]));
if let Some(v) = c.baseline_sharpness {
ifd.set(t::BASELINE_SHARPNESS, rat_vec(&[v]));
}
write_profile_tags(&mut ifd, raw, opts.order);
write_opcode_tags(&mut ifd, raw);
match (&raw.data, opts.compression) {
(RawData::F32(v), DngCompression::Deflate { tile, half }) => {
let tile = deflate_tile(tile);
let bp = if half { 2 } else { 4 };
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![(bp * 8) as u16; cpp]));
ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE]));
ifd.set(t::PREDICTOR, Value::Short(vec![3]));
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * cpp * bp);
let mut row = Vec::with_capacity(tile * cpp * bp);
for y in 0..tile {
let sy = (ty + y).min(h - 1);
row.clear();
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..cpp {
let f = v[(sy * w + sx) * cpp + s];
if half {
row.extend_from_slice(&f32_to_f16(f).to_be_bytes());
} else {
row.extend_from_slice(&f.to_bits().to_be_bytes());
}
}
}
buf.extend_from_slice(&float_predict(&row, tile * cpp, bp, cpp));
}
miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL)
})
.collect();
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
(RawData::F32(v), _) => {
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![32; cpp]));
ifd.set(t::SAMPLE_FORMAT, Value::Short(vec![3; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE]));
let mut bytes = Vec::with_capacity(v.len() * 4);
for &x in v {
let mut tmp = Vec::with_capacity(4);
opts.order.put_u32(&mut tmp, x.to_bits());
bytes.extend_from_slice(&tmp);
}
ifd.set_image(ImageData::Strips { rows_per_strip: h as u32, strips: vec![bytes] });
}
(RawData::U16(v), DngCompression::LossyJpeg { tile, quality, .. }) => {
// `lossy_source` made 3-sample 8-bit codes
let tile = (tile.clamp(16, 4096) & !15) as usize;
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![8; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::LOSSY_JPEG]));
ifd.set(t::LINEARIZATION_TABLE, Value::Short(lossy_linearization()));
let quality = quality.clamp(1, 100);
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * 3);
for y in 0..tile {
let sy = (ty + y).min(h - 1);
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..3 {
buf.push(v.get((sy * w + sx) * cpp + s.min(cpp - 1)).map_or(0, |&c| c.min(255) as u8));
}
}
}
let ic_img = craft_image_codecs::Image::from_u8(tile as u32, tile as u32, craft_image_codecs::ChannelLayout::Rgb, buf)
.map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))?;
let opts = craft_image_codecs::EncodeOptions { jpeg_quality: quality, ..Default::default() };
craft_image_codecs::encode(&ic_img, craft_image_codecs::Format::Jpeg, &opts)
.map_err(|e| RawError::Corrupt(format!("lossy JPEG tile: {e}")))
})
.collect::<Result<_>>()?;
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
(RawData::U16(v), _) => {
let maxv = v.iter().copied().max().unwrap_or(0);
let bits = (16 - maxv.leading_zeros()).max(raw.bits.min(16)).max(2) as u8;
ifd.set(
t::BITS_PER_SAMPLE,
Value::Short(vec![if matches!(opts.compression, DngCompression::Uncompressed) { 16 } else { bits as u16 }; cpp]),
);
match opts.compression {
DngCompression::Uncompressed => {
ifd.set(t::COMPRESSION, Value::Short(vec![compression::NONE]));
let rows = (65536 / (w * cpp * 2)).clamp(1, h);
let strips = v
.chunks(rows * w * cpp)
.map(|s| {
let mut b = Vec::with_capacity(s.len() * 2);
s.iter().for_each(|&x| opts.order.put_u16(&mut b, x));
b
})
.collect();
ifd.set_image(ImageData::Strips { rows_per_strip: rows as u32, strips });
}
DngCompression::Deflate { tile, .. } => {
let tile = deflate_tile(tile);
ifd.set(t::BITS_PER_SAMPLE, Value::Short(vec![16; cpp]));
ifd.set(t::COMPRESSION, Value::Short(vec![compression::ADOBE_DEFLATE]));
ifd.set(t::PREDICTOR, Value::Short(vec![2]));
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * cpp * 2);
let mut row = vec![0u16; tile * cpp];
for y in 0..tile {
let sy = (ty + y).min(h - 1);
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..cpp {
row[x * cpp + s] = v[(sy * w + sx) * cpp + s];
}
}
for i in (cpp..row.len()).rev() {
row[i] = row[i].wrapping_sub(row[i - cpp]);
}
row.iter().for_each(|&x| opts.order.put_u16(&mut buf, x));
}
miniz_oxide::deflate::compress_to_vec_zlib(&buf, DEFLATE_LEVEL)
})
.collect();
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
// handled above (the data is converted first)
DngCompression::LossyJpeg { .. } => return Err(RawError::Unsupported("lossy DNG of this data".into())),
DngCompression::Lj92 { tile } => {
let tile = (tile.max(2) & !1) as usize;
if tile > 65534 {
return Err(RawError::Limit("tile too large"));
}
ifd.set(t::COMPRESSION, Value::Short(vec![compression::JPEG]));
let (ta, td) = (w.div_ceil(tile), h.div_ceil(tile));
let tiles: Vec<Vec<u8>> = (0..ta * td)
.into_par_iter()
.map(|i| {
let (tx, ty) = (i % ta * tile, i / ta * tile);
let mut buf = Vec::with_capacity(tile * tile * cpp);
for y in 0..tile {
let sy = (ty + y).min(h - 1);
for x in 0..tile {
let sx = (tx + x).min(w - 1);
for s in 0..cpp {
buf.push(v[(sy * w + sx) * cpp + s]);
}
}
}
if cpp == 1 {
ljpeg::encode(&buf, tile / 2, tile, 2, bits, 1, 0)
} else {
ljpeg::encode(&buf, tile, tile, cpp, bits, 1, 0)
}
})
.collect();
ifd.set_image(ImageData::Tiles { tile_width: tile as u32, tile_height: tile as u32, tiles });
}
}
}
}
Ok(TiffWriter::new(opts.order, false).write(&[ifd])?)
}
fn write_profile_tags(ifd: &mut IfdBuilder, raw: &RawImage, order: ByteOrder) {
// The source's own profile look travels with its data (conversions, smart previews, merges).
let profile = &raw.color.profile;
let table_tags = |ifd: &mut IfdBuilder, table: &crate::profile::HsvTable, dims: u16, enc: u16| {
ifd.set(dims, Value::Long(vec![table.hue_divisions as u32, table.sat_divisions as u32, table.val_divisions as u32]));
if table.srgb_value {
ifd.set(enc, Value::Long(vec![1]));
}
};
let flat = |table: &crate::profile::HsvTable| Value::Float(table.data.iter().flatten().copied().collect());
match &profile.hue_sat_map {
[Some(first), second] => {
table_tags(ifd, first, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING);
ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(first));
if let Some(second) = second.as_ref().filter(|second| {
(second.hue_divisions, second.sat_divisions, second.val_divisions) == (first.hue_divisions, first.sat_divisions, first.val_divisions)
}) {
ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_2, flat(second));
}
}
[None, Some(table)] => {
table_tags(ifd, table, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING);
ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(table));
}
[None, None] => {}
}
if let Some(table) = &profile.look_table {
table_tags(ifd, table, t::PROFILE_LOOK_TABLE_DIMS, t::PROFILE_LOOK_TABLE_ENCODING);
ifd.set(t::PROFILE_LOOK_TABLE_DATA, flat(table));
}
if let Some(curve) = &profile.tone_curve {
ifd.set(t::PROFILE_TONE_CURVE, Value::Float(curve.points.iter().flatten().copied().collect()));
}
if let Some(map) = &profile.gain_table_map {
// The raw IFD is IFD 0 here, where both tag versions are valid.
let (version2, bytes) = map.to_bytes(order);
ifd.set(if version2 { t::PROFILE_GAIN_TABLE_MAP_2 } else { t::PROFILE_GAIN_TABLE_MAP }, Value::Undefined(bytes));
}
}
fn write_opcode_tags(ifd: &mut IfdBuilder, raw: &RawImage) {
for (list, tag) in [(&raw.opcodes.list1, t::OPCODE_LIST_1), (&raw.opcodes.list2, t::OPCODE_LIST_2), (&raw.opcodes.list3, t::OPCODE_LIST_3)] {
if !list.is_empty() {
ifd.set(tag, Value::Undefined(opcodes::write_list(list)));
}
}
}
/// Exif `LightSource` code of a white point the rendered DNG writer knows (D65 = 21, D50 = 23).
fn illuminant_of(white: lightcraft_color::Xy) -> u16 {
if (white.x - lightcraft_color::D50.x).abs() < 1e-3 && (white.y - lightcraft_color::D50.y).abs() < 1e-3 { 23 } else { 21 }
}
/// Render to DNG: a linear DNG (`LinearRaw`, 16-bit float Deflate tiles) of an already rendered,
/// oriented image. `rgb` is `width × height` interleaved linear RGB in `space` (white = 1; values
/// above 1 are kept up to the half-float maximum, negative and non-finite ones become 0). The colour tags describe `space`
/// exactly — `ColorMatrix1` = XYZ → space, `ForwardMatrix1` = space → XYZ D50, a neutral
/// `AsShotNeutral` — and an identity `ProfileToneCurve` keeps raw converters from adding their
/// default tone curve on top of the baked-in edit.
pub fn write_rendered_dng(
width: usize,
height: usize,
rgb: &[f32],
space: &lightcraft_color::RgbSpace,
metadata: &lightcraft_meta::Metadata,
xmp: Option<String>,
) -> Result<Vec<u8>> {
let n = width.checked_mul(height).and_then(|p| p.checked_mul(3)).ok_or(RawError::Limit("image too large"))?;
if width == 0 || height == 0 || width > u32::MAX as usize || height > u32::MAX as usize {
return Err(RawError::Corrupt(format!("cannot write a {width}×{height} DNG")));
}
let src = rgb.get(..n).ok_or_else(|| RawError::Corrupt(format!("{} samples for a {width}×{height} RGB image", rgb.len())))?;
let data: Vec<f32> = src.iter().map(|&v| if v.is_finite() { v.clamp(0.0, 65504.0) } else { 0.0 }).collect();
let full = crate::Rect::new(0, 0, width, height);
let forward = lightcraft_color::bradford(space.white, lightcraft_color::D50).mul(&space.to_xyz());
let color = crate::ColorData {
illuminant: [illuminant_of(space.white), 0],
color_matrix: [Some(space.from_xyz()), None],
forward_matrix: [Some(forward), None],
as_shot_neutral: Some([1.0; 3]),
profile: crate::profile::ProfileLook {
tone_curve: Some(crate::profile::ToneCurve { points: vec![[0.0, 0.0], [1.0, 1.0]] }),
..Default::default()
},
..Default::default()
};
let raw = RawImage {
format: crate::RawFormat::Dng,
width,
height,
cpp: 3,
data: RawData::F32(data),
cfa: None,
bits: 16,
black: crate::BlackLevel::uniform(0.0),
white: vec![1.0],
active_area: full,
crop: full,
orientation: lightcraft_geom::Orientation::Normal,
color,
wb_multipliers: None,
linearized: false,
pixel_aspect: 1.0,
opcodes: crate::OpcodeLists::default(),
metadata: metadata.clone(),
lens_metadata: Default::default(),
};
let order = ByteOrder::Little;
write_dng(&raw, &DngWriteOptions { compression: DngCompression::Deflate { tile: 256, half: true }, order, xmp })
}
+5 -2
View File
@@ -1038,6 +1038,9 @@ fn malformed_semantic_masks_are_skipped() {
let mut short = mask_ifd(4, 4, "short strip", vec![200; 3]);
short.set(t::MASK_SUB_AREA, Value::Long(vec![u32::MAX, u32::MAX, u32::MAX, u32::MAX]));
ifd0.add_sub_ifd(short);
let mut overflow = mask_ifd(2, 2, "overflow sub area", vec![255; 4]);
overflow.set(t::MASK_SUB_AREA, Value::Long(vec![u32::MAX, u32::MAX, u32::MAX, u32::MAX]));
ifd0.add_sub_ifd(overflow);
let mut outside = mask_ifd(2, 2, "sub area too small", vec![255; 4]);
outside.set(t::MASK_SUB_AREA, Value::Long(vec![3, 0, 2, 4]));
ifd0.add_sub_ifd(outside);
@@ -1047,8 +1050,8 @@ fn malformed_semantic_masks_are_skipped() {
let names: Vec<&str> = masks.iter().map(|m| m.name.as_str()).collect();
// A 4×4, 8-bit uncompressed mask needs 16 bytes: the three-byte strip
// is truncated, not a valid mask with zero-filled missing pixels. Keep the
// separate complete mask to test invalid MaskSubArea handling.
assert_eq!(names, ["sub area too small"]);
// separate complete masks to test invalid and overflowing MaskSubArea handling.
assert_eq!(names, ["overflow sub area", "sub area too small"]);
assert!(masks.iter().all(|m| m.sub_area.is_none()), "sub areas the mask doesn't fit are ignored");
for m in &masks {
let d = m.developed(Rect::new(0, 0, 8, 6), Rect::new(0, 0, 8, 6)).unwrap();
+6 -6
View File
@@ -1,10 +1,10 @@
//! Presentation-only localization. Command ids, user names and catalog data remain unchanged.
//!
//! A language is one entry in [`language_table!`] below: its BCP-47 code, the endonym shown in the
//! Language menus, the ISO 15924 script its text needs (which picks the CJK font fallback), and its
//! Settings language row, the ISO 15924 script its text needs (which picks the CJK font fallback), and its
//! message catalog (`locales/<code>.json`, embedded at build time). Adding a language is that entry
//! plus its catalogs and the corresponding language command in `menus.rs`. Settings read the
//! locale table, while menus and the control channel share the command mapping.
//! locale table, while the control channel uses the command mapping.
use std::{cell::RefCell, collections::BTreeMap, sync::OnceLock};
@@ -34,7 +34,7 @@ macro_rules! language_table {
match self { Self::$source => $source_code, $(Self::$variant => $code,)* }
}
/// The language's own name, as shown in the Language menus.
/// The language's own name, as shown in the Settings language row.
pub const fn name(self) -> &'static str {
match self { Self::$source => "English", $(Self::$variant => $name,)* }
}
@@ -140,7 +140,7 @@ language_table! {
}
impl Locale {
/// Every language in the order the Settings row and Edit ▸ Language list them: English first
/// Every language in the order the Settings row lists them: English first
/// (the source language), then the rest by their own name with accents folded, so Čeština
/// sits under C. Names in other scripts follow the Latin ones in code point order: Cyrillic,
/// Georgian, then the CJK languages.
@@ -590,9 +590,9 @@ mod picker_order_tests {
}
#[test]
fn language_menu_lists_the_picker_order() {
fn language_commands_list_the_picker_order() {
let menu: Vec<&str> = crate::menus::LANGUAGE_COMMANDS.iter().map(|c| c.1).collect();
let picker: Vec<&str> = Locale::for_picker().into_iter().map(Locale::name).collect();
assert_eq!(menu, picker, "Edit ▸ Language and the Settings row list the languages the same way");
assert_eq!(menu, picker, "the language commands and the Settings row list the languages the same way");
}
}
+3 -8
View File
@@ -22,7 +22,6 @@ fn languages_switch_persist_and_keep_user_values() {
app.run(&command, serde_json::json!({})).unwrap();
assert_eq!(app.ui.language, locale);
assert_eq!(language(), locale);
assert_eq!(crate::menubar::checked(&app, &command), Some(true));
assert_eq!(builtin_label("Warm Glow", false), "Warm Glow");
assert_eq!(builtin_label("Warm Glow", true), locale.tr("Warm Glow"));
assert_eq!(tr("photo-{title}.jpg"), "photo-{title}.jpg");
@@ -369,7 +368,7 @@ fn translated_catalogs_do_not_use_missing_menu_triangles() {
}
}
/// The language menu covers every language, and a language's own command selects it.
/// Every language has a command, and a language's own command selects it.
#[test]
fn language_commands_cover_every_language() {
let commands = [
@@ -392,11 +391,11 @@ fn language_commands_cover_every_language() {
("app.language.indonesian", Locale::Id),
("app.language.vietnamese", Locale::Vi),
];
// One command per language, and every command reachable from the menu table.
// One command per language, and every command in the UI command tables.
assert_eq!(commands.len(), Locale::ALL.len());
for (id, language) in commands {
assert_eq!(crate::menus::language_from_command(id), Some(language), "{id}");
assert!(crate::menus::ui_commands().any(|command| command.0 == id), "{id} is not in the menu");
assert!(crate::menus::ui_commands().any(|command| command.0 == id), "{id} is not a UI command");
}
assert_eq!(crate::menus::language_from_command("app.language.klingon"), None);
assert_eq!(crate::menus::language_from_command("view.detail"), None);
@@ -586,7 +585,6 @@ fn german_switches_via_menu_and_control_and_persists() {
app.run("app.language.german", serde_json::json!({})).unwrap();
assert_eq!(app.ui.language, Locale::De);
assert_eq!(language(), Locale::De);
assert_eq!(crate::menubar::checked(&app, "app.language.german"), Some(true));
let saved = serde_json::to_string(&app.ui).unwrap();
assert!(saved.contains(r#""language":"de""#));
assert_eq!(serde_json::from_str::<crate::state::UiState>(&saved).unwrap().language, Locale::De);
@@ -887,8 +885,6 @@ fn traditional_chinese_switches_through_menu_and_control_and_persists() {
assert_eq!(source_label(lightcraft_engine::LibrarySource::All, &app.session.catalog), Locale::ZhHant.tr("All Photos"));
assert_eq!(date_group_label("", false), Locale::ZhHant.tr("Unknown Date"));
assert_eq!(display_time("a-user-value"), "a-user-value");
assert_eq!(crate::menubar::checked(&app, "app.language.traditionalChinese"), Some(true));
assert_eq!(crate::menubar::checked(&app, "app.language.english"), Some(false));
assert_eq!(tr("my-photo.jpg"), "my-photo.jpg");
for id in ["album.addPhotos", "metadata.applyPreset", "label.applySet"] {
assert_eq!(crate::menubar::display_item_label(id, &serde_json::json!({"id": 1}), "Color"), "Color");
@@ -1275,7 +1271,6 @@ fn polish_switches_formats_dates_and_reads_every_count() {
app.run("app.language.polish", serde_json::json!({})).unwrap();
assert_eq!(app.ui.language, Locale::Pl);
assert_eq!(Locale::Pl.name(), "Polski");
assert_eq!(crate::menubar::checked(&app, "app.language.polish"), Some(true));
assert_eq!(tr("File"), "Plik");
assert_eq!(tr("Exposure"), "Ekspozycja");
assert_eq!(date_group_label("2026-09-20", false), "Niedziela, 20.09.2026");
-2
View File
@@ -392,8 +392,6 @@ pub fn checked(app: &LightcraftApp, id: &str) -> Option<bool> {
let u = &app.ui;
let panel = |p: RightPanel| Some(u.right == p);
match id {
// Every language's command is checked when it is the active one.
_ if crate::menus::language_from_command(id).is_some() => Some(crate::menus::language_from_command(id) == Some(u.language)),
"develop.autoSync" => Some(app.session.auto_sync),
"view.photoCounts" => Some(u.show_counts),
"view.secondWindow" => Some(u.second_window),
+17
View File
@@ -852,3 +852,20 @@ fn edit_menu_places_the_select_and_paste_rows_with_their_kin() {
let after = &nodes[pos("app.settings") + 1..];
assert!(!after.iter().any(|n| matches!(n, MenuNode::Item { .. })), "no row follows Settings… but a submenu: {after:?}");
}
/// The interface language is chosen in Settings ▸ General (one choice per language), so Edit has no
/// Language submenu of 18 rows. The commands stay: agents and tests still switch language by id.
#[test]
fn edit_menu_has_no_language_submenu_because_settings_has_the_choice() {
let mut a = app();
let bar = menu_bar(&a);
let edit = bar.iter().find(|(t, _)| t == "Edit").expect("Edit menu").1.as_slice();
assert!(!edit.iter().any(|n| matches!(n, MenuNode::Submenu { label, .. } if label == "Language")), "Edit still has a Language submenu");
for (title, nodes) in &bar {
for command in crate::menus::LANGUAGE_COMMANDS {
assert!(find(nodes, command.0).is_none(), "{} is in {title}", command.0);
}
}
run_item(&mut a, "app.language.german", Value::Null).expect("the command still switches language");
assert_eq!(a.ui.language, crate::i18n::Locale::De);
}
+23 -22
View File
@@ -1,28 +1,29 @@
use super::UiCommand;
/// The "Edit → Language" entries, one per language in [`crate::i18n::Locale::ALL`], so a language
/// has a matching menu command (also listed through the control channel). Tests check coverage.
/// One command per language in [`crate::i18n::Locale::ALL`], so a language has a matching command
/// (also listed through the control channel). They are in no menu: Settings ▸ General has the
/// language choice. Tests check coverage.
pub const LANGUAGE_COMMANDS: &[UiCommand] = &[
("app.language.english", crate::i18n::Locale::En.name(), None, "Edit>Language"),
("app.language.english", crate::i18n::Locale::En.name(), None, ""),
// The picker order (`Locale::for_picker`): alphabetical by the language's own name after
// English; Cyrillic, Georgian, then CJK names follow the Latin ones. A test keeps them equal.
("app.language.indonesian", crate::i18n::Locale::Id.name(), None, "Edit>Language"),
("app.language.czech", crate::i18n::Locale::Cs.name(), None, "Edit>Language"),
("app.language.german", crate::i18n::Locale::De.name(), None, "Edit>Language"),
("app.language.spanish", crate::i18n::Locale::Es.name(), None, "Edit>Language"),
("app.language.french", crate::i18n::Locale::Fr.name(), None, "Edit>Language"),
("app.language.italian", crate::i18n::Locale::It.name(), None, "Edit>Language"),
("app.language.polish", crate::i18n::Locale::Pl.name(), None, "Edit>Language"),
("app.language.portuguese", crate::i18n::Locale::PtBr.name(), None, "Edit>Language"),
("app.language.finnish", crate::i18n::Locale::Fi.name(), None, "Edit>Language"),
("app.language.swedish", crate::i18n::Locale::Sv.name(), None, "Edit>Language"),
("app.language.vietnamese", crate::i18n::Locale::Vi.name(), None, "Edit>Language"),
("app.language.russian", crate::i18n::Locale::Ru.name(), None, "Edit>Language"),
("app.language.ukrainian", crate::i18n::Locale::Uk.name(), None, "Edit>Language"),
("app.language.georgian", crate::i18n::Locale::Ka.name(), None, "Edit>Language"),
("app.language.japanese", crate::i18n::Locale::Ja.name(), None, "Edit>Language"),
("app.language.simplifiedChinese", crate::i18n::Locale::ZhHans.name(), None, "Edit>Language"),
("app.language.traditionalChinese", crate::i18n::Locale::ZhHant.name(), None, "Edit>Language"),
("app.language.indonesian", crate::i18n::Locale::Id.name(), None, ""),
("app.language.czech", crate::i18n::Locale::Cs.name(), None, ""),
("app.language.german", crate::i18n::Locale::De.name(), None, ""),
("app.language.spanish", crate::i18n::Locale::Es.name(), None, ""),
("app.language.french", crate::i18n::Locale::Fr.name(), None, ""),
("app.language.italian", crate::i18n::Locale::It.name(), None, ""),
("app.language.polish", crate::i18n::Locale::Pl.name(), None, ""),
("app.language.portuguese", crate::i18n::Locale::PtBr.name(), None, ""),
("app.language.finnish", crate::i18n::Locale::Fi.name(), None, ""),
("app.language.swedish", crate::i18n::Locale::Sv.name(), None, ""),
("app.language.vietnamese", crate::i18n::Locale::Vi.name(), None, ""),
("app.language.russian", crate::i18n::Locale::Ru.name(), None, ""),
("app.language.ukrainian", crate::i18n::Locale::Uk.name(), None, ""),
("app.language.georgian", crate::i18n::Locale::Ka.name(), None, ""),
("app.language.japanese", crate::i18n::Locale::Ja.name(), None, ""),
("app.language.simplifiedChinese", crate::i18n::Locale::ZhHans.name(), None, ""),
("app.language.traditionalChinese", crate::i18n::Locale::ZhHant.name(), None, ""),
];
/// Every UI command: the languages, then everything else. `xtask parity` reads both tables from
@@ -31,8 +32,8 @@ pub fn ui_commands() -> impl Iterator<Item = &'static UiCommand> {
LANGUAGE_COMMANDS.iter().chain(UI_COMMANDS)
}
/// The language a Language-menu command selects, if the id is one. The engine and the UI both go
/// through here, so the menu, the settings row and the control channel agree on the mapping.
/// The language a language command selects, if the id is one. The engine and the UI both go
/// through here, so the settings row and the control channel agree on the mapping.
pub fn language_from_command(id: &str) -> Option<crate::i18n::Locale> {
match id {
"app.language.english" => Some(crate::i18n::Locale::En),
@@ -390,3 +390,21 @@ fn each_tab_remembers_how_far_it_was_scrolled() {
show(&mut h, "import");
assert!((rect(&h, "check:settings.perCamera").top() - scrolled).abs() < 0.5, "Import is where it was left after a reopen");
}
/// Settings ▸ General ▸ Language is where the interface language is chosen (Edit has no Language
/// menu): each choice switches the app at once.
#[test]
fn each_language_choice_in_general_switches_the_interface() {
let mut h = demo([1600.0, 1000.0]);
show(&mut h, "general");
let picker = crate::i18n::Locale::for_picker();
for (i, language) in picker.iter().enumerate() {
let r = h.request("ui.clickWidget", json!({"id": format!("button:settingsLanguage-{i}")}), T);
assert_eq!(r["ok"], true, "{language:?}: {r}");
h.step();
h.step();
assert_eq!(h.app.ui.language, *language, "choice {i}");
assert_eq!(crate::i18n::language(), *language, "choice {i} is applied at once");
}
crate::i18n::set_language(crate::i18n::Locale::En);
}
+12
View File
@@ -226,6 +226,18 @@ fn a_photo_that_cannot_be_read_says_so() {
let toast = h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default();
assert!(toast.contains("can't read the photo"), "{toast}");
assert_eq!(h.app.session.filter, Default::default());
// Headless frames can start process-wide GPU warm-up. Keep the original assertions and
// GPU enabled, but do not let this one-test process exit while driver work is in flight.
#[cfg(not(target_arch = "wasm32"))]
{
let deadline = Instant::now() + Duration::from_secs(30);
while !lightcraft_engine::gpu::ready() && lightcraft_engine::gpu::enabled() && Instant::now() < deadline {
std::thread::sleep(Duration::from_millis(10));
}
assert!(lightcraft_engine::gpu::ready() || !lightcraft_engine::gpu::enabled(), "GPU warm-up did not finish");
assert!(lightcraft_engine::gpu::wait_idle(Duration::from_secs(30)), "GPU work did not finish");
}
}
/// A control request is answered when the search ends, with the command's `{photos}`, and the window
+1 -2
View File
@@ -1,7 +1,6 @@
# Čeština
Češtinu (`cs`, English name **Czech**, native name **Čeština**) zapnete přes **Úpravy → Jazyk →
Čeština** nebo **Nastavení → Obecné → Jazyk**. Změna platí ihned a ukládá se pro další spuštění.
Češtinu (`cs`, English name **Czech**, native name **Čeština**) zapnete přes **Nastavení → Obecné → Jazyk → Čeština**. Změna platí ihned a ukládá se pro další spuštění.
Příkaz je `app.language.czech`; řídicí kanál přijímá `ui.set {"language":"cs"}` i značky
`cs-CZ` a `cs_CZ.UTF-8`. Pro běh bez okna lze nastavit `LIGHTCRAFT_LANGUAGE=cs`.
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft auf Deutsch
Wähle **Bearbeiten → Sprache → Deutsch** oder **Einstellungen → Allgemein → Sprache**.
Wähle **Einstellungen → Allgemein → Sprache → Deutsch**.
Die Auswahl gilt sofort und wird für den nächsten Start gespeichert (`language: "de"` in `ui.json`).
Die deutschen Kataloge decken alle Schlüssel der bisherigen Übersetzungen sowie sämtliche
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft en español
Elegir **Editar → Idioma → Español** o **Ajustes → General → Idioma**. El cambio se aplica al
Elegir **Ajustes → General → Idioma → Español**. El cambio se aplica al
momento y se conserva para el próximo inicio (`language: "es"` en `ui.json`). `LIGHTCRAFT_LANGUAGE`
acepta cualquier variante del español (`es`, `es-ES`, `es_MX.UTF-8`, `es-419`…).
+1 -1
View File
@@ -1,7 +1,7 @@
# Suomi
Suomen (`fi`, englanniksi **Finnish**, omakielinen nimi **Suomi**) saa käyttöön valitsemalla
**Muokkaa → Kieli → Suomi** tai **Asetukset → Yleiset → Kieli**. Muutos tulee voimaan heti ja
**Asetukset → Yleiset → Kieli → Suomi**. Muutos tulee voimaan heti ja
tallentuu seuraavaa käynnistystä varten. Komento on `app.language.finnish`; ohjauskanava
hyväksyy `ui.set {"language":"fi"}` sekä tunnisteet `fi-FI` ja `fi_FI.UTF-8`. Ikkunattomassa
ajossa voi käyttää `LIGHTCRAFT_LANGUAGE=fi`.
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft in Indonesian
Choose **Edit → Language → Bahasa Indonesia** or **Settings → General → Language**. The choice applies
Choose **Settings → General → Language → Bahasa Indonesia**. The choice applies
at once and is saved for the next launch (`language: "id"` in `ui.json`); the control command is
`app.language.indonesian`. `LIGHTCRAFT_LANGUAGE` selects it for headless runs and accepts `id`, `id-ID`
and `id_ID.UTF-8`; the saved value is always `id`. LightCraft does not follow the system language, for
+1 -1
View File
@@ -3,7 +3,7 @@
LightCraft は日本語・簡体字中国語・英語(English)の表示に対応しています。
言語設定は `ui.json` の `language` に保存します。
- 「編集 → 言語」または「設定 → 一般 → 言語」で切り替えます。選択は次回起動にも引き継ぎます。
- 「設定 → 一般 → 言語」で切り替えます。選択は次回起動にも引き継ぎます。
- メニュー、写真編集、マスク、切り抜き、設定、読み込み、書き出し、主な処理状況を翻訳しています。
- 通常表示と太字の双方に、SIL OFLのBIZ UDPGothicを使います。日本語フォントはこのリポジトリではなく
[storytold/craft-fonts](https://github.com/storytold/craft-fonts) にあり、任意のビルド入力
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft in Georgian
Choose **Edit → Language → ქართული** or **Settings → General → Language**. The choice applies at once
Choose **Settings → General → Language → ქართული**. The choice applies at once
and is saved for the next launch (`language: "ka"` in `ui.json`); the control command is
`app.language.georgian`. `LIGHTCRAFT_LANGUAGE` selects it for headless runs and accepts `ka`, `ka-GE`
and `ka_GE.UTF-8`; the saved value is always `ka`. LightCraft does not follow the system language,
+2 -2
View File
@@ -1,7 +1,7 @@
# Polski
Język polski (`pl`, English name **Polish**, nazwa natywna **Polski**) włącza się przez **Edytuj → Język →
Polski** albo **Ustawienia → Ogólne → Język**. Zmiana działa od razu i jest zapamiętywana przy kolejnym
Język polski (`pl`, English name **Polish**, nazwa natywna **Polski**) włącza się przez **Ustawienia → Ogólne → Język →
Polski**. Zmiana działa od razu i jest zapamiętywana przy kolejnym
uruchomieniu. Polecenie to `app.language.polish`; kanał sterowania przyjmuje `ui.set {"language":"pl"}`
oraz znaczniki `pl-PL` i `pl_PL.UTF-8`. Bez okna można ustawić `LIGHTCRAFT_LANGUAGE=pl`.
+1 -1
View File
@@ -3,7 +3,7 @@
O LightCraft pode ser exibido em inglês, chinês simplificado, chinês tradicional (Taiwan), japonês e
português do Brasil. A preferência de idioma é gravada em `language` no `ui.json`.
- Troque em **Editar → Idioma** ou em **Configurações → Geral → Idioma**. A escolha é mantida nas
- Troque em **Configurações → Geral → Idioma**. A escolha é mantida nas
próximas inicializações.
- Traduzimos menus, edição de fotos, máscaras, recorte, configurações, importação, exportação e as
principais mensagens de progresso.
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft на русском
Выберите **Правка → Язык → Русский** или **Настройки → Общие → Язык**. Выбор применяется сразу
Выберите **Настройки → Общие → Язык → Русский**. Выбор применяется сразу
и сохраняется для следующего запуска (`language: "ru"` в `ui.json`).
Русский каталог охватывает меню, сочетания клавиш, библиотеку, обработку, кадрирование, маски,
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft bằng tiếng Việt
Chọn **Chỉnh sửa → Ngôn ngữ → Tiếng Việt** hoặc **Cài đặt → Chung → Ngôn ngữ**.
Chọn **Cài đặt → Chung → Ngôn ngữ → Tiếng Việt**.
Lựa chọn áp dụng ngay và được lưu cho lần mở sau (`language: "vi"` trong `ui.json`).
Các tag locale hệ thống sau cũng chọn tiếng Việt: `vi`, `vi-VN`, `vi_VN`, `vi_VN.UTF-8`.
+2 -2
View File
@@ -2,13 +2,13 @@
LightCraft 的界面支持英语、简体中文、繁体中文(台湾)和日语。语言设置保存在 `ui.json` 的 `language` 字段中。
- 通过「编辑 → 语言」或「设置 → 一般 → 语言」切换,选择会保留到下次启动。
- 通过「设置 → 一般 → 语言」切换,选择会保留到下次启动。
- 已翻译的范围与 `zh-hant.json` 键集完全一致(1246 条),两份目录的键与键序一一对应。
- 正文字重与半粗体都使用 SIL OFL 的 **Noto Sans CJK SC**(简体中文)与 BIZ UDPGothic(日语)。
这些字体不在本仓库,而在 [storytold/craft-fonts](https://github.com/storytold/craft-fonts);
使用可选的构建输入 `CRAFT_FONTS_DIR=../craft-fonts` 时(所有正式发布版)会内嵌进来。
不指定该输入时程序照常构建运行,但中文与日文文字没有字形,会显示为方框 ——
语言菜单里四种语言仍然都在,选中「简体中文」也只会得到一屏方框。未内嵌字体时构建会打印一条
「设置 → 一般 → 语言」里四种语言仍然都在,选中「简体中文」也只会得到一屏方框。未内嵌字体时构建会打印一条
`cargo::warning` 提示这一点。
- 翻译只发生在显示层:命令 ID、照片文件名、用户输入的元数据都不做改动。
- 尚未翻译的技术性错误、补充说明和发行说明仍以英文显示。
+1 -1
View File
@@ -1,6 +1,6 @@
# LightCraft 繁體中文(台灣)介面
從「編輯 → 語言 → 繁體中文(台灣)」切換,或開啟「設定 → 一般 → 語言」選擇。
從「設定 → 一般 → 語言 → 繁體中文(台灣)」切換。
macOS 的設定也可由「LightCraft → 設定…」或 `⌘,` 開啟。
語言立即生效,並儲存在應用程式設定的 `ui.json`,下次啟動會沿用。
英文、簡體中文、繁體中文與日文可隨時互相切換。
+3 -3
View File
@@ -39,12 +39,12 @@ are in [`localization-zh-hans.md`](localization-zh-hans.md), [`localization-zh-h
```
The fields are the BCP-47 code (also the settings-file value), the **endonym** shown in the
Language menu, the ISO 15924 script (`Latn`, `Jpan`, `Hans`, `Hant`, `Kore`…), and the embedded
Settings language row, the ISO 15924 script (`Latn`, `Jpan`, `Hans`, `Hant`, `Kore`…), and the embedded
catalog. `build.rs` picks up `<code>-formats.json` by name, so the macro and the format lookup
follow automatically. Add the corresponding `app.language.<name>` entry to
`LANGUAGE_COMMANDS` and `language_from_command` in `src/menus.rs`, and to the
`language_commands_cover_every_language` test. Settings read the locale table; menus and
the control channel share the language-command mapping.
`language_commands_cover_every_language` test. Settings read the locale table; the control
channel uses the language commands (they are in no menu).
3. **Make sure the glyphs exist.** The script drives which craft-fonts faces the UI installs: a
language whose script has no face in the build shows boxes (the test says so instead of failing).
Fonts live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts), never here; a
+2 -1
View File
@@ -482,7 +482,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| LR-BEHAV-TEXTFIELD | Text fields behave alike | P1 | 🟡 | `crates/ui-egui/src/widgets/text_field.rs`, `crates/ui-egui/src/panels/topbar.rs`, `crates/ui-egui/src/widgets.rs`, `crates/ui-egui/src/panels/right.rs` (`meta_field`), `crates/ui-egui/src/dialogs.rs`, `crates/ui-egui/src/panels/unnamed.rs` | one shared field: right-click Cut / Copy / Paste / Select All (no Paste in the browser), Esc gives back the text from before the edit, Return / leaving / Esc reported to the caller, optional select-on-focus; agents use `ui.clipboard` (MCP `clipboard`) and `ui.inspect` → `copied`. Used by Search Photos, slider values, the Info panel's metadata fields (multi-line captions), the one-field dialogs (New / Rename Album, New Smart Album, Rename / Merge Keywords, text prompts) and the unnamed faces' name field so far; the other text fields (most dialogs, import, settings, masking, keywords …) still use egui's own and have no menu |
| LR-BEHAV-HEADLESS | Headless UI snapshots | P2 | ✅ | `apps/lightcraft-cli/src/main.rs`, `crates/ui-egui/src/headless.rs`, `docs/control-protocol.md` | `snapshot` rasterizes the UI and defaults photo development to the CPU before the first frame, without adapter discovery; scaled dimensions are validated before allocation, and UI zoom preserves the requested physical viewport; JSON-lines control scripts are supported |
| LR-BEHAV-ACCESS | Accessibility | P2 | 🟡 | `crates/ui-egui/src/widgets.rs`, `crates/ui-egui/src/widgets/text_field.rs`, `crates/ui-egui/src/panels/grid.rs`, `crates/ui-egui/tests/it/accessibility.rs` | AccessKit (VoiceOver / Narrator / AT-SPI): sliders announce control, value, range and step and take Increment / Decrement (the value field beside each is named `<slider> value` and describes how to type or drag), buttons / icon buttons / dropdowns / section headers / sources their labels and state, text fields their caption, grid thumbnails file name, rating, flag and label. `tests/it/accessibility.rs` fails on an unnamed control, a slider without range or an untitled dialog in every view, Develop tool and 13 dialogs, and checks that Crop and Remove sliders are reached with Tab and that Tab walks the right panels top to bottom. Canvas tools by keyboard (`crates/ui-egui/src/canvas_keys.rs`, `crates/ui-egui/src/tests/canvas_keys.rs`): crop corners, edges and box, spot targets and sources, a New spot point (Return adds), radial / linear gradient handles and mask pins take the focus, are announced with their position and move with the arrows (Shift: further). Dialogs with one name field (New Album, New Smart Album, Save Metadata Preset, the renames) take the focus once when they open, so Tab and Shift+Tab reach their check box, Cancel and OK, and Return and Esc still confirm and cancel (`crates/ui-egui/src/tests/dialog_tab.rs`). The photo in Detail is named like its grid cell, `Photo: <file>, <rating>, <flag>, <label>` (`crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/tests/it/photo_name.rs`). The grid's Thumbnail size control is a slider with its value and range; Increment / Decrement and Up / Down move it one step (`crates/ui-egui/src/panels/bottombar.rs`, `crates/ui-egui/tests/it/thumb_size_slider.rs`). Icon-only buttons (the tool strip, the view and Before/After / Filmstrip buttons of the bottom bar, the top bar's Import, the mask overlay and White Balance Selector buttons, the slideshow controls; `crates/ui-egui/src/panels/topbar.rs`) are named by their bare label and the tooltip's key hint ("Edit (E)" → name "Edit", description "E") is their description, which VoiceOver reads after a pause instead of on every visit. The top bar, tool strip and bottom bar are announced as toolbars, and the sidebar, photos, Tools / Presets panel and filmstrip as landmarks (`widgets::announce_region`, `crates/ui-egui/tests/it/landmarks.rs`). The Flatpak may talk to the accessibility bus (`--talk-name=org.a11y.Bus` in both manifests, checked by `packaging/check-app-specific.sh`), which AccessKit needs to reach AT-SPI inside the sandbox. Brush strokes and red-eye ellipses are pointer-only; not tried with a real screen reader ([audit](ui-parity.md#accessibility-audit)). The sidebar's and the keyword list's disclosure triangles say which row they open or close, as "Expand Travel" (`crates/ui-egui/tests/it/sidebar_names.rs`). A date header in the photo grid is named with the text it shows (`crates/ui-egui/tests/it/grid_names.rs`). |
| LR-BEHAV-LOCALE | Language options | P2 | ✅ | `cmd:app.language.english`, `cmd:app.language.simplifiedChinese`, `cmd:app.language.traditionalChinese`, `cmd:app.language.japanese`, `cmd:app.language.portuguese`, `cmd:app.language.french`, `cmd:app.language.spanish`, `cmd:app.language.german`, `cmd:app.language.russian`, `cmd:app.language.ukrainian`, `cmd:app.language.georgian`, `cmd:app.language.polish`, `cmd:app.language.czech`, `cmd:app.language.italian`, `cmd:app.language.swedish`, `cmd:app.language.finnish`, `cmd:app.language.indonesian`, `cmd:app.language.vietnamese` | Edit > Language lists every language in the table and the active one is checked; shared with Settings > General (docs/localization.md) |
| LR-BEHAV-LOCALE | Language options | P2 | ✅ | `cmd:app.language.english`, `cmd:app.language.simplifiedChinese`, `cmd:app.language.traditionalChinese`, `cmd:app.language.japanese`, `cmd:app.language.portuguese`, `cmd:app.language.french`, `cmd:app.language.spanish`, `cmd:app.language.german`, `cmd:app.language.russian`, `cmd:app.language.ukrainian`, `cmd:app.language.georgian`, `cmd:app.language.polish`, `cmd:app.language.czech`, `cmd:app.language.italian`, `cmd:app.language.swedish`, `cmd:app.language.finnish`, `cmd:app.language.indonesian`, `cmd:app.language.vietnamese` | Settings > General > Language lists every language in the table and the active one is checked; the commands are in no menu, so Edit has no Language submenu (docs/localization.md) |
| LR-BEHAV-LOCALIZE | Localisation | P2 | 🟡 | `crates/ui-egui/src/i18n.rs`, `crates/ui-egui/locales/`, `docs/localization.md`, `docs/localization-zh-hans.md`, `docs/localization-zh-hant.md`, `docs/localization-ja.md`, `docs/localization-pt-br.md`, `docs/localization-es.md`, `docs/localization-de.md`, `docs/localization-ru.md`, `docs/localization-ka.md`, `docs/localization-pl.md` | One table entry per language (code, endonym, ISO 15924 script, catalog): English, Simplified Chinese, Traditional Chinese (Taiwan), Japanese, Brazilian Portuguese, Spanish, German, Russian, French, Ukrainian, Polish, Czech, Italian, Georgian, Swedish, Finnish, Indonesian and Vietnamese UI with a persisted language preference and craft-fonts regular/bold faces per script (a variable face, as for Arabic, is drawn heavier for bold from its one file); menus, edit, crop/masks, settings, import/export and primary progress messages. Adding a language registers the locale and its language command, plus two catalogs. Stock presets/profiles, history steps, library headings, date headings and capture times are localised (user-named items stay verbatim); the Ukrainian catalog covers every existing catalog key, command/control label and rule-editor label; the German catalog reports newly added gaps; the other catalogs fall back to English for messages they lack. Technical errors remain English; release notes are translated in German and Ukrainian; craft-fonts faces for other scripts (Thai, Arabic, …) are UI fallbacks in every language, for file, folder and album names (#736); Traditional Chinese borrows the Simplified Chinese face (no TC face in craft-fonts yet), and the web build embeds the Japanese, Thai and Georgian faces in WASM while loading the Simplified Chinese face from a separate font file. |
| LR-BEHAV-LEARN | Tutorials | OOS | 🚫 | | |
| LR-BEHAV-WHATSNEW | What's new | P2 | ✅ | `cmd:app.whatsNew`, `docs/whats-new.md` | Help ▸ What's New: release highlights |
@@ -1058,3 +1058,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove
| 2026-10-17 | minor | LR-EXP-DIALOG: built-in export presets for the issue #2104 delivery targets — Instagram Feed (1080 px, screen sharpening), Instagram Story / Reel (1920 px), Web / Portfolio (2048 px, copyright and creator metadata), Full Resolution Master (full size, Display P3, quality 95); LR-EXP-PREVIOUS drops its stale "no named export presets yet" note; status unchanged (✅) |
| 2026-10-20 | patch | LR-EXP-DIALOG: the four built-in export presets are translated in all 17 catalogs (translations pending native-speaker review); Instagram Story / Reel states that it applies no crop to 9:16; status unchanged (✅) |
| 2026-10-31 | patch | LRC-LIB-VISUALSEARCH: Find Similar Photos reads the photos on a worker thread under an activity row with ✕ instead of on the UI thread, where a large library left the window not responding (#3468). A stopped search leaves the view as it was and keeps what it read; a control request gets the same `{photos}` when the search ends. |
| 2026-10-27 | patch | LR-BEHAV-LOCALE: the Edit menu loses its Language submenu (18 rows); Settings ▸ General ▸ Language, which already lists every language, is the one place to choose; the `app.language.*` commands stay for agents; status counts unchanged |
+3
View File
@@ -286,6 +286,9 @@
## 2026-10-27
### The Edit menu loses its Language submenu
- Choose the interface language in Settings ▸ General ▸ Language, which already lists every language. Edit no longer carries 18 more rows for it, on any platform.
### The Edit menu groups Select Only Active Photo and Paste Settings from Previous with their kin
- Select Only Active Photo now sits under Deselect All, and Paste Settings from Previous under Paste Selected Settings…, instead of both after Settings…, near the end of the Edit menu. On macOS, where Settings… lives in the application menu, the Edit menu no longer shows two separator lines in a row.
+97 -67
View File
@@ -20,8 +20,8 @@
{
"type": "git",
"url": "https://github.com/storytold/craft-libs",
"commit": "c28356d400aed7575b04ec1551b4665107cfe845",
"dest": "flatpak-cargo/git/craft-libs-c28356d"
"commit": "3a6613f058e355a4fd8d196b2f385260bd4b4a8e",
"dest": "flatpak-cargo/git/craft-libs-3a6613f"
},
{
"type": "git",
@@ -53,6 +53,12 @@
"commit": "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a",
"dest": "flatpak-cargo/git/craft-libs-5ac7c96"
},
{
"type": "git",
"url": "https://github.com/storytold/craft-libs",
"commit": "c28356d400aed7575b04ec1551b4665107cfe845",
"dest": "flatpak-cargo/git/craft-libs-c28356d"
},
{
"type": "git",
"url": "https://github.com/storytold/craft-libs",
@@ -89,6 +95,12 @@
"commit": "6e03f65bf45181db77ba6229716e6624db9eb25b",
"dest": "flatpak-cargo/git/craft-libs-6e03f65"
},
{
"type": "git",
"url": "https://github.com/storytold/craft-libs",
"commit": "2d4b8b8ecd79f87c847961901c40305e7f448d6f",
"dest": "flatpak-cargo/git/craft-libs-2d4b8b8"
},
{
"type": "git",
"url": "https://github.com/storytold/egui",
@@ -1666,19 +1678,19 @@
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-c28356d/crates/crw\" \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-crw\""
"mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/crw\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-crw\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-crw\"\ndescription = \"Clean-room Canon CRW (CIFF) raw decoder: the heap container, the derived entropy coding, sensor levels and as-shot white balance.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nthiserror = \"2\"\n\n[dev-dependencies]\nproptest = \"1\"\nserde_json = \"1\"\n\n[dev-dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dev-dependencies.sha2]\nversion = \"0.10\"\ndefault-features = false\nfeatures = [\"std\"]\n",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-crw",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-crw",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-crw",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-crw",
"dest-filename": ".cargo-checksum.json"
},
{
@@ -1915,6 +1927,42 @@
"dest": "cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-media",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-c28356d/crates/media\" \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-media\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-media\"\ndescription = \"Bit-level I/O, clean-room ISO BMFF (MP4), QuickTime (MOV) and Matroska (MKV, WebM) and MXF demuxers and muxers, and Ogg, AVI and MPEG-TS/PS demuxers.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[package.metadata.docs.rs]\nall-features = true\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndefault = [\"isobmff\"]\nbitstream = []\nisobmff = [\"bitstream\", \"dep:thiserror\"]\nmatroska = []\navi = []\nmxf = [\"dep:chrono\"]\nmpegts = []\nogg = []\nserde = [\"dep:serde\"]\n\n[dependencies.thiserror]\noptional = true\nversion = \"2\"\n\n[dependencies.serde]\noptional = true\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dependencies.chrono]\noptional = true\nversion = \"0.4.45\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies]\nproptest = \"1\"\nserde_json = \"1\"\n\n[dev-dependencies.craft-media-testkit]\npath = \"crates/media-testkit\"\n\n[[test]]\nname = \"fuzz\"\nrequired-features = [\"isobmff\"]\n\n[[test]]\nname = \"fuzz_matroska\"\nrequired-features = [\"matroska\"]\n\n[[test]]\nname = \"oracle_avi\"\nrequired-features = [\"avi\"]\n\n[[test]]\nname = \"oracle_avi_mux\"\nrequired-features = [\"avi\"]\n\n[[test]]\nname = \"oracle_demux\"\nrequired-features = [\"isobmff\"]\n\n[[test]]\nname = \"oracle_matroska\"\nrequired-features = [\"matroska\"]\n\n[[test]]\nname = \"oracle_mpegts\"\nrequired-features = [\"mpegts\"]\n\n[[test]]\nname = \"oracle_mux\"\nrequired-features = [\"isobmff\"]\n\n[[test]]\nname = \"oracle_mxf\"\nrequired-features = [\"mxf\"]\n\n[[test]]\nname = \"oracle_ogg\"\nrequired-features = [\"ogg\"]\n\n[[test]]\nname = \"roundtrip\"\nrequired-features = [\"isobmff\"]\n",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-media",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-media",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/metadata\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-metadata\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-metadata\"\ndescription = \"Photo metadata: EXIF, IPTC-IIM, XMP packets (read, write, merge) and GPX track logs, the blocks that carry them in JPEG, PNG, WebP, TIFF and CR3 files, and one model they all read into.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nquick-xml = \"0.41\"\n\n[dependencies.craft-tiff]\npath = \"crates/tiff\"\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dependencies.chrono]\nversion = \"0.4.45\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dependencies.brotli-decompressor]\nversion = \"6\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies]\nproptest = \"1\"\nserde_json = \"1\"\n\n[dev-dependencies.brotli]\nversion = \"9\"\ndefault-features = false\nfeatures = [\"std\"]\n",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-metadata",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-metadata",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
@@ -2026,19 +2074,37 @@
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-c28356d/crates/raw\" \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-raw\""
"mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/raw\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-raw\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-raw\"\ndescription = \"Camera raw files, the file-format layer: container parsing, decompression and the sensor data out as a neutral raw image with its levels, crop, orientation, colour tags and embedded previews. DNG (read and write), Hasselblad 3FR/FFF, MRW, ERF, MEF, Kodak DCS, Pentax PEF, Samsung SRW, Canon CR2, Nikon NEF/NRW, Panasonic RW2, Fujifilm RAF, Olympus ORF (uncompressed), Sony ARW, Canon CR3 and Canon CRW so far.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndefault = [\"dng\", \"jxl\", \"crw\", \"hasselblad\", \"mrw\", \"erf\", \"mef\", \"kodak\", \"pef\", \"srw\", \"cr2\", \"nef\", \"rw2\", \"raf\", \"orf\", \"arw\", \"cr3\"]\ndng = [\"dep:miniz_oxide\", \"dep:zune-jpeg\", \"dep:zune-core\"]\njxl = [\"dng\", \"dep:jxl-oxide\"]\nhasselblad = [\"dng\"]\nmrw = []\nerf = []\nmef = []\nkodak = []\npef = []\nsrw = []\ncr2 = []\nnef = []\nrw2 = []\nraf = []\norf = []\narw = []\ncr3 = [\"dep:craft-metadata\"]\ncrw = [\"dep:craft-crw\", \"dep:chrono\"]\n\n[dependencies]\nthiserror = \"2\"\nrayon = \"1\"\n\n[dependencies.craft-tiff]\npath = \"crates/tiff\"\n\n[dependencies.craft-crw]\noptional = true\npath = \"crates/crw\"\n\n[dependencies.craft-metadata]\noptional = true\npath = \"crates/metadata\"\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dependencies.chrono]\noptional = true\nversion = \"0.4.45\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dependencies.miniz_oxide]\nversion = \"0.9\"\noptional = true\n\n[dependencies.zune-jpeg]\nversion = \"0.5\"\ndefault-features = false\nfeatures = [\"std\", \"x86\", \"neon\"]\noptional = true\n\n[dependencies.zune-core]\nversion = \"0.5\"\ndefault-features = false\nfeatures = [\"std\"]\noptional = true\n\n[dependencies.jxl-oxide]\nversion = \"0.12\"\ndefault-features = false\noptional = true\n\n[dev-dependencies]\nproptest = \"1\"\n\n[dev-dependencies.sha2]\nversion = \"0.10\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies.jpeg-encoder]\nversion = \"0.7\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dev-dependencies.zune-jpegxl]\nversion = \"0.5\"\ndefault-features = false\nfeatures = [\"std\"]\n",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-raw",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-raw",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-raw",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-raw",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-3a6613f/crates/tiff\" \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-tiff\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-tiff\"\ndescription = \"TIFF and BigTIFF IFD reader and writer: every field type, the Exif/GPS/Interop pointer IFDs, maker-note IFDs, strip and tile layout.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\n\n[dev-dependencies]\nproptest = \"1\"\n",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-tiff",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09/craft-tiff",
"dest-filename": ".cargo-checksum.json"
},
{
@@ -2131,6 +2197,24 @@
"dest": "cargo/vendor-git/6f5ad8618176b3fc0aac703e6e74df7229b0350b4574c7edbe0bb86c53c1cb6c/craft-video",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-c28356d/crates/video\" \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-video\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-video\"\ndescription = \"Clean-room pure-Rust video codecs, one feature per codec: DNxHD/DNxHR, VP8, ProRes, H.264, HEVC, VP9, AV1, MPEG-4 Part 2.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[package.metadata.docs.rs]\nall-features = true\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[features]\ndnx = []\napv = [\"apv-decode\", \"apv-encode\"]\napv-decode = [\"craft-media/bitstream\"]\napv-encode = [\"craft-media/bitstream\"]\nvp8 = [\"vp8-decode\", \"vp8-encode\"]\nvp8-decode = []\nvp8-encode = []\nmpeg2 = [\"mpeg2-decode\", \"mpeg2-encode\"]\nmpeg2-decode = []\nmpeg2-encode = [\"mpeg2-decode\"]\nmpeg4 = [\"mpeg4-encode\"]\nmpeg4-encode = [\"craft-media/bitstream\"]\nffv1 = []\nprores = [\"craft-media/bitstream\"]\nh264 = [\"h264-decode\", \"h264-encode\"]\nh264-decode = [\"craft-media/bitstream\"]\nh264-encode = [\"craft-media/isobmff\"]\nhevc = [\"hevc-decode\", \"hevc-encode\"]\nhevc-decode = [\"craft-media/bitstream\"]\nhevc-encode = [\"craft-media/isobmff\"]\nvp9 = [\"vp9-decode\", \"vp9-encode\"]\nvp9-decode = [\"craft-media/bitstream\"]\nvp9-encode = [\"craft-media/isobmff\"]\nav1 = [\"av1-decode\", \"av1-encode\"]\nav1-decode = []\nav1-encode = [\"craft-media/isobmff\"]\nav1-large-encode = [\"av1-encode\", \"dep:rav1e\"]\nthreads = [\"dep:rayon\"]\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.craft-media]\npath = \"crates/media\"\ndefault-features = false\n\n[dependencies.rayon]\noptional = true\nversion = \"1\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.rav1e]\nversion = \"0.8\"\ndefault-features = false\noptional = true\n\n[dev-dependencies.craft-media-testkit]\npath = \"crates/media-testkit\"\n\n[dev-dependencies.craft-media]\nfeatures = [\"avi\"]\npath = \"crates/media\"\ndefault-features = false\n\n[[test]]\nname = \"dnx\"\nrequired-features = [\"dnx\"]\n\n[[test]]\nname = \"apv\"\nrequired-features = [\"apv\"]\n\n[[test]]\nname = \"vp8\"\nrequired-features = [\"vp8-decode\"]\n\n[[test]]\nname = \"av1_decode\"\nrequired-features = [\"av1-decode\"]\n\n[[test]]\nname = \"h264_decode\"\nrequired-features = [\"h264-decode\"]\n\n[[test]]\nname = \"h264_encode\"\nrequired-features = [\"h264-encode\"]\n\n[[test]]\nname = \"hevc_decode\"\nrequired-features = [\"hevc-decode\"]\n\n[[test]]\nname = \"vp8_encode\"\nrequired-features = [\"vp8\"]\n\n[[test]]\nname = \"vp9_decode\"\nrequired-features = [\"vp9-decode\"]\n\n[[test]]\nname = \"mpeg4_encode\"\nrequired-features = [\"mpeg4-encode\"]\n\n[[test]]\nname = \"mpeg2\"\nrequired-features = [\"mpeg2-decode\"]\n\n[[test]]\nname = \"ffv1\"\nrequired-features = [\"ffv1\"]\n\n[[test]]\nname = \"prores\"\nrequired-features = [\"prores\"]\n\n[[test]]\nname = \"hevc\"\nrequired-features = [\"hevc-encode\"]\n\n[[test]]\nname = \"av1\"\nrequired-features = [\"av1\"]\n\n[[example]]\nname = \"vp8_fuzz\"\nrequired-features = [\"vp8-decode\"]\n\n[[example]]\nname = \"vp8_vp8dec\"\nrequired-features = [\"vp8-decode\"]\n\n[[example]]\nname = \"av1_av1dec\"\nrequired-features = [\"av1-decode\"]\n\n[[example]]\nname = \"h264_h264dec\"\nrequired-features = [\"h264-decode\"]\n\n[[example]]\nname = \"h264_h264enc_bench\"\nrequired-features = [\"h264-encode\"]\ntest = true\n\n[[example]]\nname = \"hevc_hevcdec\"\nrequired-features = [\"hevc-decode\"]\n\n[[example]]\nname = \"vp9_vp9dec\"\nrequired-features = [\"vp9-decode\"]\n",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-video",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801/craft-video",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
@@ -2152,19 +2236,19 @@
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-f0f4758/crates/xml\" \"cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7/craft-xml\""
"mkdir -p \"cargo/vendor-git/c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99\" && cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-2d4b8b8/crates/xml\" \"cargo/vendor-git/c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99/craft-xml\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"craft-xml\"\ndescription = \"Bounded XML for hostile input: an owned element tree, streaming of repeated elements, a pull reader, escaping and a writer. No DTDs, no entity expansion.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.quick-xml]\nversion = \"0.41\"\ndefault-features = false\n",
"dest": "cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7/craft-xml",
"contents": "[package]\nname = \"craft-xml\"\ndescription = \"Bounded XML for hostile input: an owned element tree, streaming of repeated elements, a pull reader, escaping and a writer. No DTDs, no entity expansion.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\nunused_workspace_dependencies = \"allow\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ncognitive_complexity = \"deny\"\ntoo_many_arguments = \"deny\"\nunused_workspace_dependencies = \"allow\"\nwildcard_imports = \"deny\"\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies]\nthiserror = \"2\"\n\n[dependencies.quick-xml]\nversion = \"0.41\"\ndefault-features = false\n\n[dependencies.serde]\nfeatures = [\"derive\", \"derive\"]\nversion = \"1\"\n",
"dest": "cargo/vendor-git/c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99/craft-xml",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7/craft-xml",
"dest": "cargo/vendor-git/c00ae949c9fde60d3b15820cc243df0e52fa9adb7e8544da038f0df657e4bd99/craft-xml",
"dest-filename": ".cargo-checksum.json"
},
{
@@ -10183,63 +10267,9 @@
"dest": "cargo/vendor/zvariant_utils-4.2.0",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\" && cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_demo_lib\" \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_demo_lib\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"egui_demo_lib\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt <emil.ernerfeldt@gmail.com>\"]\ndescription = \"Example library for egui\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui_demo_lib\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui_demo_lib\"\ncategories = [\"gui\", \"graphics\"]\nkeywords = [\"glow\", \"egui\", \"gui\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\", \"data/*\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[package.metadata.cargo-shear]\nignored = [\"image\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[fLine truncated
"dest": "cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_demo_lib",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_demo_lib",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\" && cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_inspection\" \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_inspection\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"egui_inspection\"\nversion = \"0.37.0\"\nauthors = [\"Lucas Meurer <hi@lucasmerlin.me>\", \"Emil Ernerfeldt <emil.ernerfeldt@gmail.com>\"]\ndescription = \"Protocol and egui::Plugin for inspection of egui apps\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"./README.md\"\nrepository = \"https://github.com/emilk/egui\"\ncategories = [\"gui\", \"development-tools::testing\", \"accessibility\"]\nkeywords = [\"gui\", \"egui\", \"inspector\", \"accesskit\", \"mcp\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[features]\ndefault = []\npng = [\"dep:image\", \"image/png\", \"egui/bytemuck\"]\nplugin = [\"png\", \"dep:log\"]\n\n[dependencies]\nserde_bytes = \"0.11.19\"\nrmp-serde = \"1.3\"\n\n[dependencies.egui]\nfeatures = [\"serde\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[dependencies.serde]\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[dependencies.image]\noptional = true\nversion = \"0.25.10\"\ndefault-features = false\n\n[dependencies.log]\noptional = true\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"aLine truncated
"dest": "cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_inspection",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_inspection",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "shell",
"commands": [
"mkdir -p \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6\" && cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_system_font_provider\" \"cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_system_font_provider\""
]
},
{
"type": "inline",
"contents": "[package]\nname = \"egui_system_font_provider\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt <emil.ernerfeldt@gmail.com>\"]\ndescription = \"Load system fonts on demand for characters the egui fonts lack\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui_system_font_provider\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui_system_font_provider\"\ncategories = [\"gui\"]\nkeywords = [\"egui\", \"gui\", \"fonts\", \"text\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[dependenciesLine truncated
"dest": "cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_system_font_provider",
"dest-filename": "Cargo.toml"
},
{
"type": "inline",
"contents": "{\"package\": null, \"files\": {}}",
"dest": "cargo/vendor-git/11e349eb0774eb3ab9192b38c47d748bf18abba91a0e3952d8f196513da96ee6/egui_system_font_provider",
"dest-filename": ".cargo-checksum.json"
},
{
"type": "inline",
"contents": "[source.vendored-sources]\ndirectory = \"cargo/vendor\"\n\n[source.crates-io]\nreplace-with = \"vendored-sources\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=7f30d664695cd5ce14fc30659d36c3e32f234247\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\nrev = \"7f30d664695cd5ce14fc30659d36c3e32f234247\"\n\n[source.git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44]\ndirectory = \"cargo/vendor-git/7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=eeb134def2daa7e03512b4946bd59d6b419b9484\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\nrev = \"eeb134def2daa7e03512b4946bd59d6b419b9484\"\n\n[source.git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85]\ndirectory = \"cargo/vendor-git/92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\nrev = \"f0f4758c01581d79577b9bf5046c06f4e77b1f18\"\n\n[source.git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7]\ndirectory = \"cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\nrev = \"c28356d400aed7575b04ec1551b4665107cfe845\"\n\n[source.git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801]\ndirectory = \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\nrev = \"c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"\n\n[source.git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298]\ndirectory = \"cargo/vendor-git/11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=9dcbd90c7d16e1a668b3afa057e940e2db328b93\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\nrev = \"9dcbd90c7d16e1a668b3afa057e940e2db328b93\"\n\n[source.git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61]\ndirectory = \"cargo/vendor-git/36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=b77af389f30bb10de10d8436ca9b39fe94e3bb67\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\nrev = \"b77af389f30bb10de10d8436ca9b39fe94e3bb67\"\n\n[source.git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc]\ndirectory = \"cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\nrev = \"4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"\n\n[source.git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816]\ndirectory = \"cargo/vendor-git/ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\"\nrev = \"5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a\"\n\n[source.git-vendor-9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545]\ndirectory = \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=478c50560d3c6fad3d613af2a30b35c3bc9f4c0f\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2\"\nrev = \"478c50560d3c6fad3d613af2a30b35c3bc9f4c0f\"\n\n[source.git-vendor-cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eeba6b2]\ndirectory = \"cargo/vendor-git/cb31475a7a9d19c00f48b4c43603f2f1a464c6dce15da1d21bba4c653eebLine truncated
"contents": "[source.vendored-sources]\ndirectory = \"cargo/vendor\"\n\n[source.crates-io]\nreplace-with = \"vendored-sources\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=7f30d664695cd5ce14fc30659d36c3e32f234247\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\nrev = \"7f30d664695cd5ce14fc30659d36c3e32f234247\"\n\n[source.git-vendor-7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44]\ndirectory = \"cargo/vendor-git/7afa30ca311804d863bbc144ec2c79a3a321ce72c30264402ae2c6af8a05da44\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=eeb134def2daa7e03512b4946bd59d6b419b9484\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\nrev = \"eeb134def2daa7e03512b4946bd59d6b419b9484\"\n\n[source.git-vendor-92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85]\ndirectory = \"cargo/vendor-git/92168c1af4f3f511076af4245ec3ce22c5c554b4cc78c215ddf71587aac87d85\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=f0f4758c01581d79577b9bf5046c06f4e77b1f18\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\nrev = \"f0f4758c01581d79577b9bf5046c06f4e77b1f18\"\n\n[source.git-vendor-bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7]\ndirectory = \"cargo/vendor-git/bc00bd22a20692df38f25839a8568cd55b90e379a41719721bbc0f04fe5e29f7\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=3a6613f058e355a4fd8d196b2f385260bd4b4a8e\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\"\nrev = \"3a6613f058e355a4fd8d196b2f385260bd4b4a8e\"\n\n[source.git-vendor-fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09]\ndirectory = \"cargo/vendor-git/fa803dfb7a41f05b5ba573459e7fc3d4f96f40797cfef348caafdeab92c94c09\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\nrev = \"c5a1cbfb5f9049f9270955caffb5bee5997aebf7\"\n\n[source.git-vendor-11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298]\ndirectory = \"cargo/vendor-git/11a22760e699d74db2deeccbdb390b343ad010ce425dcb15451f0e14e45ff298\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=9dcbd90c7d16e1a668b3afa057e940e2db328b93\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\nrev = \"9dcbd90c7d16e1a668b3afa057e940e2db328b93\"\n\n[source.git-vendor-36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61]\ndirectory = \"cargo/vendor-git/36bf00be069421f8a8a7428c4360efee8b4243207a59d7b566c6f48fc5918f61\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=b77af389f30bb10de10d8436ca9b39fe94e3bb67\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\nrev = \"b77af389f30bb10de10d8436ca9b39fe94e3bb67\"\n\n[source.git-vendor-a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc]\ndirectory = \"cargo/vendor-git/a51e2c3f46af71f1caed91009f88b4f9982db0c4152c6659d11967a7731b1ccc\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\nrev = \"4ffa307f1a0a6fbd8897318cc719440ab06e9c63\"\n\n[source.git-vendor-ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816]\ndirectory = \"cargo/vendor-git/ded75ace3b48131a7498b2ad3ce7884b178155a1ef794dda2327c20c2979a816\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\"\nrev = \"5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a\"\n\n[source.git-vendor-9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545]\ndirectory = \"cargo/vendor-git/9100d311acc530b0286234c55b78dbdc0325d5e30950478c5c7864bfed7a4545\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=c28356d400aed7575b04ec1551b4665107cfe845\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801\"\nrev = \"c28356d400aed7575b04ec1551b4665107cfe845\"\n\n[source.git-vendor-547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262df801]\ndirectory = \"cargo/vendor-git/547b31fae2076d587e497f8a6226e18e0bfe27e9014d2bdf3cce7d69262dLine truncated
"dest": "cargo",
"dest-filename": "config"
}
+2 -2
View File
@@ -141,7 +141,7 @@ pub fn parse(md: &str) -> Doc {
}
/// Ids in the menu tables (`("view.detail", "Detail", Some("D"), "View"),` lines): the language
/// commands live in their own table, which the Language menu builds from the i18n language list.
/// commands live in their own table, one per language in the i18n language list.
pub fn ui_command_ids(menus_rs: &str) -> Vec<String> {
let mut ids = Vec::new();
for table in ["pub const UI_COMMANDS", "pub const LANGUAGE_COMMANDS"] {
@@ -596,6 +596,6 @@ old
for id in ["view.detail", "app.language.english", "app.language.japanese", "app.language.simplifiedChinese", "app.language.portuguese"] {
assert!(ids.iter().any(|known| known == id), "{id} not found");
}
assert_eq!(ids.iter().filter(|id| id.as_str() == "app.language.english").count(), 1, "one Language menu entry per language");
assert_eq!(ids.iter().filter(|id| id.as_str() == "app.language.english").count(), 1, "one language command per language");
}
}