From adcbafbd8e5a7912f3f5d7c1fab14fb32dee2036 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 20 Dec 2024 09:52:05 -0500 Subject: [PATCH] Update to git Parley and Vello. (#798) This brings the new releases of Color and Peniko and start making sure things are good for the upcoming releases of Parley and Vello. --- .github/workflows/ci.yml | 2 +- Cargo.lock | 285 +++++++----------- Cargo.toml | 10 +- README.md | 2 +- masonry/Cargo.toml | 2 +- masonry/README.md | 2 +- masonry/examples/calc_masonry.rs | 8 +- masonry/examples/custom_widget.rs | 18 +- masonry/examples/grid_masonry.rs | 2 +- masonry/examples/simple_image.rs | 9 +- masonry/src/testing/harness.rs | 2 +- masonry/src/theme.rs | 81 ++--- masonry/src/widget/button.rs | 2 +- masonry/src/widget/image.rs | 13 +- .../masonry__widget__button__tests__hello.png | 4 +- ...onry__widget__grid__tests__initial_1x1.png | 4 +- ...onry__widget__grid__tests__moved_2x2_2.png | 4 +- ...__widget__grid__tests__with_2x2_widget.png | 4 +- ...get__grid__tests__with_changed_spacing.png | 4 +- ...et__grid__tests__with_negative_spacing.png | 4 +- ...__widget__image__tests__layout_contain.png | 4 +- ...ry__widget__image__tests__layout_cover.png | 4 +- ...nry__widget__image__tests__layout_fill.png | 4 +- ...widget__image__tests__layout_fitheight.png | 4 +- ..._widget__image__tests__layout_fitwidth.png | 4 +- ...onry__widget__image__tests__tall_paint.png | 4 +- ...ress_bar__tests__0_percent_progressbar.png | 4 +- ...ss_bar__tests__100_percent_progressbar.png | 4 +- ...ess_bar__tests__25_percent_progressbar.png | 4 +- ...ess_bar__tests__50_percent_progressbar.png | 4 +- ...ess_bar__tests__75_percent_progressbar.png | 4 +- ..._bar__tests__indeterminate_progressbar.png | 4 +- masonry/src/widget/sized_box.rs | 33 +- masonry/src/widget/spinner.rs | 12 +- masonry/src/widget/text_area.rs | 20 +- xilem/README.md | 2 +- xilem/examples/calc.rs | 7 +- xilem/examples/http_cats.rs | 7 +- xilem/examples/mason.rs | 5 +- xilem/examples/variable_clock.rs | 10 +- xilem_core/README.md | 2 +- xilem_web/README.md | 2 +- xilem_web/src/svg/common_attrs.rs | 36 ++- xilem_web/web_examples/svgdraw/src/main.rs | 27 +- xilem_web/web_examples/svgtoy/src/main.rs | 9 +- 45 files changed, 337 insertions(+), 345 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25443a8f7..ceb39d0b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: # If the compilation fails, then the version specified here needs to be bumped up to reality. # Be sure to also update the rust-version property in the workspace Cargo.toml file, # plus all the README.md files of the affected packages. - RUST_MIN_VER: "1.81" + RUST_MIN_VER: "1.82" # List of packages that can not target Wasm. NO_WASM_PKGS: "--exclude masonry --exclude xilem" # Only some of our examples support Android (primarily due to extra required boilerplate). diff --git a/Cargo.lock b/Cargo.lock index cb31d92b2..5be12afc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -92,8 +92,8 @@ dependencies = [ "hashbrown 0.15.2", "paste", "static_assertions", - "windows 0.58.0", - "windows-core 0.58.0", + "windows", + "windows-core", ] [[package]] @@ -342,7 +342,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -377,7 +377,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -466,18 +466,18 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bit-set" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -551,7 +551,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -644,34 +644,12 @@ dependencies = [ ] [[package]] -name = "com" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6" -dependencies = [ - "com_macros", -] - -[[package]] -name = "com_macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5" -dependencies = [ - "com_macros_support", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "com_macros_support" -version = "0.6.0" +name = "color" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" +checksum = "212bb4103d3dc3eca9f7b665588528dee3a42fc03272b2db5ffa3010dc84b39c" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "serde", ] [[package]] @@ -838,17 +816,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" -[[package]] -name = "d3d12" -version = "22.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017" -dependencies = [ - "bitflags 2.6.0", - "libloading", - "winapi", -] - [[package]] name = "deranged" version = "0.3.11" @@ -882,7 +849,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -955,7 +922,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -1070,6 +1037,15 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "font-types" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11c3a23a5a151afb1f74ea797f8c300dee41eff9ee3cb1bf94ed316d860c46b3" +dependencies = [ + "bytemuck", +] + [[package]] name = "fontconfig-cache-parser" version = "0.2.0" @@ -1083,7 +1059,7 @@ dependencies = [ [[package]] name = "fontique" version = "0.2.0" -source = "git+https://github.com/linebender/parley?rev=1a8740d8d86ebf751201e45e89bb71019340137d#1a8740d8d86ebf751201e45e89bb71019340137d" +source = "git+https://github.com/linebender/parley?rev=16b62518d467487ee15cb230fdb28530d89a8cf6#16b62518d467487ee15cb230fdb28530d89a8cf6" dependencies = [ "bytemuck", "core-foundation", @@ -1095,11 +1071,11 @@ dependencies = [ "objc2", "objc2-foundation", "peniko", - "read-fonts", + "read-fonts 0.22.5", "roxmltree", "smallvec", - "windows 0.58.0", - "windows-core 0.58.0", + "windows", + "windows-core", ] [[package]] @@ -1120,7 +1096,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -1218,7 +1194,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -1261,7 +1237,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows 0.58.0", + "windows", ] [[package]] @@ -1358,9 +1334,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.13.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" +checksum = "d51fa363f025f5c111e03f13eda21162faeacb6911fe8caa0c0349f9cf0c4483" dependencies = [ "js-sys", "slotmap", @@ -1398,15 +1374,14 @@ dependencies = [ [[package]] name = "gpu-allocator" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd4240fc91d3433d5e5b0fc5b67672d771850dc19bbee03c1381e19322803d7" +checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" dependencies = [ "log", "presser", "thiserror 1.0.69", - "winapi", - "windows 0.52.0", + "windows", ] [[package]] @@ -1460,21 +1435,6 @@ dependencies = [ "foldhash", ] -[[package]] -name = "hassle-rs" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" -dependencies = [ - "bitflags 2.6.0", - "com", - "libc", - "libloading", - "thiserror 1.0.69", - "widestring", - "winapi", -] - [[package]] name = "hermit-abi" version = "0.4.0" @@ -1704,7 +1664,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -2070,9 +2030,9 @@ dependencies = [ [[package]] name = "naga" -version = "22.1.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" +checksum = "3d5941e45a15b53aad4375eedf02033adb7a28931eedc31117faffa52e6a857e" dependencies = [ "arrayvec", "bit-set", @@ -2184,7 +2144,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -2507,13 +2467,13 @@ dependencies = [ [[package]] name = "parley" version = "0.2.0" -source = "git+https://github.com/linebender/parley?rev=1a8740d8d86ebf751201e45e89bb71019340137d#1a8740d8d86ebf751201e45e89bb71019340137d" +source = "git+https://github.com/linebender/parley?rev=16b62518d467487ee15cb230fdb28530d89a8cf6#16b62518d467487ee15cb230fdb28530d89a8cf6" dependencies = [ "accesskit", "fontique", "hashbrown 0.15.2", "peniko", - "skrifa", + "skrifa 0.22.3", "swash", ] @@ -2525,10 +2485,11 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "peniko" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a648c93f502a0bef0a9cb47fa1335994958a2744667d3f82defe513f276741a" +checksum = "c7de2e49a1a6b7a55ec3ba866a423f46cd8f31472bfaabe42c68e144c27bc668" dependencies = [ + "color", "kurbo", "smallvec", ] @@ -2556,7 +2517,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -2678,7 +2639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" dependencies = [ "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -2821,7 +2782,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a04b892cb6f91951f144c33321843790c8574c825aafdb16d815fd7183b5229" dependencies = [ "bytemuck", - "font-types", + "font-types 0.7.3", +] + +[[package]] +name = "read-fonts" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4b40e5383c077b9eb19c80c64d47d1369479a136aeae9a23c3ea43e970407b" +dependencies = [ + "bytemuck", + "font-types 0.8.2", ] [[package]] @@ -3077,22 +3048,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -3115,7 +3086,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -3184,7 +3155,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe" dependencies = [ "bytemuck", - "read-fonts", + "read-fonts 0.22.5", +] + +[[package]] +name = "skrifa" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a16eb047396452019439e1d6eca13581c141275b7d743f0262f79d65c09c70" +dependencies = [ + "bytemuck", + "read-fonts 0.25.2", ] [[package]] @@ -3338,18 +3319,7 @@ version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbd59f3f359ddd2c95af4758c18270eddd9c730dde98598023cdabff472c2ca2" dependencies = [ - "skrifa", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "skrifa 0.22.3", ] [[package]] @@ -3380,7 +3350,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -3431,7 +3401,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -3442,7 +3412,7 @@ checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -3620,7 +3590,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -3818,18 +3788,16 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vello" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc44dd4eb9af6a41551b9a82c93d068bd832693d6f78ab118ad19780d8e1202e" +source = "git+https://github.com/linebender/vello?rev=a71236c7c8da10a6eaad4602267663339620835a#a71236c7c8da10a6eaad4602267663339620835a" dependencies = [ "bytemuck", "futures-intrusive", "log", "peniko", "png", - "raw-window-handle", - "skrifa", + "skrifa 0.26.2", "static_assertions", - "thiserror 1.0.69", + "thiserror 2.0.4", "vello_encoding", "vello_shaders", "wgpu", @@ -3839,25 +3807,23 @@ dependencies = [ [[package]] name = "vello_encoding" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8110c14702a4e17f9200f6e3c4fe05dda5a22bf031ae4feafed4a61429f66fb2" +source = "git+https://github.com/linebender/vello?rev=a71236c7c8da10a6eaad4602267663339620835a#a71236c7c8da10a6eaad4602267663339620835a" dependencies = [ "bytemuck", "guillotiere", "peniko", - "skrifa", + "skrifa 0.26.2", "smallvec", ] [[package]] name = "vello_shaders" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cad02d6f29f2212a6ee382a8fec6f9977d0cceefacf07f8e361607ffe3988d" +source = "git+https://github.com/linebender/vello?rev=a71236c7c8da10a6eaad4602267663339620835a#a71236c7c8da10a6eaad4602267663339620835a" dependencies = [ "bytemuck", "naga", - "thiserror 1.0.69", + "thiserror 2.0.4", "vello_encoding", ] @@ -3914,7 +3880,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.90", + "syn", "wasm-bindgen-shared", ] @@ -3949,7 +3915,7 @@ checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4100,9 +4066,9 @@ dependencies = [ [[package]] name = "wgpu" -version = "22.1.0" +version = "23.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" +checksum = "80f70000db37c469ea9d67defdc13024ddf9a5f1b89cb2941b812ad7cde1735a" dependencies = [ "arrayvec", "cfg_aliases 0.1.1", @@ -4125,9 +4091,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "22.1.0" +version = "23.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a" +checksum = "d63c3c478de8e7e01786479919c8769f62a22eec16788d8c2ac77ce2c132778a" dependencies = [ "arrayvec", "bit-vec", @@ -4150,9 +4116,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "22.0.0" +version = "23.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f" +checksum = "89364b8a0b211adc7b16aeaf1bd5ad4a919c1154b44c9ce27838213ba05fd821" dependencies = [ "android_system_properties", "arrayvec", @@ -4160,15 +4126,14 @@ dependencies = [ "bit-set", "bitflags 2.6.0", "block", + "bytemuck", "cfg_aliases 0.1.1", "core-graphics-types", - "d3d12", "glow", "glutin_wgl_sys", "gpu-alloc", "gpu-allocator", "gpu-descriptor", - "hassle-rs", "js-sys", "khronos-egl", "libc", @@ -4190,14 +4155,15 @@ dependencies = [ "wasm-bindgen", "web-sys", "wgpu-types", - "winapi", + "windows", + "windows-core", ] [[package]] name = "wgpu-profiler" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06b2cee91fdc885ff0d3d714c59810cc72c6d84b81b0eaa48bab8ff2ad54fb5b" +checksum = "43016a1a244a8ca4c3543441dc68d0c970430c74d6d9a17ae016426e2d3fdb08" dependencies = [ "parking_lot", "thiserror 1.0.69", @@ -4207,21 +4173,15 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "22.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d" +checksum = "610f6ff27778148c31093f3b03abc4840f9636d58d597ca2f5977433acfe0068" dependencies = [ "bitflags 2.6.0", "js-sys", "web-sys", ] -[[package]] -name = "widestring" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" - [[package]] name = "winapi" version = "0.3.9" @@ -4253,32 +4213,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.6", -] - [[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 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ + "windows-core", "windows-targets 0.52.6", ] @@ -4303,7 +4244,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -4314,7 +4255,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -4757,7 +4698,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", "synstructure", ] @@ -4817,7 +4758,7 @@ checksum = "709ab20fc57cb22af85be7b360239563209258430bccf38d8b979c5a2ae3ecce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", "zbus-lockstep", "zbus_xml", "zvariant", @@ -4832,7 +4773,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn", "zvariant_utils", ] @@ -4878,7 +4819,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -4898,7 +4839,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", "synstructure", ] @@ -4927,7 +4868,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] [[package]] @@ -4967,7 +4908,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.90", + "syn", "zvariant_utils", ] @@ -4979,5 +4920,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index 51c3a09d3..2b9bbb7d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ members = [ [workspace.package] edition = "2021" # Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files. -rust-version = "1.81" +rust-version = "1.82" license = "Apache-2.0" repository = "https://github.com/linebender/xilem" homepage = "https://xilem.dev/" @@ -104,13 +104,13 @@ clippy.duplicated_attributes = "allow" masonry = { version = "0.2.0", path = "masonry" } xilem_core = { version = "0.1.0", path = "xilem_core" } tree_arena = { version = "0.1.0", path = "tree_arena" } -vello = "0.3" -wgpu = "22.1.0" +vello = { git = "https://github.com/linebender/vello", rev = "a71236c7c8da10a6eaad4602267663339620835a" } +wgpu = "23.0.1" kurbo = "0.11.1" -parley = { git = "https://github.com/linebender/parley", rev = "1a8740d8d86ebf751201e45e89bb71019340137d", features = [ +parley = { git = "https://github.com/linebender/parley", rev = "16b62518d467487ee15cb230fdb28530d89a8cf6", features = [ "accesskit", ] } -peniko = "0.2.0" +peniko = "0.3.0" winit = "0.30.4" tracing = { version = "0.1.40", default-features = false } smallvec = "1.13.2" diff --git a/README.md b/README.md index 337b7a7ce..e5990dcba 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ sudo apt-get install clang libwayland-dev libxkbcommon-x11-dev libvulkan-dev ## Minimum supported Rust Version (MSRV) -This version of Xilem has been verified to compile with **Rust 1.81** and later. +This version of Xilem has been verified to compile with **Rust 1.82** and later. Future versions of Xilem might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/masonry/Cargo.toml b/masonry/Cargo.toml index 4d17534db..92a7e9734 100644 --- a/masonry/Cargo.toml +++ b/masonry/Cargo.toml @@ -56,7 +56,7 @@ cursor-icon = "1.1.0" dpi.workspace = true nv-flip.workspace = true tracing-tracy = { version = "0.11.3", optional = true } -wgpu-profiler = { optional = true, version = "0.18.2", default-features = false } +wgpu-profiler = { optional = true, version = "0.19.0", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] web-time.workspace = true diff --git a/masonry/README.md b/masonry/README.md index fd6d4e5c7..41f8c1375 100644 --- a/masonry/README.md +++ b/masonry/README.md @@ -115,7 +115,7 @@ The following feature flags are available: ## Minimum supported Rust Version (MSRV) -This version of Masonry has been verified to compile with **Rust 1.81** and later. +This version of Masonry has been verified to compile with **Rust 1.82** and later. Future versions of Masonry might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/masonry/examples/calc_masonry.rs b/masonry/examples/calc_masonry.rs index dfd8b43b0..a54b3bf1f 100644 --- a/masonry/examples/calc_masonry.rs +++ b/masonry/examples/calc_masonry.rs @@ -271,8 +271,8 @@ impl AppDriver for CalcState { // --- fn op_button_with_label(op: char, label: String) -> CalcButton { - const BLUE: Color = Color::rgb8(0x00, 0x8d, 0xdd); - const LIGHT_BLUE: Color = Color::rgb8(0x5c, 0xc4, 0xff); + const BLUE: Color = Color::from_rgba8(0x00, 0x8d, 0xdd, 0xff); + const LIGHT_BLUE: Color = Color::from_rgba8(0x5c, 0xc4, 0xff, 0xff); CalcButton::new( SizedBox::new(Align::centered( @@ -291,8 +291,8 @@ fn op_button(op: char) -> CalcButton { } fn digit_button(digit: u8) -> CalcButton { - const GRAY: Color = Color::rgb8(0x3a, 0x3a, 0x3a); - const LIGHT_GRAY: Color = Color::rgb8(0x71, 0x71, 0x71); + const GRAY: Color = Color::from_rgba8(0x3a, 0x3a, 0x3a, 0xff); + const LIGHT_GRAY: Color = Color::from_rgba8(0x71, 0x71, 0x71, 0xff); CalcButton::new( SizedBox::new(Align::centered( Label::new(format!("{digit}")).with_style(StyleProperty::FontSize(24.)), diff --git a/masonry/examples/custom_widget.rs b/masonry/examples/custom_widget.rs index 65438c1c3..df0353054 100644 --- a/masonry/examples/custom_widget.rs +++ b/masonry/examples/custom_widget.rs @@ -22,7 +22,7 @@ use parley::layout::Alignment; use parley::style::{FontFamily, FontStack, StyleProperty}; use smallvec::SmallVec; use tracing::{trace_span, Span}; -use vello::peniko::{Fill, Format, Image}; +use vello::peniko::{color::palette, Fill, Image, ImageFormat}; use vello::Scene; use winit::window::Window; @@ -73,14 +73,20 @@ impl Widget for CustomWidget { // and we only want to clear this widget's area. let size = ctx.size(); let rect = size.to_rect(); - scene.fill(Fill::NonZero, Affine::IDENTITY, Color::WHITE, None, &rect); + scene.fill( + Fill::NonZero, + Affine::IDENTITY, + palette::css::WHITE, + None, + &rect, + ); // Create an arbitrary bezier path let mut path = BezPath::new(); path.move_to(Point::ORIGIN); path.quad_to((60.0, 120.0), (size.width, size.height)); // Create a color - let stroke_color = Color::rgb8(0, 128, 0); + let stroke_color = Color::from_rgba8(0, 128, 0, 255); // Stroke the path with thickness 5.0 scene.stroke( &Stroke::new(5.0), @@ -92,8 +98,8 @@ impl Widget for CustomWidget { // Rectangles: the path for practical people let rect = Rect::from_origin_size((10.0, 10.0), (100.0, 100.0)); - // Note the Color:rgba8 which includes an alpha channel (7F in this case) - let fill_color = Color::rgba8(0x00, 0x00, 0x00, 0x7F); + // Note the Color:from_rgba8 which includes an alpha channel (7F in this case) + let fill_color = Color::from_rgba8(0x00, 0x00, 0x00, 0x7F); scene.fill(Fill::NonZero, Affine::IDENTITY, fill_color, None, &rect); // To render text, we first create a LayoutBuilder and set the text properties. @@ -120,7 +126,7 @@ impl Widget for CustomWidget { // Let's burn some CPU to make a (partially transparent) image buffer let image_data = make_image_data(256, 256); - let image_data = Image::new(image_data.into(), Format::Rgba8, 256, 256); + let image_data = Image::new(image_data.into(), ImageFormat::Rgba8, 256, 256); let transform = ObjectFit::Fill.affine_to_fill(ctx.size(), size); scene.draw_image(&image_data, transform); } diff --git a/masonry/examples/grid_masonry.rs b/masonry/examples/grid_masonry.rs index e8fe50c9e..9eba0b76f 100644 --- a/masonry/examples/grid_masonry.rs +++ b/masonry/examples/grid_masonry.rs @@ -48,7 +48,7 @@ fn main() { .with_style(StyleProperty::FontSize(14.0)) .with_alignment(Alignment::Middle), )) - .border(Color::rgb8(40, 40, 80), 1.0); + .border(Color::from_rgba8(40, 40, 80, 255), 1.0); let button_inputs = vec![ GridParams { x: 0, diff --git a/masonry/examples/simple_image.rs b/masonry/examples/simple_image.rs index 46ac1ee04..e5d460cb3 100644 --- a/masonry/examples/simple_image.rs +++ b/masonry/examples/simple_image.rs @@ -11,7 +11,7 @@ use masonry::dpi::LogicalSize; use masonry::widget::{Image, ObjectFit, RootWidget}; use masonry::{Action, AppDriver, DriverCtx, WidgetId}; -use vello::peniko::{Format, Image as ImageBuf}; +use vello::peniko::{Image as ImageBuf, ImageFormat}; use winit::window::Window; struct Driver; @@ -24,7 +24,12 @@ fn main() { let image_bytes = include_bytes!("./assets/PicWithAlpha.png"); let image_data = image::load_from_memory(image_bytes).unwrap().to_rgba8(); let (width, height) = image_data.dimensions(); - let png_data = ImageBuf::new(image_data.to_vec().into(), Format::Rgba8, width, height); + let png_data = ImageBuf::new( + image_data.to_vec().into(), + ImageFormat::Rgba8, + width, + height, + ); let image = Image::new(png_data).fit_mode(ObjectFit::Contain); let window_size = LogicalSize::new(650.0, 450.0); diff --git a/masonry/src/testing/harness.rs b/masonry/src/testing/harness.rs index 27257a611..da96bec17 100644 --- a/masonry/src/testing/harness.rs +++ b/masonry/src/testing/harness.rs @@ -145,7 +145,7 @@ impl TestHarnessParams { pub const DEFAULT_SIZE: Size = Size::new(400., 400.); /// Default background color for tests. - pub const DEFAULT_BACKGROUND_COLOR: Color = Color::rgb8(0x29, 0x29, 0x29); + pub const DEFAULT_BACKGROUND_COLOR: Color = Color::from_rgba8(0x29, 0x29, 0x29, 0xff); } impl Default for TestHarnessParams { diff --git a/masonry/src/theme.rs b/masonry/src/theme.rs index 4fb54f0bc..bcb7956dc 100644 --- a/masonry/src/theme.rs +++ b/masonry/src/theme.rs @@ -12,30 +12,31 @@ use crate::Insets; // Colors are from https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/ // They're picked for visual distinction and accessibility (99 percent) -pub const WINDOW_BACKGROUND_COLOR: Color = Color::rgb8(0x29, 0x29, 0x29); -pub const TEXT_COLOR: Color = Color::rgb8(0xf0, 0xf0, 0xea); -pub const DISABLED_TEXT_COLOR: Color = Color::rgb8(0xa0, 0xa0, 0x9a); -pub const PLACEHOLDER_COLOR: Color = Color::rgb8(0x80, 0x80, 0x80); -pub const PRIMARY_LIGHT: Color = Color::rgb8(0x5c, 0xc4, 0xff); -pub const PRIMARY_DARK: Color = Color::rgb8(0x00, 0x8d, 0xdd); +pub const WINDOW_BACKGROUND_COLOR: Color = Color::from_rgba8(0x29, 0x29, 0x29, 0xff); +pub const TEXT_COLOR: Color = Color::from_rgba8(0xf0, 0xf0, 0xea, 0xff); +pub const DISABLED_TEXT_COLOR: Color = Color::from_rgba8(0xa0, 0xa0, 0x9a, 0xff); +pub const PLACEHOLDER_COLOR: Color = Color::from_rgba8(0x80, 0x80, 0x80, 0xff); +pub const PRIMARY_LIGHT: Color = Color::from_rgba8(0x5c, 0xc4, 0xff, 0xff); +pub const PRIMARY_DARK: Color = Color::from_rgba8(0x00, 0x8d, 0xdd, 0xff); pub const PROGRESS_BAR_RADIUS: f64 = 4.; -pub const BACKGROUND_LIGHT: Color = Color::rgb8(0x3a, 0x3a, 0x3a); -pub const BACKGROUND_DARK: Color = Color::rgb8(0x31, 0x31, 0x31); -pub const FOREGROUND_LIGHT: Color = Color::rgb8(0xf9, 0xf9, 0xf9); -pub const FOREGROUND_DARK: Color = Color::rgb8(0xbf, 0xbf, 0xbf); -pub const DISABLED_FOREGROUND_LIGHT: Color = Color::rgb8(0x89, 0x89, 0x89); -pub const DISABLED_FOREGROUND_DARK: Color = Color::rgb8(0x6f, 0x6f, 0x6f); +pub const BACKGROUND_LIGHT: Color = Color::from_rgba8(0x3a, 0x3a, 0x3a, 0xff); +pub const BACKGROUND_DARK: Color = Color::from_rgba8(0x31, 0x31, 0x31, 0xff); +pub const FOREGROUND_LIGHT: Color = Color::from_rgba8(0xf9, 0xf9, 0xf9, 0xff); +pub const FOREGROUND_DARK: Color = Color::from_rgba8(0xbf, 0xbf, 0xbf, 0xff); +pub const DISABLED_FOREGROUND_LIGHT: Color = Color::from_rgba8(0x89, 0x89, 0x89, 0xff); +pub const DISABLED_FOREGROUND_DARK: Color = Color::from_rgba8(0x6f, 0x6f, 0x6f, 0xff); pub const BUTTON_DARK: Color = Color::BLACK; -pub const BUTTON_LIGHT: Color = Color::rgb8(0x21, 0x21, 0x21); -pub const DISABLED_BUTTON_DARK: Color = Color::rgb8(0x28, 0x28, 0x28); -pub const DISABLED_BUTTON_LIGHT: Color = Color::rgb8(0x38, 0x38, 0x38); +pub const BUTTON_LIGHT: Color = Color::from_rgba8(0x21, 0x21, 0x21, 0xff); +pub const DISABLED_BUTTON_DARK: Color = Color::from_rgba8(0x28, 0x28, 0x28, 0xff); +pub const DISABLED_BUTTON_LIGHT: Color = Color::from_rgba8(0x38, 0x38, 0x38, 0xff); pub const BUTTON_BORDER_RADIUS: f64 = 4.; pub const BUTTON_BORDER_WIDTH: f64 = 2.; -pub const BORDER_DARK: Color = Color::rgb8(0x3a, 0x3a, 0x3a); -pub const BORDER_LIGHT: Color = Color::rgb8(0xa1, 0xa1, 0xa1); -pub const SELECTED_TEXT_BACKGROUND_COLOR: Color = Color::rgb8(0x43, 0x70, 0xA8); -pub const SELECTED_TEXT_INACTIVE_BACKGROUND_COLOR: Color = Color::rgb8(0x74, 0x74, 0x74); -pub const SELECTION_TEXT_COLOR: Color = Color::rgb8(0x00, 0x00, 0x00); +pub const BORDER_DARK: Color = Color::from_rgba8(0x3a, 0x3a, 0x3a, 0xff); +pub const BORDER_LIGHT: Color = Color::from_rgba8(0xa1, 0xa1, 0xa1, 0xff); +pub const SELECTED_TEXT_BACKGROUND_COLOR: Color = Color::from_rgba8(0x43, 0x70, 0xA8, 0xff); +pub const SELECTED_TEXT_INACTIVE_BACKGROUND_COLOR: Color = + Color::from_rgba8(0x74, 0x74, 0x74, 0xff); +pub const SELECTION_TEXT_COLOR: Color = Color::from_rgba8(0x00, 0x00, 0x00, 0xff); pub const CURSOR_COLOR: Color = Color::WHITE; pub const TEXT_SIZE_NORMAL: f32 = 15.0; pub const TEXT_SIZE_LARGE: f32 = 24.0; @@ -45,8 +46,8 @@ pub const BORDERED_WIDGET_HEIGHT: f64 = 24.0; pub const TEXTBOX_BORDER_RADIUS: f64 = 2.; pub const TEXTBOX_BORDER_WIDTH: f64 = 1.; pub const TEXTBOX_INSETS: Insets = Insets::new(4.0, 4.0, 4.0, 4.0); -pub const SCROLLBAR_COLOR: Color = Color::rgb8(0xff, 0xff, 0xff); -pub const SCROLLBAR_BORDER_COLOR: Color = Color::rgb8(0x77, 0x77, 0x77); +pub const SCROLLBAR_COLOR: Color = Color::from_rgba8(0xff, 0xff, 0xff, 0xff); +pub const SCROLLBAR_BORDER_COLOR: Color = Color::from_rgba8(0x77, 0x77, 0x77, 0xff); pub const SCROLLBAR_MAX_OPACITY: f64 = 0.7; pub const SCROLLBAR_FADE_DELAY: u64 = 1500; pub const SCROLLBAR_WIDTH: f64 = 8.; @@ -59,24 +60,24 @@ pub const WIDGET_PADDING_HORIZONTAL: f64 = 8.0; pub const WIDGET_CONTROL_COMPONENT_PADDING: f64 = 4.0; static DEBUG_COLOR: &[Color] = &[ - Color::rgb8(230, 25, 75), - Color::rgb8(60, 180, 75), - Color::rgb8(255, 225, 25), - Color::rgb8(0, 130, 200), - Color::rgb8(245, 130, 48), - Color::rgb8(70, 240, 240), - Color::rgb8(240, 50, 230), - Color::rgb8(250, 190, 190), - Color::rgb8(0, 128, 128), - Color::rgb8(230, 190, 255), - Color::rgb8(170, 110, 40), - Color::rgb8(255, 250, 200), - Color::rgb8(128, 0, 0), - Color::rgb8(170, 255, 195), - Color::rgb8(0, 0, 128), - Color::rgb8(128, 128, 128), - Color::rgb8(255, 255, 255), - Color::rgb8(0, 0, 0), + Color::from_rgba8(230, 25, 75, 255), + Color::from_rgba8(60, 180, 75, 255), + Color::from_rgba8(255, 225, 25, 255), + Color::from_rgba8(0, 130, 200, 255), + Color::from_rgba8(245, 130, 48, 255), + Color::from_rgba8(70, 240, 240, 255), + Color::from_rgba8(240, 50, 230, 255), + Color::from_rgba8(250, 190, 190, 255), + Color::from_rgba8(0, 128, 128, 255), + Color::from_rgba8(230, 190, 255, 255), + Color::from_rgba8(170, 110, 40, 255), + Color::from_rgba8(255, 250, 200, 255), + Color::from_rgba8(128, 0, 0, 255), + Color::from_rgba8(170, 255, 195, 255), + Color::from_rgba8(0, 0, 128, 255), + Color::from_rgba8(128, 128, 128, 255), + Color::from_rgba8(255, 255, 255, 255), + Color::from_rgba8(0, 0, 0, 255), ]; /// A color used for debug painting. diff --git a/masonry/src/widget/button.rs b/masonry/src/widget/button.rs index 322109053..8d0adce09 100644 --- a/masonry/src/widget/button.rs +++ b/masonry/src/widget/button.rs @@ -53,7 +53,7 @@ impl Button { /// use masonry::Color; /// use masonry::widget::{Button, Label}; /// - /// let label = Label::new("Increment").with_brush(Color::rgb(0.5, 0.5, 0.5)); + /// let label = Label::new("Increment").with_brush(Color::new([0.5, 0.5, 0.5, 1.0])); /// let button = Button::from_label(label); /// ``` pub fn from_label(label: Label) -> Self { diff --git a/masonry/src/widget/image.rs b/masonry/src/widget/image.rs index 80d66b080..fdb831f51 100644 --- a/masonry/src/widget/image.rs +++ b/masonry/src/widget/image.rs @@ -144,7 +144,7 @@ impl Widget for Image { // --- MARK: TESTS --- #[cfg(test)] mod tests { - use vello::peniko::Format; + use vello::peniko::ImageFormat; use super::*; use crate::assert_render_snapshot; @@ -154,7 +154,7 @@ mod tests { #[test] fn empty_paint() { // TODO - Blob::empty() function? - let image_data = ImageBuf::new(Vec::new().into(), vello::peniko::Format::Rgba8, 0, 0); + let image_data = ImageBuf::new(Vec::new().into(), ImageFormat::Rgba8, 0, 0); let image_widget = Image::new(image_data); let mut harness = TestHarness::create(image_widget); @@ -177,7 +177,7 @@ mod tests { .flatten() .collect::>() .into(), - Format::Rgba8, + ImageFormat::Rgba8, 2, 2, ); @@ -189,7 +189,7 @@ mod tests { #[test] fn edit_image() { - let image_data = ImageBuf::new(vec![255; 4 * 8 * 8].into(), Format::Rgba8, 8, 8); + let image_data = ImageBuf::new(vec![255; 4 * 8 * 8].into(), ImageFormat::Rgba8, 8, 8); let render_1 = { let image_widget = Image::new(image_data.clone()); @@ -200,7 +200,8 @@ mod tests { }; let render_2 = { - let other_image_data = ImageBuf::new(vec![10; 4 * 8 * 8].into(), Format::Rgba8, 8, 8); + let other_image_data = + ImageBuf::new(vec![10; 4 * 8 * 8].into(), ImageFormat::Rgba8, 8, 8); let image_widget = Image::new(other_image_data); let mut harness = TestHarness::create_with_size(image_widget, Size::new(40.0, 60.0)); @@ -220,7 +221,7 @@ mod tests { #[test] fn layout() { - let image_data = ImageBuf::new(vec![255; 4 * 8 * 8].into(), Format::Rgba8, 8, 8); + let image_data = ImageBuf::new(vec![255; 4 * 8 * 8].into(), ImageFormat::Rgba8, 8, 8); let harness_size = Size::new(100.0, 50.0); // Contain. diff --git a/masonry/src/widget/screenshots/masonry__widget__button__tests__hello.png b/masonry/src/widget/screenshots/masonry__widget__button__tests__hello.png index ac7747017..f6279bf0f 100644 --- a/masonry/src/widget/screenshots/masonry__widget__button__tests__hello.png +++ b/masonry/src/widget/screenshots/masonry__widget__button__tests__hello.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edd25ff7fe73ed988c6bcd234a45a745d56a2b546896a9983434a26d3007417b -size 5302 +oid sha256:1cb022806d289f4bce2657980b376af42b332d838edfecb0dfc807d059d2975f +size 5187 diff --git a/masonry/src/widget/screenshots/masonry__widget__grid__tests__initial_1x1.png b/masonry/src/widget/screenshots/masonry__widget__grid__tests__initial_1x1.png index 530021941..4d7517fcf 100644 --- a/masonry/src/widget/screenshots/masonry__widget__grid__tests__initial_1x1.png +++ b/masonry/src/widget/screenshots/masonry__widget__grid__tests__initial_1x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f92e5d63eab954b39012854bafa8ce2d9badfdae4304108bd7e290c2b1cb7143 -size 5026 +oid sha256:d5d77599d5f7c9fce3c46a651e2bcdb3bfc4172c465efc7db009c91b42e957ab +size 4927 diff --git a/masonry/src/widget/screenshots/masonry__widget__grid__tests__moved_2x2_2.png b/masonry/src/widget/screenshots/masonry__widget__grid__tests__moved_2x2_2.png index 530021941..4d7517fcf 100644 --- a/masonry/src/widget/screenshots/masonry__widget__grid__tests__moved_2x2_2.png +++ b/masonry/src/widget/screenshots/masonry__widget__grid__tests__moved_2x2_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f92e5d63eab954b39012854bafa8ce2d9badfdae4304108bd7e290c2b1cb7143 -size 5026 +oid sha256:d5d77599d5f7c9fce3c46a651e2bcdb3bfc4172c465efc7db009c91b42e957ab +size 4927 diff --git a/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_2x2_widget.png b/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_2x2_widget.png index d71393d96..dd05c30cb 100644 --- a/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_2x2_widget.png +++ b/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_2x2_widget.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e52f1f8d696af90e035cbb77f1eda99d14bf6fc2d800866040d0976a7c5d2a25 -size 6693 +oid sha256:dde5ee4144c465a2dfc2e7407bcece68abf37fa03da97da4e5335a765c82662f +size 6623 diff --git a/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_changed_spacing.png b/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_changed_spacing.png index b8a3b22f6..78e7acc91 100644 --- a/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_changed_spacing.png +++ b/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_changed_spacing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81afa7e7ef34369d9edfe042b0c60d1eef1b911c098ac625164171b8b7e49e11 -size 6971 +oid sha256:d69e1dc3b6b4e4135aacfa2e11f48e195784a3b8e1561f4e2bbf9ba3ec295cbf +size 6984 diff --git a/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_negative_spacing.png b/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_negative_spacing.png index c8dd392d8..13d041ba5 100644 --- a/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_negative_spacing.png +++ b/masonry/src/widget/screenshots/masonry__widget__grid__tests__with_negative_spacing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d1c79d02e5f0b22b6326e7926c0af2880cdb9c4e852b04fde63cab9cce10da5 -size 6897 +oid sha256:cf744b668ff527dfcbd9d23dca2d0d927e39f309cdc515ece463eed3fc0c2ddd +size 6561 diff --git a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_contain.png b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_contain.png index 70e67797a..a530e719f 100644 --- a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_contain.png +++ b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_contain.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c11cb16bc2b5be9b5070fee3d2e25e88f3056f36f6ddc71853e636ee7a101e39 -size 635 +oid sha256:3ef0b3823d2f4b9ca2deed9ec5dc96619158a8ed714757f53a6b65e5df51ba5c +size 364 diff --git a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_cover.png b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_cover.png index a846c198a..e7b193cad 100644 --- a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_cover.png +++ b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_cover.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4436cde23164bedef2f699a4105cdd650516449a3921d82a8ad17da9227462e9 -size 493 +oid sha256:d53376d692e23b02cbd5ec1c2c305f19dda769cef0f1b66013c954e5f24a45d9 +size 349 diff --git a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fill.png b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fill.png index b525f154a..e7b193cad 100644 --- a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fill.png +++ b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fill.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5270d4741adf1d2572030e5f2dace4efaabdc4ea1a5c8c2fb08708fd513cdd6a -size 699 +oid sha256:d53376d692e23b02cbd5ec1c2c305f19dda769cef0f1b66013c954e5f24a45d9 +size 349 diff --git a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitheight.png b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitheight.png index 65c576d3c..4f07a1626 100644 --- a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitheight.png +++ b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitheight.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c599ae83a3318550d7e261ae499ff3a876f0b8b1a1424754c47181f466b67a6 -size 613 +oid sha256:a90c641cb792340812e0057ad2109408a2973272d5a98b10619d89743079571d +size 355 diff --git a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitwidth.png b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitwidth.png index a846c198a..e7b193cad 100644 --- a/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitwidth.png +++ b/masonry/src/widget/screenshots/masonry__widget__image__tests__layout_fitwidth.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4436cde23164bedef2f699a4105cdd650516449a3921d82a8ad17da9227462e9 -size 493 +oid sha256:d53376d692e23b02cbd5ec1c2c305f19dda769cef0f1b66013c954e5f24a45d9 +size 349 diff --git a/masonry/src/widget/screenshots/masonry__widget__image__tests__tall_paint.png b/masonry/src/widget/screenshots/masonry__widget__image__tests__tall_paint.png index 3b562c18e..961558647 100644 --- a/masonry/src/widget/screenshots/masonry__widget__image__tests__tall_paint.png +++ b/masonry/src/widget/screenshots/masonry__widget__image__tests__tall_paint.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c2eac50f05f9ca1bdaa3df31d81f66b26bde9f2bd1890e160426855433790577 -size 3320 +oid sha256:76e82f85ba82d1d886892857c3e4d9ecc97adb6a872edfac25bafe277d09ddcd +size 1295 diff --git a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__0_percent_progressbar.png b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__0_percent_progressbar.png index 2e4055d64..2fc003d1f 100644 --- a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__0_percent_progressbar.png +++ b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__0_percent_progressbar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7cd0c911733321222e8fe68360a2570a2843dfd9c6d6722852e5cbc04aa59f82 -size 5158 +oid sha256:0746bee1ea93550a8388661fac6a70e5b1e278e583ac2b9e1b982b3b208646a6 +size 5064 diff --git a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__100_percent_progressbar.png b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__100_percent_progressbar.png index c31d3a9db..6b2cf8b2a 100644 --- a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__100_percent_progressbar.png +++ b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__100_percent_progressbar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aed3d622ba753a6f9e54d66bce387ed3a3b60fa534da4bcdc37134d7c2549a80 -size 5553 +oid sha256:c224de22f3a435a92853bf7eb1fc6fc34d7a89ea7fdb617eb1a4698143671e76 +size 5458 diff --git a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__25_percent_progressbar.png b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__25_percent_progressbar.png index 237252a34..b24c1855f 100644 --- a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__25_percent_progressbar.png +++ b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__25_percent_progressbar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f09e9fefc145cf0b2c9cd9bac9416f15d70122187d3dd2e94f53096aff65efd -size 5886 +oid sha256:ef17088123c59d18f2d37bd1c591d75f30d878ba7af17f05db45f489460de320 +size 5788 diff --git a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__50_percent_progressbar.png b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__50_percent_progressbar.png index dbbba09db..6469a9877 100644 --- a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__50_percent_progressbar.png +++ b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__50_percent_progressbar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ddc713af21f3ef041f68340d60e436cc72549a44f635a833bb74ec0b227e0409 -size 5889 +oid sha256:649a0fad748a9c025c1862b47d91493ca87f3b92aabad9ab6ac287de64774863 +size 5781 diff --git a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__75_percent_progressbar.png b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__75_percent_progressbar.png index dcc1d8aba..6d902e6d0 100644 --- a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__75_percent_progressbar.png +++ b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__75_percent_progressbar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e17e08d69d8bb7a3e1075f106a3d0d74cef347cfecda307671c3309eb68f3d4f -size 5491 +oid sha256:132dcf01f585c2a58b86c4fb6d518059dbeb858e8143ef133acb69f513027749 +size 5399 diff --git a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__indeterminate_progressbar.png b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__indeterminate_progressbar.png index c2270297e..6a4173d8e 100644 --- a/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__indeterminate_progressbar.png +++ b/masonry/src/widget/screenshots/masonry__widget__progress_bar__tests__indeterminate_progressbar.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:552d71b4588d1492e0a773c9bdb554dc331ee18774bd3359065e736074a0160b -size 4823 +oid sha256:70415497ab4fa856a15c12f40afc3c65715cbe5c4a42228af4baf553f385efad +size 4727 diff --git a/masonry/src/widget/sized_box.rs b/masonry/src/widget/sized_box.rs index c41687cc1..badcf341e 100644 --- a/masonry/src/widget/sized_box.rs +++ b/masonry/src/widget/sized_box.rs @@ -574,7 +574,8 @@ impl Widget for SizedBox { #[cfg(test)] mod tests { use insta::assert_debug_snapshot; - use vello::peniko::{Color, Gradient}; + use vello::peniko::color::palette; + use vello::peniko::Gradient; use super::*; use crate::assert_render_snapshot; @@ -605,7 +606,7 @@ mod tests { let widget = SizedBox::empty() .width(40.0) .height(40.0) - .border(Color::BLUE, 5.0) + .border(palette::css::BLUE, 5.0) .rounded(5.0); let mut harness = TestHarness::create(widget); @@ -617,7 +618,7 @@ mod tests { #[test] fn label_box_no_size() { let widget = SizedBox::new(Label::new("hello")) - .border(Color::BLUE, 5.0) + .border(palette::css::BLUE, 5.0) .rounded(5.0); let mut harness = TestHarness::create(widget); @@ -631,7 +632,7 @@ mod tests { let widget = SizedBox::new(Label::new("hello")) .width(40.0) .height(40.0) - .border(Color::BLUE, 5.0) + .border(palette::css::BLUE, 5.0) .rounded(5.0); let mut harness = TestHarness::create(widget); @@ -643,7 +644,7 @@ mod tests { #[test] fn label_box_with_padding() { let widget = SizedBox::new(Label::new("hello")) - .border(Color::BLUE, 5.0) + .border(palette::css::BLUE, 5.0) .rounded(5.0) .padding((60., 40.)); @@ -658,7 +659,7 @@ mod tests { let widget = SizedBox::new(Label::new("hello")) .width(40.0) .height(40.0) - .background(Color::PLUM); + .background(palette::css::PLUM); let mut harness = TestHarness::create(widget); @@ -672,14 +673,14 @@ mod tests { .width(40.) .height(40.) .rounded(20.) - .border(Color::LIGHT_SKY_BLUE, 5.) + .border(palette::css::LIGHT_SKY_BLUE, 5.) .background( Gradient::new_sweep((30., 30.), 0., std::f32::consts::TAU).with_stops([ - (0., Color::WHITE), - (0.25, Color::BLACK), - (0.5, Color::RED), - (0.75, Color::GREEN), - (1., Color::WHITE), + (0., palette::css::WHITE), + (0.25, palette::css::BLACK), + (0.5, palette::css::RED), + (0.75, palette::css::GREEN), + (1., palette::css::WHITE), ]), ); @@ -694,8 +695,8 @@ mod tests { let widget = SizedBox::new(Label::new("hello")) .width(40.0) .height(40.0) - .background(Color::PLUM) - .border(Color::LIGHT_SKY_BLUE, 5.) + .background(palette::css::PLUM) + .border(palette::css::LIGHT_SKY_BLUE, 5.) .padding(100.); let mut harness = TestHarness::create(widget); @@ -710,8 +711,8 @@ mod tests { SizedBox::new(Label::new("hello")) .width(40.0) .height(40.0) - .background(Color::PLUM) - .border(Color::LIGHT_SKY_BLUE, 5.), + .background(palette::css::PLUM) + .border(palette::css::LIGHT_SKY_BLUE, 5.), ) .padding(100.); diff --git a/masonry/src/widget/spinner.rs b/masonry/src/widget/spinner.rs index 430a4d70b..748a2a091 100644 --- a/masonry/src/widget/spinner.rs +++ b/masonry/src/widget/spinner.rs @@ -111,10 +111,6 @@ impl Widget for Spinner { let t = self.t; let (width, height) = (ctx.size().width, ctx.size().height); let center = Point::new(width / 2.0, height / 2.0); - let (r, g, b, original_alpha) = { - let c = self.color; - (c.r, c.g, c.b, c.a) - }; let scale_factor = width.min(height) / 40.0; for step in 1..=12 { @@ -124,8 +120,7 @@ impl Widget for Spinner { let angle = Vec2::from_angle((step / 12.0) * -2.0 * PI); let ambit_start = center + (10.0 * scale_factor * angle); let ambit_end = center + (20.0 * scale_factor * angle); - let alpha = (fade * original_alpha as f64) as u8; - let color = Color::rgba8(r, g, b, alpha); + let color = self.color.multiply_alpha(fade as f32); scene.stroke( &Stroke::new(3.0 * scale_factor).with_caps(Cap::Square), @@ -160,6 +155,7 @@ mod tests { use super::*; use crate::assert_render_snapshot; use crate::testing::TestHarness; + use crate::vello::peniko::color::palette; #[test] fn simple_spinner() { @@ -178,7 +174,7 @@ mod tests { #[test] fn edit_spinner() { let image_1 = { - let spinner = Spinner::new().with_color(Color::PURPLE); + let spinner = Spinner::new().with_color(palette::css::PURPLE); let mut harness = TestHarness::create_with_size(spinner, Size::new(30.0, 30.0)); harness.render() @@ -191,7 +187,7 @@ mod tests { harness.edit_root_widget(|mut spinner| { let mut spinner = spinner.downcast::(); - Spinner::set_color(&mut spinner, Color::PURPLE); + Spinner::set_color(&mut spinner, palette::css::PURPLE); }); harness.render() diff --git a/masonry/src/widget/text_area.rs b/masonry/src/widget/text_area.rs index 86fb0b91e..23075dcaf 100644 --- a/masonry/src/widget/text_area.rs +++ b/masonry/src/widget/text_area.rs @@ -15,7 +15,7 @@ use parley::PlainEditor; use smallvec::SmallVec; use tracing::{trace_span, Span}; use vello::kurbo::{Rect, Vec2}; -use vello::peniko::{Brush, Color, Fill}; +use vello::peniko::{color::palette, Brush, Fill}; use vello::Scene; use winit::keyboard::{Key, NamedKey}; @@ -900,11 +900,17 @@ impl Widget for TextArea { for rect in self.editor.selection_geometry().iter() { // TODO: If window not focused, use a different color // TODO: Make configurable - scene.fill(Fill::NonZero, transform, Color::STEEL_BLUE, None, &rect); + scene.fill( + Fill::NonZero, + transform, + palette::css::STEEL_BLUE, + None, + &rect, + ); } if let Some(cursor) = self.editor.cursor_geometry(1.5) { // TODO: Make configurable - scene.fill(Fill::NonZero, transform, Color::WHITE, None, &cursor); + scene.fill(Fill::NonZero, transform, palette::css::WHITE, None, &cursor); }; } @@ -969,7 +975,7 @@ impl Widget for TextArea { #[cfg(test)] mod tests { - use vello::{kurbo::Size, peniko::Color}; + use vello::{kurbo::Size, peniko::color::palette}; use super::*; use crate::testing::TestHarness; @@ -1021,7 +1027,7 @@ mod tests { #[test] fn edit_textarea() { let base_target = { - let area = TextArea::new_immutable("Test string").with_brush(Color::AZURE); + let area = TextArea::new_immutable("Test string").with_brush(palette::css::AZURE); let mut harness = TestHarness::create_with_size(area, Size::new(200.0, 20.0)); @@ -1029,7 +1035,7 @@ mod tests { }; { - let area = TextArea::new_immutable("Different string").with_brush(Color::AZURE); + let area = TextArea::new_immutable("Different string").with_brush(palette::css::AZURE); let mut harness = TestHarness::create_with_size(area, Size::new(200.0, 20.0)); @@ -1048,7 +1054,7 @@ mod tests { harness.edit_root_widget(|mut root| { let mut area = root.downcast::>(); - TextArea::set_brush(&mut area, Color::BROWN); + TextArea::set_brush(&mut area, palette::css::BROWN); }); let with_updated_brush = harness.render(); diff --git a/xilem/README.md b/xilem/README.md index fe60f3785..d51bf26c1 100644 --- a/xilem/README.md +++ b/xilem/README.md @@ -33,7 +33,7 @@ Lots of things need improvements. ## Minimum supported Rust Version (MSRV) -This version of Xilem has been verified to compile with **Rust 1.81** and later. +This version of Xilem has been verified to compile with **Rust 1.82** and later. Future versions of Xilem might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/xilem/examples/calc.rs b/xilem/examples/calc.rs index e8bb20177..713c0b395 100644 --- a/xilem/examples/calc.rs +++ b/xilem/examples/calc.rs @@ -6,6 +6,7 @@ #![expect(clippy::cast_possible_truncation, reason = "Deferred: Noisy")] use masonry::widget::{CrossAxisAlignment, GridParams, MainAxisAlignment}; +use vello::peniko::color::palette; use winit::dpi::LogicalSize; use winit::error::EventLoopError; use winit::window::Window; @@ -13,7 +14,7 @@ use xilem::view::{ button, flex, grid, label, sized_box, Axis, Flex, FlexSequence, FlexSpacer, GridExt, GridSequence, Label, }; -use xilem::{Color, EventLoop, EventLoopBuilder, WidgetView, Xilem}; +use xilem::{EventLoop, EventLoopBuilder, WidgetView, Xilem}; #[derive(Copy, Clone)] enum MathOperator { @@ -221,9 +222,9 @@ fn app_logic(data: &mut Calculator) -> impl WidgetView { // Top row expanded_button( label("CE").brush(if data.get_current_number().is_empty() { - Color::MEDIUM_VIOLET_RED + palette::css::MEDIUM_VIOLET_RED } else { - Color::WHITE + palette::css::WHITE }), Calculator::clear_entry, ) diff --git a/xilem/examples/http_cats.rs b/xilem/examples/http_cats.rs index 10bc610f1..9c399c47f 100644 --- a/xilem/examples/http_cats.rs +++ b/xilem/examples/http_cats.rs @@ -9,6 +9,7 @@ use std::sync::Arc; +use vello::peniko::color::palette; use vello::peniko::{Blob, Image}; use winit::dpi::LogicalSize; use winit::error::EventLoopError; @@ -19,7 +20,7 @@ use xilem::view::{ button, flex, image, inline_prose, portal, prose, sized_box, spinner, worker, Axis, FlexExt, FlexSpacer, Padding, }; -use xilem::{Color, EventLoop, EventLoopBuilder, TextAlignment, WidgetView, Xilem}; +use xilem::{EventLoop, EventLoopBuilder, TextAlignment, WidgetView, Xilem}; /// The main state of the application. struct HttpCats { @@ -81,7 +82,7 @@ impl HttpCats { "Status code {selected_code} selected, but this was not found." )) .alignment(TextAlignment::Middle) - .brush(Color::YELLOW), + .brush(palette::css::YELLOW), ), None, ) @@ -156,7 +157,7 @@ async fn image_from_url(url: &str) -> anyhow::Result { let data = image.into_vec(); Ok(Image::new( Blob::new(Arc::new(data)), - vello::peniko::Format::Rgba8, + vello::peniko::ImageFormat::Rgba8, width, height, )) diff --git a/xilem/examples/mason.rs b/xilem/examples/mason.rs index 41083f075..3ee3fcfec 100644 --- a/xilem/examples/mason.rs +++ b/xilem/examples/mason.rs @@ -9,6 +9,7 @@ use std::time::Duration; +use vello::peniko::color::palette; use winit::error::EventLoopError; use xilem::core::{fork, run_once}; use xilem::tokio::time; @@ -65,7 +66,7 @@ fn app_logic(data: &mut AppData) -> impl WidgetView { fork( flex(( flex(( - label("Label").brush(Color::REBECCA_PURPLE), + label("Label").brush(palette::css::REBECCA_PURPLE), label("Bold Label").weight(FontWeight::BOLD), // TODO masonry doesn't allow setting disabled manually anymore? // label("Disabled label").disabled(), @@ -149,7 +150,7 @@ fn run(event_loop: EventLoopBuilder) -> Result<(), EventLoopError> { }; Xilem::new(data, app_logic) - .background_color(Color::rgb8(0x20, 0x20, 0x20)) + .background_color(Color::from_rgba8(0x20, 0x20, 0x20, 0xff)) .run_windowed(event_loop, "First Example".into()) } diff --git a/xilem/examples/variable_clock.rs b/xilem/examples/variable_clock.rs index c95fbd9bd..83279c429 100644 --- a/xilem/examples/variable_clock.rs +++ b/xilem/examples/variable_clock.rs @@ -9,13 +9,14 @@ use std::time::Duration; use time::error::IndeterminateOffset; use time::macros::format_description; use time::{OffsetDateTime, UtcOffset}; +use vello::peniko::color::palette; use winit::error::EventLoopError; use xilem::core::fork; use xilem::view::{ button, flex, inline_prose, label, portal, prose, sized_box, task, variable_label, Axis, FlexExt, FlexSpacer, }; -use xilem::{Color, EventLoop, EventLoopBuilder, FontWeight, WidgetView, Xilem}; +use xilem::{EventLoop, EventLoopBuilder, FontWeight, WidgetView, Xilem}; /// The state of the application, owned by Xilem and updated by the callbacks below. struct Clocks { @@ -73,7 +74,10 @@ fn local_time(data: &mut Clocks) -> impl WidgetView { (None, offset) } else { ( - Some(prose("Could not determine local UTC offset, using UTC").brush(Color::ORANGE_RED)), + Some( + prose("Could not determine local UTC offset, using UTC") + .brush(palette::css::ORANGE_RED), + ), UtcOffset::UTC, ) }; @@ -118,7 +122,7 @@ impl TimeZone { label(format!("UTC{}", self.offset)).brush( if data.local_offset.is_ok_and(|it| it == self.offset) { // TODO: Consider accessibility here. - Color::ORANGE + palette::css::ORANGE } else { masonry::theme::TEXT_COLOR }, diff --git a/xilem_core/README.md b/xilem_core/README.md index fd684d181..83bb5976e 100644 --- a/xilem_core/README.md +++ b/xilem_core/README.md @@ -47,7 +47,7 @@ If you wish to use Xilem Core in environments where an allocator is not availabl ## Minimum supported Rust Version (MSRV) -This version of Xilem Core has been verified to compile with **Rust 1.81** and later. +This version of Xilem Core has been verified to compile with **Rust 1.82** and later. Future versions of Xilem Core might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/xilem_web/README.md b/xilem_web/README.md index 871ca890c..9535b19cf 100644 --- a/xilem_web/README.md +++ b/xilem_web/README.md @@ -52,7 +52,7 @@ pub fn main() { ## Minimum supported Rust Version (MSRV) -This version of Xilem Web has been verified to compile with **Rust 1.81** and later. +This version of Xilem Web has been verified to compile with **Rust 1.82** and later. Future versions of Xilem Web might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/xilem_web/src/svg/common_attrs.rs b/xilem_web/src/svg/common_attrs.rs index f629015f2..887cf5ef9 100644 --- a/xilem_web/src/svg/common_attrs.rs +++ b/xilem_web/src/svg/common_attrs.rs @@ -64,13 +64,18 @@ fn join(iter: &mut impl Iterator, sep: &str) -> String } } +/// Convert a Brush for a color into the hex string. +/// +/// This will not include any alpha, if present, +/// as it is handled separately via the opacity attribute +/// instead. fn brush_to_string(brush: &Brush) -> String { match brush { Brush::Solid(color) => { - if color.a == 0 { + if color.components[3] == 0.0 { "none".into() } else { - format!("#{:02x}{:02x}{:02x}", color.r, color.g, color.b) + format!("{:x}", color.discard_alpha().to_rgba8()) } } _ => todo!("gradients not implemented"), @@ -79,7 +84,14 @@ fn brush_to_string(brush: &Brush) -> String { fn opacity_attr_modifier(attr: &'static str, brush: &Brush) -> AttributeModifier { let opacity = match brush { - Brush::Solid(color) if color.a != u8::MAX => Some(color.a as f64 / 255.0), + Brush::Solid(color) => { + let a = color.components[3]; + if a < 1.0 { + Some(a as f64) + } else { + None + } + } _ => None, }; @@ -280,3 +292,21 @@ where self.child.message(view_state, id_path, message, app_state) } } + +#[cfg(test)] +mod tests { + use super::brush_to_string; + use peniko::{color::palette, Brush}; + + #[test] + fn color_brush_to_string() { + let transparent: Brush = palette::css::TRANSPARENT.into(); + assert_eq!(brush_to_string(&transparent), "none"); + + let red: Brush = palette::css::RED.into(); + assert_eq!(brush_to_string(&red), "#ff0000"); + + let lime: Brush = palette::css::LIME.with_alpha(0.5).into(); + assert_eq!(brush_to_string(&lime), "#00ff00"); + } +} diff --git a/xilem_web/web_examples/svgdraw/src/main.rs b/xilem_web/web_examples/svgdraw/src/main.rs index b0f758738..cd7ae4e33 100644 --- a/xilem_web/web_examples/svgdraw/src/main.rs +++ b/xilem_web/web_examples/svgdraw/src/main.rs @@ -22,17 +22,17 @@ use xilem_web::{ }; const RAINBOW_COLORS: [Color; 11] = [ - Color::rgb8(228, 3, 3), // Red - Color::rgb8(255, 140, 0), // Orange - Color::rgb8(255, 237, 0), // Yellow - Color::rgb8(0, 128, 38), // Green - Color::rgb8(0, 76, 255), // Indigo - Color::rgb8(115, 41, 130), // Violet - Color::rgb8(214, 2, 112), // Magenta - Color::rgb8(155, 79, 150), // Lavender - Color::rgb8(0, 56, 168), // Blue - Color::rgb8(91, 206, 250), // Light Blue - Color::rgb8(245, 169, 184), // Pink + Color::from_rgba8(228, 3, 3, 255), // Red + Color::from_rgba8(255, 140, 0, 255), // Orange + Color::from_rgba8(255, 237, 0, 255), // Yellow + Color::from_rgba8(0, 128, 38, 255), // Green + Color::from_rgba8(0, 76, 255, 255), // Indigo + Color::from_rgba8(115, 41, 130, 255), // Violet + Color::from_rgba8(214, 2, 112, 255), // Magenta + Color::from_rgba8(155, 79, 150, 255), // Lavender + Color::from_rgba8(0, 56, 168, 255), // Blue + Color::from_rgba8(91, 206, 250, 255), // Light Blue + Color::from_rgba8(245, 169, 184, 255), // Pink ]; struct SplineLine { @@ -183,10 +183,7 @@ impl Draw { .name("color") .checked(self.selected_color == i) .on_input(move |state: &mut Self, _| state.selected_color = i), - div(()).style(s( - "background-color", - format!("#{:02x}{:02x}{:02x}", color.r, color.g, color.b), - )), + div(()).style(s("background-color", format!("{:x}", color.to_rgba8()))), )) .class("color"); i += 1; diff --git a/xilem_web/web_examples/svgtoy/src/main.rs b/xilem_web/web_examples/svgtoy/src/main.rs index 628b30df0..3d5cd59cc 100644 --- a/xilem_web/web_examples/svgtoy/src/main.rs +++ b/xilem_web/web_examples/svgtoy/src/main.rs @@ -12,6 +12,7 @@ use xilem_web::{ modifiers::style as s, svg::{ kurbo::{Circle, Line, Rect, Stroke, Vec2}, + peniko::color::palette, peniko::Color, }, App, DomView, PointerMsg, @@ -69,12 +70,12 @@ fn app_logic(state: &mut AppState) -> impl DomView { web_sys::console::log_1(&"app logic clicked".into()); }), Rect::new(210.0, 100.0, 310.0, 200.0) - .fill(Color::LIGHT_GRAY) - .stroke(Color::BLUE, Default::default()) + .fill(palette::css::LIGHT_GRAY) + .stroke(palette::css::BLUE, Default::default()) .scale((state.x / 100.0 + 1.0, state.y / 100.0 + 1.0)), Rect::new(320.0, 100.0, 420.0, 200.0).class("red"), Rect::new(state.x, state.y, state.x + 100., state.y + 100.) - .fill(Color::rgba8(100, 100, 255, 100)) + .fill(Color::from_rgba8(100, 100, 255, 100)) .pointer(|s: &mut AppState, msg| s.grab.handle(&mut s.x, &mut s.y, &msg)), text("drag me around") .style(s( @@ -88,7 +89,7 @@ fn app_logic(state: &mut AppState) -> impl DomView { web_sys::console::log_1(&format!("pointer event {e:?}").into()); }), Line::new((310.0, 210.0), (410.0, 310.0)).stroke( - Color::YELLOW_GREEN, + palette::css::YELLOW_GREEN, Stroke::new(1.0).with_dashes(state.x, [7.0, 1.0]), ), Circle::new((460.0, 260.0), 45.0).on_click(|_, _| {