diff --git a/Cargo.lock b/Cargo.lock index 0508bd2..2664b09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,12 +81,6 @@ dependencies = [ "alloc-no-stdlib", ] -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - [[package]] name = "android-activity" version = "0.6.1" @@ -142,27 +136,6 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" -[[package]] -name = "arboard" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" -dependencies = [ - "clipboard-win", - "image", - "log", - "objc2 0.6.4", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "parking_lot", - "percent-encoding", - "windows-sys 0.59.0", - "wl-clipboard-rs", - "x11rb", -] - [[package]] name = "arg_enum_proc_macro" version = "0.3.4" @@ -409,26 +382,20 @@ dependencies = [ "arrayvec", ] -[[package]] -name = "base64" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" - [[package]] name = "bit-set" -version = "0.9.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.9.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bit_field" @@ -466,6 +433,12 @@ dependencies = [ "no_std_io2", ] +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.12.1" @@ -596,18 +569,43 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "calloop" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" +dependencies = [ + "bitflags 2.13.0", + "polling", + "rustix 1.1.4", + "slab", + "tracing", +] + [[package]] name = "calloop-wayland-source" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop", + "calloop 0.13.0", "rustix 0.38.44", "wayland-backend", "wayland-client", ] +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.4", + "rustix 1.1.4", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cc" version = "1.2.65" @@ -661,6 +659,36 @@ dependencies = [ "error-code", ] +[[package]] +name = "clipboard_macos" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7f4aaa047ba3c3630b080bb9860894732ff23e2aee290a418909aa6d5df38f" +dependencies = [ + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "clipboard_wayland" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003f886bc4e2987729d10c1db3424e7f80809f3fc22dbc16c685738887cb37b8" +dependencies = [ + "smithay-clipboard", +] + +[[package]] +name = "clipboard_x11" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd63e33452ffdafd39924c4f05a5dd1e94db646c779c6bd59148a3d95fff5ad4" +dependencies = [ + "thiserror 2.0.18", + "x11rb", +] + [[package]] name = "cmov" version = "0.5.4" @@ -669,9 +697,9 @@ checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" [[package]] name = "codespan-reporting" -version = "0.13.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" dependencies = [ "serde", "termcolor", @@ -725,6 +753,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -738,8 +776,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", "foreign-types", "libc", ] @@ -751,7 +789,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.0", + "core-foundation 0.10.1", "libc", ] @@ -766,20 +815,20 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.19.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73" +checksum = "173852283a9a57a3cbe365d86e74dc428a09c50421477d5ad6fe9d9509e37737" dependencies = [ "bitflags 2.13.0", - "fontdb 0.23.0", - "harfrust 0.5.2", + "fontdb", + "harfrust", "linebender_resource_handle", "log", "rangemap", - "rustc-hash 2.1.2", + "rustc-hash 1.1.0", "self_cell", - "skrifa 0.40.0", - "smol_str 0.3.6", + "skrifa 0.37.0", + "smol_str", "swash", "sys-locale", "unicode-bidi", @@ -846,7 +895,8 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "cryoglyph" version = "0.1.0" -source = "git+https://github.com/iced-rs/cryoglyph.git?rev=f4e7e4eb84dc1d2f335a98c67d8694640d53a433#f4e7e4eb84dc1d2f335a98c67d8694640d53a433" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc795bdbccdbd461736fb163930a009da6597b226d6f6fce33e7a8eb6ec519" dependencies = [ "cosmic-text", "etagere", @@ -888,12 +938,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" -[[package]] -name = "data-url" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" - [[package]] name = "dav1d" version = "0.11.1" @@ -1006,8 +1050,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dpi" -version = "0.1.1" -source = "git+https://github.com/iced-rs/winit.git?rev=05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed#05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "dtor" @@ -1181,12 +1226,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - [[package]] name = "flate2" version = "1.1.9" @@ -1198,12 +1237,6 @@ dependencies = [ "zlib-rs", ] -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" - [[package]] name = "foldhash" version = "0.1.5" @@ -1218,18 +1251,18 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "font-types" -version = "0.11.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" +checksum = "39a654f404bbcbd48ea58c617c2993ee91d1cb63727a37bf2323a4edeed1b8c5" dependencies = [ "bytemuck", ] [[package]] name = "font-types" -version = "0.12.3" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75382bc7392ef10aad10935f92fc3db36d2d4dad0e5d96d8d65e04f89a07ec39" +checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" dependencies = [ "bytemuck", ] @@ -1240,7 +1273,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646" dependencies = [ - "roxmltree 0.20.0", + "roxmltree", ] [[package]] @@ -1257,19 +1290,6 @@ dependencies = [ "ttf-parser", ] -[[package]] -name = "fontdb" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2660c5e9157bf76d2db1294e4a9feba604ef610819a3b591088d0d8392a3290f" -dependencies = [ - "fontconfig-parser", - "log", - "memmap2", - "slotmap", - "tinyvec", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -1467,15 +1487,15 @@ dependencies = [ [[package]] name = "glam" -version = "0.33.6" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fef0953c54fd3de2f44b743fbf77e044c81a25faee03636dfccc0d35135e23" +checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" [[package]] name = "glow" -version = "0.17.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" dependencies = [ "js-sys", "slotmap", @@ -1493,17 +1513,34 @@ dependencies = [ ] [[package]] -name = "gpu-allocator" -version = "0.28.0" +name = "gpu-alloc" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" +dependencies = [ + "bitflags 2.13.0", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" +dependencies = [ + "bitflags 2.13.0", +] + +[[package]] +name = "gpu-allocator" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" dependencies = [ - "ash", - "hashbrown 0.16.1", "log", "presser", - "thiserror 2.0.18", - "windows", + "thiserror 1.0.69", + "windows 0.58.0", ] [[package]] @@ -1550,26 +1587,14 @@ dependencies = [ [[package]] name = "harfrust" -version = "0.5.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9" +checksum = "92c020db12c71d8a12a3fe7607873cade3a01a6287e29d540c8723276221b9d8" dependencies = [ "bitflags 2.13.0", "bytemuck", "core_maths", - "read-fonts 0.37.0", - "smallvec", -] - -[[package]] -name = "harfrust" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" -dependencies = [ - "bitflags 2.13.0", - "bytemuck", - "read-fonts 0.41.0", + "read-fonts 0.35.0", "smallvec", ] @@ -1597,8 +1622,6 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "allocator-api2", - "equivalent", "foldhash 0.2.0", ] @@ -1652,8 +1675,9 @@ dependencies = [ [[package]] name = "iced" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000e01026c93ba643f8357a3db3ada0e6555265a377f6f9291c472f6dd701fb3" dependencies = [ "iced_core", "iced_debug", @@ -1668,8 +1692,9 @@ dependencies = [ [[package]] name = "iced_core" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ab1937d699403e7e69252ae743a902bcee9f4ab2052cc4c9a46fcf34729d85" dependencies = [ "bitflags 2.13.0", "bytes", @@ -1677,18 +1702,17 @@ dependencies = [ "lilt", "log", "num-traits", - "raw-window-handle", "rustc-hash 2.1.2", - "smol_str 0.2.2", + "smol_str", "thiserror 2.0.18", - "unicode-segmentation", "web-time", ] [[package]] name = "iced_debug" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25035ab0215a620e53f4103e36fc4e59a1fb2817e4bfc38a30ad27b4202ea0be" dependencies = [ "iced_core", "iced_futures", @@ -1697,8 +1721,9 @@ dependencies = [ [[package]] name = "iced_futures" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c0c85ccad42dfbec7293c36c018af0ea0dbcc52d137a4a9a0b0f6822a3fdf0a" dependencies = [ "futures", "iced_core", @@ -1710,8 +1735,9 @@ dependencies = [ [[package]] name = "iced_graphics" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234ca1c2cec4155055f68fa5fad1b5242c496ac8238d80a259bca382fb44a102" dependencies = [ "bitflags 2.13.0", "bytemuck", @@ -1725,12 +1751,14 @@ dependencies = [ "raw-window-handle", "rustc-hash 2.1.2", "thiserror 2.0.18", + "unicode-segmentation", ] [[package]] name = "iced_program" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dfafec2947cda688d8eb00dac337ba11aa60f9ef6335aed343e189d26e4a673" dependencies = [ "iced_graphics", "iced_runtime", @@ -1738,8 +1766,9 @@ dependencies = [ [[package]] name = "iced_renderer" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "250cc0802408e8c077986ec56c7d07c65f423ee658a4b9fd795a1f2aae5dac05" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -1750,40 +1779,45 @@ dependencies = [ [[package]] name = "iced_runtime" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1889b819ce4c06674183242e336c8d49465665441396914dc07cc86f44fa8d4" dependencies = [ "bytes", "iced_core", "iced_futures", + "raw-window-handle", "thiserror 2.0.18", ] [[package]] name = "iced_tiny_skia" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0acf8b75a3bc914aff5f2329fdffc1b36eeaea29dda0e4bd232f1c62e9cc3d" dependencies = [ "bytemuck", "cosmic-text", "iced_debug", "iced_graphics", - "kurbo 0.10.4", + "kurbo", "log", "rustc-hash 2.1.2", "softbuffer", - "tiny-skia 0.11.4", + "tiny-skia", ] [[package]] name = "iced_wgpu" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff144a999b0ca0f8a10257934500060240825c42e950ec0ebee9c8ae30561c13" dependencies = [ "bitflags 2.13.0", "bytemuck", "cryoglyph", "futures", + "glam", "guillotiere", "iced_debug", "iced_graphics", @@ -1795,11 +1829,11 @@ dependencies = [ [[package]] name = "iced_widget" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1596afa0d3109c2618e8bc12bae6c11d3064df8f95c42dfce570397dbe957ab" dependencies = [ "iced_renderer", - "iced_runtime", "log", "num-traits", "rustc-hash 2.1.2", @@ -1809,21 +1843,20 @@ dependencies = [ [[package]] name = "iced_winit" -version = "0.15.0-dev" -source = "git+https://github.com/iced-rs/iced#a8ff2d522552c1252b88afc02bc310dd657cd25e" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7dbedc47562d1de3b9707d939f678b88c382004b7ab5a18f7a7dd723162d75" dependencies = [ - "arboard", "iced_debug", "iced_program", - "iced_runtime", "log", "mundy", - "objc2 0.5.2", "rustc-hash 2.1.2", "thiserror 2.0.18", "tracing", "wasm-bindgen-futures", "web-sys", + "window_clipboard", "winit", ] @@ -1863,12 +1896,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "imagesize" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a" - [[package]] name = "imagey" version = "0.1.0" @@ -1877,10 +1904,7 @@ dependencies = [ "iced", "image", "jxl-oxide", - "misc-image-integration", - "resvg", "rfd", - "size", "zip", ] @@ -1999,11 +2023,12 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.85" +version = "0.3.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" dependencies = [ - "once_cell", + "cfg-if", + "futures-util", "wasm-bindgen", ] @@ -2223,18 +2248,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "kurbo" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" -dependencies = [ - "arrayvec", - "euclid", - "polycool", - "smallvec", -] - [[package]] name = "lebe" version = "0.5.3" @@ -2363,6 +2376,15 @@ dependencies = [ "sha2", ] +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "maybe-rayon" version = "0.1.1" @@ -2397,6 +2419,21 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metal" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" +dependencies = [ + "bitflags 2.13.0", + "block", + "core-graphics-types 0.2.0", + "foreign-types", + "log", + "objc", + "paste", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -2407,17 +2444,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "misc-image-integration" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8021bf53776c68684f91b0eea6317b518d6b113db09fc929f51f1c01a760ca8f" -dependencies = [ - "image", - "resvg", - "zip", -] - [[package]] name = "moxcms" version = "0.8.1" @@ -2463,7 +2489,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows", + "windows 0.62.2", "zbus", ] @@ -2475,9 +2501,9 @@ checksum = "13d2233c9842d08cfe13f9eac96e207ca6a2ea10b80259ebe8ad0268be27d2af" [[package]] name = "naga" -version = "29.0.4" +version = "27.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df" +checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" dependencies = [ "arrayvec", "bit-set", @@ -2638,6 +2664,15 @@ dependencies = [ "syn", ] +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + [[package]] name = "objc-sys" version = "0.3.5" @@ -2791,7 +2826,7 @@ dependencies = [ "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", + "objc2-metal", ] [[package]] @@ -2908,18 +2943,6 @@ dependencies = [ "objc2-foundation 0.2.2", ] -[[package]] -name = "objc2-metal" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" -dependencies = [ - "bitflags 2.13.0", - "block2 0.6.2", - "objc2 0.6.4", - "objc2-foundation 0.3.2", -] - [[package]] name = "objc2-quartz-core" version = "0.2.2" @@ -2930,7 +2953,7 @@ dependencies = [ "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", + "objc2-metal", ] [[package]] @@ -2943,7 +2966,6 @@ dependencies = [ "objc2 0.6.4", "objc2-core-foundation", "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", ] [[package]] @@ -3042,16 +3064,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "os_pipe" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - [[package]] name = "owned_ttf_parser" version = "0.25.1" @@ -3118,23 +3130,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap", -] - -[[package]] -name = "pico-args" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" - [[package]] name = "pin-project" version = "1.1.13" @@ -3223,15 +3218,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" -[[package]] -name = "polycool" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" -dependencies = [ - "arrayvec", -] - [[package]] name = "portable-atomic" version = "1.13.1" @@ -3459,18 +3445,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" -[[package]] -name = "raw-window-metal" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" -dependencies = [ - "objc2 0.6.4", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", -] - [[package]] name = "rayon" version = "1.12.0" @@ -3493,13 +3467,13 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.37.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" +checksum = "6717cf23b488adf64b9d711329542ba34de147df262370221940dfabc2c91358" dependencies = [ "bytemuck", "core_maths", - "font-types 0.11.3", + "font-types 0.10.1", ] [[package]] @@ -3512,17 +3486,6 @@ dependencies = [ "font-types 0.11.3", ] -[[package]] -name = "read-fonts" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" -dependencies = [ - "bytemuck", - "font-types 0.12.3", - "once_cell", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -3567,24 +3530,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" -[[package]] -name = "resvg" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e3803f97b999e80cbf7c6ecdd07a8102204d92e1633cf48783720c521196bd" -dependencies = [ - "bytemuck", - "gif", - "image-webp", - "log", - "pico-args", - "rgb", - "svgtypes", - "tiny-skia 0.12.0", - "usvg", - "zune-jpeg", -] - [[package]] name = "rfd" version = "0.17.2" @@ -3617,9 +3562,6 @@ name = "rgb" version = "0.8.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" -dependencies = [ - "bytemuck", -] [[package]] name = "roxmltree" @@ -3627,15 +3569,6 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" -[[package]] -name = "roxmltree" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" -dependencies = [ - "memchr", -] - [[package]] name = "rustc-hash" version = "1.1.0" @@ -3719,8 +3652,8 @@ dependencies = [ "ab_glyph", "log", "memmap2", - "smithay-client-toolkit", - "tiny-skia 0.11.4", + "smithay-client-toolkit 0.19.2", + "tiny-skia", ] [[package]] @@ -3854,35 +3787,14 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" -[[package]] -name = "simplecss" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" -dependencies = [ - "log", -] - -[[package]] -name = "siphasher" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" - -[[package]] -name = "size" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6709c7b6754dca1311b3c73e79fcce40dd414c782c66d88e8823030093b02b" - [[package]] name = "skrifa" -version = "0.40.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" +checksum = "8c31071dedf532758ecf3fed987cdb4bd9509f900e026ab684b4ecb81ea49841" dependencies = [ "bytemuck", - "read-fonts 0.37.0", + "read-fonts 0.35.0", ] [[package]] @@ -3895,16 +3807,6 @@ dependencies = [ "read-fonts 0.39.2", ] -[[package]] -name = "skrifa" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" -dependencies = [ - "bytemuck", - "read-fonts 0.41.0", -] - [[package]] name = "slab" version = "0.4.12" @@ -3933,8 +3835,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.13.0", - "calloop", - "calloop-wayland-source", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", "cursor-icon", "libc", "log", @@ -3951,6 +3853,44 @@ dependencies = [ "xkeysym", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.0", + "calloop 0.14.4", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.4", + "thiserror 2.0.18", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + [[package]] name = "smol_str" version = "0.2.2" @@ -3960,12 +3900,6 @@ dependencies = [ "serde", ] -[[package]] -name = "smol_str" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523" - [[package]] name = "softbuffer" version = "0.4.8" @@ -3999,9 +3933,9 @@ dependencies = [ [[package]] name = "spirv" -version = "0.4.0+sdk-1.4.341.0" +version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ "bitflags 2.13.0", ] @@ -4023,9 +3957,6 @@ name = "strict-num" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" -dependencies = [ - "float-cmp", -] [[package]] name = "svg_fmt" @@ -4033,16 +3964,6 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb" -[[package]] -name = "svgtypes" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" -dependencies = [ - "kurbo 0.13.1", - "siphasher", -] - [[package]] name = "swash" version = "0.2.9" @@ -4200,22 +4121,7 @@ dependencies = [ "bytemuck", "cfg-if", "log", - "tiny-skia-path 0.11.4", -] - -[[package]] -name = "tiny-skia" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "png", - "tiny-skia-path 0.12.0", + "tiny-skia-path", ] [[package]] @@ -4229,17 +4135,6 @@ dependencies = [ "strict-num", ] -[[package]] -name = "tiny-skia-path" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - [[package]] name = "tiny-xlib" version = "0.2.5" @@ -4325,6 +4220,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4350,17 +4246,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tree_magic_mini" -version = "3.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" -dependencies = [ - "memchr", - "nom", - "petgraph", -] - [[package]] name = "ttf-parser" version = "0.25.1" @@ -4423,46 +4308,12 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" -[[package]] -name = "unicode-vo" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" - [[package]] name = "unicode-width" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" -[[package]] -name = "usvg" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977d0a4abdef933f424a99fe09f95576e089b90aebc6f016a3bc813762493e91" -dependencies = [ - "base64", - "data-url", - "flate2", - "fontdb 0.24.0", - "harfrust 0.12.0", - "imagesize", - "kurbo 0.13.1", - "log", - "pico-args", - "roxmltree 0.21.1", - "simplecss", - "siphasher", - "skrifa 0.44.0", - "strict-num", - "svgtypes", - "tiny-skia-path 0.12.0", - "unicode-bidi", - "unicode-script", - "unicode-vo", - "xmlwriter", -] - [[package]] name = "uuid" version = "1.23.4" @@ -4524,9 +4375,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.108" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" dependencies = [ "cfg-if", "once_cell", @@ -4537,23 +4388,19 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.58" +version = "0.4.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d" dependencies = [ - "cfg-if", - "futures-util", "js-sys", - "once_cell", "wasm-bindgen", - "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.108" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4561,9 +4408,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.108" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" dependencies = [ "bumpalo", "proc-macro2", @@ -4574,9 +4421,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.108" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" dependencies = [ "unicode-ident", ] @@ -4655,6 +4502,32 @@ dependencies = [ "wayland-scanner", ] +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.0", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-protocols-plasma" version = "0.3.12" @@ -4706,9 +4579,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.85" +version = "0.3.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" dependencies = [ "js-sys", "wasm-bindgen", @@ -4732,13 +4605,12 @@ checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" [[package]] name = "wgpu" -version = "29.0.4" +version = "27.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07" +checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" dependencies = [ "arrayvec", "bitflags 2.13.0", - "bytemuck", "cfg-if", "cfg_aliases", "document-features", @@ -4762,9 +4634,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "29.0.4" +version = "27.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7" +checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" dependencies = [ "arrayvec", "bit-set", @@ -4789,54 +4661,55 @@ dependencies = [ "wgpu-core-deps-emscripten", "wgpu-core-deps-windows-linux-android", "wgpu-hal", - "wgpu-naga-bridge", "wgpu-types", ] [[package]] name = "wgpu-core-deps-apple" -version = "29.0.4" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3" +checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-core-deps-emscripten" -version = "29.0.4" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af" +checksum = "b06ac3444a95b0813ecfd81ddb2774b66220b264b3e2031152a4a29fda4da6b5" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-core-deps-windows-linux-android" -version = "29.0.4" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257" +checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" dependencies = [ "wgpu-hal", ] [[package]] name = "wgpu-hal" -version = "29.0.4" +version = "27.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d" +checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" dependencies = [ "android_system_properties", "arrayvec", "ash", "bit-set", "bitflags 2.13.0", - "block2 0.6.2", + "block", "bytemuck", "cfg-if", "cfg_aliases", + "core-graphics-types 0.2.0", "glow", "glutin_wgl_sys", + "gpu-alloc", "gpu-allocator", "gpu-descriptor", "hashbrown 0.16.1", @@ -4845,13 +4718,10 @@ dependencies = [ "libc", "libloading", "log", + "metal", "naga", "ndk-sys", - "objc2 0.6.4", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", - "objc2-quartz-core 0.3.2", + "objc", "once_cell", "ordered-float", "parking_lot", @@ -4860,41 +4730,27 @@ dependencies = [ "profiling", "range-alloc", "raw-window-handle", - "raw-window-metal", "renderdoc-sys", "smallvec", "thiserror 2.0.18", "wasm-bindgen", - "wayland-sys", "web-sys", - "wgpu-naga-bridge", - "wgpu-types", - "windows", - "windows-core", - "windows-result", -] - -[[package]] -name = "wgpu-naga-bridge" -version = "29.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161" -dependencies = [ - "naga", "wgpu-types", + "windows 0.58.0", + "windows-core 0.58.0", ] [[package]] name = "wgpu-types" -version = "29.0.4" +version = "27.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5" +checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" dependencies = [ "bitflags 2.13.0", "bytemuck", "js-sys", "log", - "raw-window-handle", + "thiserror 2.0.18", "web-sys", ] @@ -4907,6 +4763,30 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "window_clipboard" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5654226305eaf2dde8853fb482861d28e5dcecbbd40cb88e8393d94bb80d733" +dependencies = [ + "clipboard-win", + "clipboard_macos", + "clipboard_wayland", + "clipboard_x11", + "raw-window-handle", + "thiserror 2.0.18", +] + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets", +] + [[package]] name = "windows" version = "0.62.2" @@ -4914,7 +4794,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ "windows-collections", - "windows-core", + "windows-core 0.62.2", "windows-future", "windows-numerics", ] @@ -4925,7 +4805,20 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core", + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", + "windows-targets", ] [[package]] @@ -4934,11 +4827,11 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.60.2", + "windows-interface 0.59.3", "windows-link", - "windows-result", - "windows-strings", + "windows-result 0.4.1", + "windows-strings 0.5.1", ] [[package]] @@ -4947,11 +4840,22 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core", + "windows-core 0.62.2", "windows-link", "windows-threading", ] +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "windows-implement" version = "0.60.2" @@ -4963,6 +4867,17 @@ dependencies = [ "syn", ] +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "windows-interface" version = "0.59.3" @@ -4986,10 +4901,19 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core", + "windows-core 0.62.2", "windows-link", ] +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-result" version = "0.4.1" @@ -4999,6 +4923,16 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets", +] + [[package]] name = "windows-strings" version = "0.5.1" @@ -5110,8 +5044,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.30.8" -source = "git+https://github.com/iced-rs/winit.git?rev=05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed#05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" dependencies = [ "ahash", "android-activity", @@ -5119,10 +5054,10 @@ dependencies = [ "bitflags 2.13.0", "block2 0.5.1", "bytemuck", - "calloop", + "calloop 0.13.0", "cfg_aliases", "concurrent-queue", - "core-foundation", + "core-foundation 0.9.4", "core-graphics", "cursor-icon", "dpi", @@ -5141,8 +5076,8 @@ dependencies = [ "redox_syscall 0.4.1", "rustix 0.38.44", "sctk-adwaita", - "smithay-client-toolkit", - "smol_str 0.2.2", + "smithay-client-toolkit 0.19.2", + "smol_str", "tracing", "unicode-segmentation", "wasm-bindgen", @@ -5174,24 +5109,6 @@ version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" -[[package]] -name = "wl-clipboard-rs" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9651471a32e87d96ef3a127715382b2d11cc7c8bb9822ded8a7cc94072eb0a3" -dependencies = [ - "libc", - "log", - "os_pipe", - "rustix 1.1.4", - "thiserror 2.0.18", - "tree_magic_mini", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-wlr", -] - [[package]] name = "x11-dl" version = "2.21.0" @@ -5255,12 +5172,6 @@ version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" -[[package]] -name = "xmlwriter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" - [[package]] name = "y4m" version = "0.8.0" diff --git a/Cargo.toml b/Cargo.toml index ccdbc3a..9015f09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,14 +6,11 @@ license = "AGPL-3.0-or-later" [dependencies] dirs = "6.0.0" -misc-image-integration = "0.1.0" -resvg = "0.48.1" rfd = "0.17.2" -size = "0.5.0" zip = "8.6.0" [dependencies.iced] -version = "0.15.0-dev" +version = "0.14.0" features = [ "image" ] [dependencies.image] @@ -24,6 +21,3 @@ features = [ "avif-native" ] version = "0.12.6" # I really wish the image crate was named better features = [ "image" ] - -[patch.crates-io] -iced.git = "https://github.com/iced-rs/iced" diff --git a/README.md b/README.md deleted file mode 100644 index 545d7ef..0000000 --- a/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# imagey - -image viewer and maybe editor; inspired by mpv's simplicity - -name is subject to change, suggestions welcome :) - -## usage - -```sh -# try it out! -nix run git+https://git.federated.nexus/electria/imagey - -# install it imperatively -nix profile install git+https://git.federated.nexus/electria/imagey -``` - -keybinds are shown on startup if you didn't start it with an image - -## known issues - -### JXL - -1. encoding is not implemented (jxl-oxide is decoding-only) -2. oreintation is incorrect in some cases - - if the image has metadata oreintation AND - - it's a jxl without the right extension OR - it's a jpeg with the jxl extension - - this is due to the JXL decoder automatically rotating the image, - while the JPEG decoder (for instance) requires the extra step. - - my workaround is to check the path of the input file, - not changing the oreintation if it has the jxl extension; - causing these caveats for cases where the extension is wrong. - -### clipboard - -1. large images (eg photos) don't seem to copy on linux/wayland, - (despite set_image not returning any error) diff --git a/flake.nix b/flake.nix index 2004328..40636f4 100644 --- a/flake.nix +++ b/flake.nix @@ -19,25 +19,22 @@ cargoToml = fromTOML (builtins.readFile ./Cargo.toml); name = cargoToml.package.name; - dlDeps = - with pkgs; - [ - # needed for both x11 and wayland - libxkbcommon - libGL + dlDeps = with pkgs; [ + # libdbus, for rfd + dbus - libx11 - libxcursor - libxi - libxcb - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - # libdbus, for rfd - dbus.lib + # needed for both x11 and wayland + libxkbcommon + libGL + vulkan-loader - vulkan-loader - wayland - ]; + wayland + + libx11 + libxcursor + libxi + libxcb + ]; commonArgs = { # all that's needed for artifacts and checks @@ -75,7 +72,6 @@ "image/bmp" "image/vnd.microsoft.icon" # .ico "application/x-krita" - "image/svg+xml" ]; }; in diff --git a/src/kra.rs b/src/kra.rs new file mode 100644 index 0000000..3642370 --- /dev/null +++ b/src/kra.rs @@ -0,0 +1,40 @@ +use std::{ + ffi::OsString, + io::{self, Read}, +}; + +use image::{ + ImageDecoder, ImageError, ImageReader, ImageResult, + error::DecodingError, + hooks::{self, GenericReader}, +}; +use zip::ZipArchive; + +pub fn register() -> bool { + hooks::register_decoding_hook(OsString::from("kra"), Box::new(hook)) +} + +fn hook<'a>(reader: GenericReader<'a>) -> ImageResult> { + let mut zip = ZipArchive::new(reader).map_err(to_image_error)?; + + let mut reader = zip.by_name("mergedimage.png").map_err(to_image_error)?; + + // reading it all and wrapping it with a Cursor + // is the only way I know to give it Seek + // (which is required by ImageReader) + let mut buf = Vec::new(); + reader.read_to_end(&mut buf)?; + + let image_reader = ImageReader::with_format(io::Cursor::new(buf), image::ImageFormat::Png); + + Ok(Box::new(image_reader.into_decoder()?)) +} + +fn to_image_error( + e: impl Into>, +) -> ImageError { + ImageError::Decoding(DecodingError::new( + image::error::ImageFormatHint::PathExtension("kra".into()), + e, + )) +} diff --git a/src/main.rs b/src/main.rs index 01ddd8f..9ac79ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,63 +1,38 @@ -use std::{ - borrow::Cow, - env, - ffi::OsStr, - os::unix::fs::MetadataExt, - path::{Path, PathBuf}, -}; +use std::{borrow::Cow, env, ffi::OsStr, path::Path}; use iced::{ - Alignment, Color, Element, Length, Renderer, Subscription, Task, Theme, clipboard, event, + Alignment, Color, Element, Length, Renderer, Subscription, Task, Theme, event, keyboard::{self, Key, key}, theme, widget, window, }; use image::{EncodableLayout, RgbaImage, imageops}; -use size::Size; +mod kra; mod utils; #[derive(Clone, Debug)] enum Message { - Open, - Rotate, - Invert, - Filter, - Bar, - Save, - Quit, - - Yank, - Put, - ImageYanked(Result<(), clipboard::Error>), - ImagePut(Result), - - FocusNext, - FocusPrevious, - - ImagePicked(Result>), ImageDisplayReady(Result), - SavePathPicked(Result>), - FileDropped(PathBuf), + Event(iced::Event), } -#[derive(Default)] +#[derive(Clone, Debug, Default)] struct State { - image: Option, image_display: Option, image_filter: widget::image::FilterMethod, - error: Option>, + error: Option, info: Option, infobar_shown: bool, } impl State { fn new() -> (Self, Task) { - let mut state = Self::default(); + let mut state = State::default(); if let Some(path) = env::args().nth(1) { match state.load_image(path) { - Err(e) => state.error = Some(e.into()), + Err(e) => state.error = Some(e), Ok(task) => return (state, task), } } @@ -65,148 +40,114 @@ impl State { (state, Task::none()) } fn view(&self) -> Element<'_, Message, Theme, Renderer> { - let main = self.image_display.as_ref().map_or_else( - || { - widget::container(widget::text(include_str!("usage.txt"))) - .height(Length::Fill) - .width(Length::Fill) - .align_x(Alignment::Center) - .align_y(Alignment::Center) - .into() - }, - |allocation| { - widget::image::viewer(allocation.handle().clone()) - .filter_method(self.image_filter) - .max_scale(50.) - .min_scale(1.) - .width(Length::Fill) - .height(Length::Fill) - .into() - }, - ); + let mut main = Vec::new(); + + main.push(if let Some(allocation) = self.image_display.as_ref() { + widget::image::viewer(allocation.handle().clone()) + .filter_method(self.image_filter) + .max_scale(50.) + .min_scale(1.) + .width(Length::Fill) + .height(Length::Fill) + .into() + } else { + widget::container(widget::text(include_str!("usage.txt"))) + .height(Length::Fill) + .width(Length::Fill) + .align_x(Alignment::Center) + .align_y(Alignment::Center) + .into() + }); - let mut bar = Vec::new(); if let Some(error) = self.error.as_ref() { - bar.push( - widget::container(widget::text(error).style(widget::text::danger)) - .align_x(Alignment::Start) - .width(Length::Fill) - .into(), - ); + main.push(widget::text(error).style(widget::text::danger).into()); } if self.infobar_shown && self.info.is_some() { - bar.push( - widget::container(widget::text(self.title())) - .align_x(Alignment::End) - .width(Length::Fill) - .into(), - ); + main.push(widget::text(self.title()).into()); } - widget::column([main, widget::row(bar).into()]).into() + widget::column(main).into() } fn update(&mut self, message: Message) -> Task { match message { - Message::ImagePicked(result) => { - match result.and_then(|path| self.load_image(path).map_err(Cow::from)) { - Err(e) => self.error = Some(e.into()), + Message::ImageDisplayReady(result) => { + self.image_display = Some(result.unwrap()); + } + + Message::Event(iced::Event::Keyboard(keyboard::Event::KeyPressed { + key, + modifiers, + .. + })) => match key.as_ref() { + // input field cycling + Key::Named(key::Named::Tab) => { + if modifiers.shift() { + return widget::operation::focus_previous(); + } else { + return widget::operation::focus_next(); + } + } + + Key::Character("o") => match self.pick_and_load_image() { Ok(task) => { self.error = None; return task; } + Err(e) => self.error = Some(e), + }, + + Key::Character("r") => { + match self.image.as_ref() { + None => self.error = Some("no image to rotate".into()), + Some(image) => { + self.error = None; + self.image = Some(imageops::rotate90(image)); + return self.allocate_image(); + } + }; } - } - Message::ImageDisplayReady(result) => { - self.image_display = Some(result.unwrap()); - } - Message::SavePathPicked(result) => { - self.error = result - .map_err(Cow::from) - .and_then(|path| { - self.image.as_ref().map_or_else( - || Err("no image to save".into()), - |image| image.save(path).map_err(|e| e.to_string().into()), - ) - }) - .err(); - } - - Message::FocusNext => return widget::operation::focus_next(), - Message::FocusPrevious => return widget::operation::focus_previous(), - - Message::Open => { - return Task::perform(utils::pick_image(), Message::ImagePicked); - } - - Message::Rotate => match self.image.as_ref() { - None => self.error = Some("no image to rotate".into()), - Some(image) => { - self.error = None; - self.image = Some(imageops::rotate90(image)); - return self.allocate_image(); + Key::Character("i") => { + match self.image.as_mut() { + None => self.error = Some("no image to invert".into()), + Some(image) => { + self.error = None; + imageops::invert(image); + return self.allocate_image(); + } + }; } - }, - Message::Invert => match self.image.as_mut() { - None => self.error = Some("no image to invert".into()), - Some(image) => { - self.error = None; - imageops::invert(image); - return self.allocate_image(); - } - }, - Message::Filter => { - self.image_filter = match self.image_filter { - widget::image::FilterMethod::Linear => widget::image::FilterMethod::Nearest, - widget::image::FilterMethod::Nearest => widget::image::FilterMethod::Linear, - } - } - Message::Bar => { - self.infobar_shown = !self.infobar_shown; - } - - Message::Save => { - if self.image.is_some() { - self.error = None; - return Task::perform(utils::pick_save_path(), Message::SavePathPicked); - } - self.error = Some("no image to save".into()); - } - - Message::Quit => return window::latest().and_then(window::close), - - Message::Yank => { - if let Some(image) = self.image.as_ref() { - return clipboard::write(utils::clipboard_image_from_rgbaimage(&image)) - .map(Message::ImageYanked); - } else { - self.error = Some("no image to yank".into()); - } - } - Message::Put => return clipboard::read_image().map(Message::ImagePut), - - Message::ImageYanked(result) => { - self.error = result.err().map(|e| format!("{e:?}").into()); - } - Message::ImagePut(result) => { - self.error = result.as_ref().err().map(|e| format!("{e:?}").into()); - - if let Ok(image) = result { - self.info = Some(format!("{}x{}", image.size.width, image.size.height,)); - if (image.size.width, image.size.height) < (100, 100) { - self.image_filter = widget::image::FilterMethod::Nearest; + Key::Character("f") => { + self.image_filter = match self.image_filter { + widget::image::FilterMethod::Linear => widget::image::FilterMethod::Nearest, + widget::image::FilterMethod::Nearest => widget::image::FilterMethod::Linear, } - self.image = Some(utils::rgbaimage_from_clipboard_image(image)); - return self.allocate_image(); + } + Key::Character("b") => { + self.infobar_shown = !self.infobar_shown; + } + + Key::Character("s") => { + self.save_image(); + } + + Key::Character("q") => return window::latest().and_then(window::close), + + // ignore unused keys + _ => {} + }, + + Message::Event(iced::Event::Window(window::Event::FileDropped(file))) => { + match self.load_image(file) { + Ok(task) => { + self.error = None; + return task; + } + Err(e) => self.error = Some(e), } } - Message::FileDropped(path) => match self.load_image(path) { - Ok(task) => { - self.error = None; - return task; - } - Err(e) => self.error = Some(e.into()), - }, + // ignore unused events + Message::Event(_) => {} } Task::none() @@ -215,110 +156,64 @@ impl State { fn load_image(&mut self, path: impl AsRef) -> Result, String> { utils::load_image(&path).map(|image| { self.info = Some(format!( - "{} {} {}x{}", + "{} {}x{}", path.as_ref() .file_name() - .map_or(Cow::Borrowed("[no file]"), OsStr::to_string_lossy), - path.as_ref().metadata().map_or_else( - |e| { - eprintln!("failed to read metadata: {e}"); - Cow::Borrowed("[no size]") - }, - |m| Cow::Owned(Size::from_bytes(m.size()).to_string()) - ), + .map(OsStr::to_string_lossy) + .unwrap_or(Cow::Borrowed("[no file]")), image.width(), image.height(), )); if image.dimensions() < (100, 100) { self.image_filter = widget::image::FilterMethod::Nearest; } - self.image = Some(image); - self.allocate_image() + self.allocate_image(image) }) } + fn pick_and_load_image(&mut self) -> Result, String> { + utils::pick_image().and_then(|path| self.load_image(path)) + } - fn allocate_image(&self) -> Task { - let Some(image) = self.image.as_ref() else { - eprintln!("no image to allocate"); - return Task::none(); - }; + fn save_image(&mut self) { + self.error = utils::save_image(self.image.as_ref()).err(); + } + fn allocate_image(&self, image: RgbaImage) -> Task { widget::image::allocate(widget::image::Handle::from_rgba( image.width(), image.height(), - // SAFETY: this is a sort of race condition; - // will cause panics with large enough images, - // when they are edited consecutively. - // - // this can be reproduced by holding down 'i' with a 10k by 10k px image, - // which will invert the colors rapidly and eventually crash the app. - // - // however, that is not such a problem in this case, - // and I don't know a different way of doing this that doesn't copy - // (performance loss, which is can be pretty big) - // or likely cause flickering instead in such cases - // (like using Handle over Allocation to immediately drop the last one) - unsafe { std::mem::transmute::<&[u8], &'static [u8]>(image.as_bytes()) }, + image.into_vec(), )) .map(Message::ImageDisplayReady) } fn subscription(&self) -> Subscription { - event::listen().filter_map(|event| match event { - iced::Event::Keyboard(keyboard::Event::KeyPressed { key, modifiers, .. }) => { - match key.as_ref() { - Key::Named(key::Named::Tab) => Some(if modifiers.shift() { - Message::FocusPrevious - } else { - Message::FocusNext - }), - - Key::Character("o") => Some(Message::Open), - Key::Character("r") => Some(Message::Rotate), - Key::Character("i") => Some(Message::Invert), - Key::Character("f") => Some(Message::Filter), - Key::Character("b") => Some(Message::Bar), - Key::Character("s") => Some(Message::Save), - Key::Character("q") => Some(Message::Quit), - - Key::Character("y") | Key::Character("c") => Some(Message::Yank), - Key::Character("p") | Key::Character("v") => Some(Message::Put), - - _ => None, - } - } - iced::Event::Window(window::Event::FileDropped(path)) => { - Some(Message::FileDropped(path)) - } - _ => None, - }) + event::listen().map(Message::Event) } fn title(&self) -> String { - self.info.as_ref().map_or_else( - || "imagey".into(), - |info| { - format!( - "imagey {info} {}", - utils::string_from_filter_type(self.image_filter), - ) - }, - ) + match self.info.as_ref() { + Some(info) => format!( + "imagey {info} {}", + utils::string_from_filter_type(self.image_filter), + ), + None => "imagey".into(), + } } } fn main() -> Result<(), iced::Error> { jxl_oxide::integration::register_image_decoding_hook(); - misc_image_integration::register(); + kra::register(); iced::application(State::new, State::update, State::view) .subscription(State::subscription) .title(State::title) .theme(Theme::custom( "custom", - theme::palette::Seed { + theme::Palette { background: Color::BLACK, text: Color::WHITE, - ..theme::palette::Seed::DARK + ..theme::Palette::DARK }, )) .run() diff --git a/src/usage.txt b/src/usage.txt index 9df1bc2..1d4c6c1 100644 --- a/src/usage.txt +++ b/src/usage.txt @@ -5,6 +5,3 @@ 'b' to toggle the bar 's' to save the image 'q' to quit - -'y' or 'c' to yank -'p' or 'v' to put diff --git a/src/utils.rs b/src/utils.rs index 5158c08..c59c7e7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,18 +1,26 @@ -use std::{ - borrow::Cow, - ffi::OsStr, - path::{Path, PathBuf}, -}; +use std::path::{Path, PathBuf}; -use iced::{clipboard, widget}; -use image::{DynamicImage, EncodableLayout, ImageDecoder, ImageReader, ImageResult, RgbaImage}; -use rfd::AsyncFileDialog; +use iced::widget; +use image::{DynamicImage, ImageDecoder, ImageReader, ImageResult, RgbaImage}; +use rfd::FileDialog; + +pub fn image_from_handle(handle: widget::image::Handle) -> RgbaImage { + match handle { + widget::image::Handle::Rgba { + id, + width, + height, + pixels, + } => RgbaImage::from_raw(width, height, pixels.as_ref()).unwrap(), + _ => panic!("handle should always hold rgba data"), + } +} pub fn load_image(path: impl AsRef) -> Result { - load_image_impl(path).map_err(|e| e.to_string()) + _load_image(path).map_err(|e| e.to_string()) } -fn load_image_impl(path: impl AsRef) -> ImageResult { - let mut decoder = ImageReader::open(&path)? +fn _load_image(path: impl AsRef) -> ImageResult { + let mut decoder = ImageReader::open(path)? .with_guessed_format()? .into_decoder()?; @@ -20,65 +28,46 @@ fn load_image_impl(path: impl AsRef) -> ImageResult { let mut decoded_image = DynamicImage::from_decoder(decoder)?; - // the condition is a workaround to not rotate JXL images twice; - // since they are already rotated by the decoder - // (while jpegs for instance aren't) - if !path - .as_ref() - .extension() - .map(OsStr::to_string_lossy) - .is_some_and(|s| s == "jxl") - { - decoded_image.apply_orientation(oreintation); - } + decoded_image.apply_orientation(oreintation); Ok(decoded_image.into_rgba8()) } -pub async fn pick_image() -> Result> { - let Some(filehandle) = AsyncFileDialog::new() +pub fn pick_image() -> Result { + let Some(path) = FileDialog::new() .add_filter( "image", &[ "png", "PNG", "jpg", "JPG", "jpeg", "JPEG", "avif", "jxl", "bmp", "exr", "ff", - "gif", "hdr", "ico", "pnm", "qoi", "tga", "tiff", "webp", "kra", "svg", "svgz", + "gif", "hdr", "ico", "pnm", "qoi", "tga", "tiff", "webp", "kra", ], ) .pick_file() - .await else { return Err("no path to open provided".into()); }; - Ok(filehandle.path().to_owned()) + Ok(path) } -pub async fn pick_save_path() -> Result> { - let Some(filehandle) = AsyncFileDialog::new().save_file().await else { +pub fn save_image(image: Option<&RgbaImage>) -> Result<(), String> { + let Some(image) = image else { + return Err("no image to save".into()); + }; + + let Some(path) = FileDialog::new().save_file() else { return Err("no path to save provided".into()); }; - Ok(filehandle.path().to_owned()) + if let Err(e) = image.save(&path) { + return Err(e.to_string()); + }; + + Ok(()) } -pub const fn string_from_filter_type(f: widget::image::FilterMethod) -> &'static str { +pub fn string_from_filter_type(f: widget::image::FilterMethod) -> &'static str { match f { widget::image::FilterMethod::Linear => "bilinear", widget::image::FilterMethod::Nearest => "nearest neighbor", } } - -pub fn clipboard_image_from_rgbaimage(image: &RgbaImage) -> clipboard::Image { - clipboard::Image { - size: (image.width(), image.height()).into(), - // SAFETY: this is also probably a race condition, - // where if the user switches the image before it's done, - // then something will die. - // - // however, especially with larger images, - // copying them is just too expensive. - rgba: unsafe { std::mem::transmute::<&[u8], &'static [u8]>(image.as_bytes()) }.into(), - } -} -pub fn rgbaimage_from_clipboard_image(image: clipboard::Image) -> RgbaImage { - RgbaImage::from_raw(image.size.width, image.size.height, image.rgba.into()).unwrap() -}