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.
This commit is contained in:
Bruce Mitchener 2024-12-20 09:52:05 -05:00 committed by GitHub
parent 8f7ef7dde5
commit adcbafbd8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 337 additions and 345 deletions

View File

@ -8,7 +8,7 @@ env:
# If the compilation fails, then the version specified here needs to be bumped up to reality. # 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, # 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. # 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. # List of packages that can not target Wasm.
NO_WASM_PKGS: "--exclude masonry --exclude xilem" NO_WASM_PKGS: "--exclude masonry --exclude xilem"
# Only some of our examples support Android (primarily due to extra required boilerplate). # Only some of our examples support Android (primarily due to extra required boilerplate).

285
Cargo.lock generated
View File

@ -92,8 +92,8 @@ dependencies = [
"hashbrown 0.15.2", "hashbrown 0.15.2",
"paste", "paste",
"static_assertions", "static_assertions",
"windows 0.58.0", "windows",
"windows-core 0.58.0", "windows-core",
] ]
[[package]] [[package]]
@ -342,7 +342,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -377,7 +377,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -466,18 +466,18 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.6.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
dependencies = [ dependencies = [
"bit-vec", "bit-vec",
] ]
[[package]] [[package]]
name = "bit-vec" name = "bit-vec"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -551,7 +551,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -644,34 +644,12 @@ dependencies = [
] ]
[[package]] [[package]]
name = "com" name = "color"
version = "0.6.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6" checksum = "212bb4103d3dc3eca9f7b665588528dee3a42fc03272b2db5ffa3010dc84b39c"
dependencies = [ dependencies = [
"com_macros", "serde",
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
] ]
[[package]] [[package]]
@ -838,17 +816,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" 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]] [[package]]
name = "deranged" name = "deranged"
version = "0.3.11" version = "0.3.11"
@ -882,7 +849,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -955,7 +922,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -1070,6 +1037,15 @@ dependencies = [
"bytemuck", "bytemuck",
] ]
[[package]]
name = "font-types"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11c3a23a5a151afb1f74ea797f8c300dee41eff9ee3cb1bf94ed316d860c46b3"
dependencies = [
"bytemuck",
]
[[package]] [[package]]
name = "fontconfig-cache-parser" name = "fontconfig-cache-parser"
version = "0.2.0" version = "0.2.0"
@ -1083,7 +1059,7 @@ dependencies = [
[[package]] [[package]]
name = "fontique" name = "fontique"
version = "0.2.0" 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 = [ dependencies = [
"bytemuck", "bytemuck",
"core-foundation", "core-foundation",
@ -1095,11 +1071,11 @@ dependencies = [
"objc2", "objc2",
"objc2-foundation", "objc2-foundation",
"peniko", "peniko",
"read-fonts", "read-fonts 0.22.5",
"roxmltree", "roxmltree",
"smallvec", "smallvec",
"windows 0.58.0", "windows",
"windows-core 0.58.0", "windows-core",
] ]
[[package]] [[package]]
@ -1120,7 +1096,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -1218,7 +1194,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -1261,7 +1237,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"rustversion", "rustversion",
"windows 0.58.0", "windows",
] ]
[[package]] [[package]]
@ -1358,9 +1334,9 @@ dependencies = [
[[package]] [[package]]
name = "glow" name = "glow"
version = "0.13.1" version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" checksum = "d51fa363f025f5c111e03f13eda21162faeacb6911fe8caa0c0349f9cf0c4483"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"slotmap", "slotmap",
@ -1398,15 +1374,14 @@ dependencies = [
[[package]] [[package]]
name = "gpu-allocator" name = "gpu-allocator"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdd4240fc91d3433d5e5b0fc5b67672d771850dc19bbee03c1381e19322803d7" checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd"
dependencies = [ dependencies = [
"log", "log",
"presser", "presser",
"thiserror 1.0.69", "thiserror 1.0.69",
"winapi", "windows",
"windows 0.52.0",
] ]
[[package]] [[package]]
@ -1460,21 +1435,6 @@ dependencies = [
"foldhash", "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]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.4.0" version = "0.4.0"
@ -1704,7 +1664,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -2070,9 +2030,9 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "22.1.0" version = "23.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" checksum = "3d5941e45a15b53aad4375eedf02033adb7a28931eedc31117faffa52e6a857e"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -2184,7 +2144,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -2507,13 +2467,13 @@ dependencies = [
[[package]] [[package]]
name = "parley" name = "parley"
version = "0.2.0" 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 = [ dependencies = [
"accesskit", "accesskit",
"fontique", "fontique",
"hashbrown 0.15.2", "hashbrown 0.15.2",
"peniko", "peniko",
"skrifa", "skrifa 0.22.3",
"swash", "swash",
] ]
@ -2525,10 +2485,11 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]] [[package]]
name = "peniko" name = "peniko"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a648c93f502a0bef0a9cb47fa1335994958a2744667d3f82defe513f276741a" checksum = "c7de2e49a1a6b7a55ec3ba866a423f46cd8f31472bfaabe42c68e144c27bc668"
dependencies = [ dependencies = [
"color",
"kurbo", "kurbo",
"smallvec", "smallvec",
] ]
@ -2556,7 +2517,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -2678,7 +2639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -2821,7 +2782,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a04b892cb6f91951f144c33321843790c8574c825aafdb16d815fd7183b5229" checksum = "4a04b892cb6f91951f144c33321843790c8574c825aafdb16d815fd7183b5229"
dependencies = [ dependencies = [
"bytemuck", "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]] [[package]]
@ -3077,22 +3048,22 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.215" version = "1.0.216"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.215" version = "1.0.216"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -3115,7 +3086,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -3184,7 +3155,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe" checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe"
dependencies = [ dependencies = [
"bytemuck", "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]] [[package]]
@ -3338,18 +3319,7 @@ version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd59f3f359ddd2c95af4758c18270eddd9c730dde98598023cdabff472c2ca2" checksum = "cbd59f3f359ddd2c95af4758c18270eddd9c730dde98598023cdabff472c2ca2"
dependencies = [ dependencies = [
"skrifa", "skrifa 0.22.3",
]
[[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",
] ]
[[package]] [[package]]
@ -3380,7 +3350,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -3431,7 +3401,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -3442,7 +3412,7 @@ checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -3620,7 +3590,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -3818,18 +3788,16 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]] [[package]]
name = "vello" name = "vello"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/linebender/vello?rev=a71236c7c8da10a6eaad4602267663339620835a#a71236c7c8da10a6eaad4602267663339620835a"
checksum = "fc44dd4eb9af6a41551b9a82c93d068bd832693d6f78ab118ad19780d8e1202e"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"futures-intrusive", "futures-intrusive",
"log", "log",
"peniko", "peniko",
"png", "png",
"raw-window-handle", "skrifa 0.26.2",
"skrifa",
"static_assertions", "static_assertions",
"thiserror 1.0.69", "thiserror 2.0.4",
"vello_encoding", "vello_encoding",
"vello_shaders", "vello_shaders",
"wgpu", "wgpu",
@ -3839,25 +3807,23 @@ dependencies = [
[[package]] [[package]]
name = "vello_encoding" name = "vello_encoding"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/linebender/vello?rev=a71236c7c8da10a6eaad4602267663339620835a#a71236c7c8da10a6eaad4602267663339620835a"
checksum = "8110c14702a4e17f9200f6e3c4fe05dda5a22bf031ae4feafed4a61429f66fb2"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"guillotiere", "guillotiere",
"peniko", "peniko",
"skrifa", "skrifa 0.26.2",
"smallvec", "smallvec",
] ]
[[package]] [[package]]
name = "vello_shaders" name = "vello_shaders"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/linebender/vello?rev=a71236c7c8da10a6eaad4602267663339620835a#a71236c7c8da10a6eaad4602267663339620835a"
checksum = "07cad02d6f29f2212a6ee382a8fec6f9977d0cceefacf07f8e361607ffe3988d"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"naga", "naga",
"thiserror 1.0.69", "thiserror 2.0.4",
"vello_encoding", "vello_encoding",
] ]
@ -3914,7 +3880,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3949,7 +3915,7 @@ checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4100,9 +4066,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "22.1.0" version = "23.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" checksum = "80f70000db37c469ea9d67defdc13024ddf9a5f1b89cb2941b812ad7cde1735a"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
@ -4125,9 +4091,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "22.1.0" version = "23.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a" checksum = "d63c3c478de8e7e01786479919c8769f62a22eec16788d8c2ac77ce2c132778a"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
@ -4150,9 +4116,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "22.0.0" version = "23.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f" checksum = "89364b8a0b211adc7b16aeaf1bd5ad4a919c1154b44c9ce27838213ba05fd821"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
@ -4160,15 +4126,14 @@ dependencies = [
"bit-set", "bit-set",
"bitflags 2.6.0", "bitflags 2.6.0",
"block", "block",
"bytemuck",
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
"core-graphics-types", "core-graphics-types",
"d3d12",
"glow", "glow",
"glutin_wgl_sys", "glutin_wgl_sys",
"gpu-alloc", "gpu-alloc",
"gpu-allocator", "gpu-allocator",
"gpu-descriptor", "gpu-descriptor",
"hassle-rs",
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libc", "libc",
@ -4190,14 +4155,15 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
"wgpu-types", "wgpu-types",
"winapi", "windows",
"windows-core",
] ]
[[package]] [[package]]
name = "wgpu-profiler" name = "wgpu-profiler"
version = "0.18.2" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06b2cee91fdc885ff0d3d714c59810cc72c6d84b81b0eaa48bab8ff2ad54fb5b" checksum = "43016a1a244a8ca4c3543441dc68d0c970430c74d6d9a17ae016426e2d3fdb08"
dependencies = [ dependencies = [
"parking_lot", "parking_lot",
"thiserror 1.0.69", "thiserror 1.0.69",
@ -4207,21 +4173,15 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "22.0.0" version = "23.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d" checksum = "610f6ff27778148c31093f3b03abc4840f9636d58d597ca2f5977433acfe0068"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"js-sys", "js-sys",
"web-sys", "web-sys",
] ]
[[package]]
name = "widestring"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@ -4253,32 +4213,13 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 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]] [[package]]
name = "windows" name = "windows"
version = "0.58.0" version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [ dependencies = [
"windows-core 0.58.0", "windows-core",
"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-targets 0.52.6", "windows-targets 0.52.6",
] ]
@ -4303,7 +4244,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -4314,7 +4255,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -4757,7 +4698,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"synstructure", "synstructure",
] ]
@ -4817,7 +4758,7 @@ checksum = "709ab20fc57cb22af85be7b360239563209258430bccf38d8b979c5a2ae3ecce"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"zbus-lockstep", "zbus-lockstep",
"zbus_xml", "zbus_xml",
"zvariant", "zvariant",
@ -4832,7 +4773,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"zvariant_utils", "zvariant_utils",
] ]
@ -4878,7 +4819,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -4898,7 +4839,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"synstructure", "synstructure",
] ]
@ -4927,7 +4868,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]
[[package]] [[package]]
@ -4967,7 +4908,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
"zvariant_utils", "zvariant_utils",
] ]
@ -4979,5 +4920,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn",
] ]

View File

@ -22,7 +22,7 @@ members = [
[workspace.package] [workspace.package]
edition = "2021" edition = "2021"
# Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files. # 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" license = "Apache-2.0"
repository = "https://github.com/linebender/xilem" repository = "https://github.com/linebender/xilem"
homepage = "https://xilem.dev/" homepage = "https://xilem.dev/"
@ -104,13 +104,13 @@ clippy.duplicated_attributes = "allow"
masonry = { version = "0.2.0", path = "masonry" } masonry = { version = "0.2.0", path = "masonry" }
xilem_core = { version = "0.1.0", path = "xilem_core" } xilem_core = { version = "0.1.0", path = "xilem_core" }
tree_arena = { version = "0.1.0", path = "tree_arena" } tree_arena = { version = "0.1.0", path = "tree_arena" }
vello = "0.3" vello = { git = "https://github.com/linebender/vello", rev = "a71236c7c8da10a6eaad4602267663339620835a" }
wgpu = "22.1.0" wgpu = "23.0.1"
kurbo = "0.11.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", "accesskit",
] } ] }
peniko = "0.2.0" peniko = "0.3.0"
winit = "0.30.4" winit = "0.30.4"
tracing = { version = "0.1.40", default-features = false } tracing = { version = "0.1.40", default-features = false }
smallvec = "1.13.2" smallvec = "1.13.2"

View File

@ -137,7 +137,7 @@ sudo apt-get install clang libwayland-dev libxkbcommon-x11-dev libvulkan-dev
## Minimum supported Rust Version (MSRV) ## 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. 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. It will not be treated as a breaking change and as such can even happen with small patch releases.

View File

@ -56,7 +56,7 @@ cursor-icon = "1.1.0"
dpi.workspace = true dpi.workspace = true
nv-flip.workspace = true nv-flip.workspace = true
tracing-tracy = { version = "0.11.3", optional = 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] [target.'cfg(target_arch = "wasm32")'.dependencies]
web-time.workspace = true web-time.workspace = true

View File

@ -115,7 +115,7 @@ The following feature flags are available:
## Minimum supported Rust Version (MSRV) ## 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. 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. It will not be treated as a breaking change and as such can even happen with small patch releases.

View File

@ -271,8 +271,8 @@ impl AppDriver for CalcState {
// --- // ---
fn op_button_with_label(op: char, label: String) -> CalcButton { fn op_button_with_label(op: char, label: String) -> CalcButton {
const BLUE: Color = Color::rgb8(0x00, 0x8d, 0xdd); const BLUE: Color = Color::from_rgba8(0x00, 0x8d, 0xdd, 0xff);
const LIGHT_BLUE: Color = Color::rgb8(0x5c, 0xc4, 0xff); const LIGHT_BLUE: Color = Color::from_rgba8(0x5c, 0xc4, 0xff, 0xff);
CalcButton::new( CalcButton::new(
SizedBox::new(Align::centered( SizedBox::new(Align::centered(
@ -291,8 +291,8 @@ fn op_button(op: char) -> CalcButton {
} }
fn digit_button(digit: u8) -> CalcButton { fn digit_button(digit: u8) -> CalcButton {
const GRAY: Color = Color::rgb8(0x3a, 0x3a, 0x3a); const GRAY: Color = Color::from_rgba8(0x3a, 0x3a, 0x3a, 0xff);
const LIGHT_GRAY: Color = Color::rgb8(0x71, 0x71, 0x71); const LIGHT_GRAY: Color = Color::from_rgba8(0x71, 0x71, 0x71, 0xff);
CalcButton::new( CalcButton::new(
SizedBox::new(Align::centered( SizedBox::new(Align::centered(
Label::new(format!("{digit}")).with_style(StyleProperty::FontSize(24.)), Label::new(format!("{digit}")).with_style(StyleProperty::FontSize(24.)),

View File

@ -22,7 +22,7 @@ use parley::layout::Alignment;
use parley::style::{FontFamily, FontStack, StyleProperty}; use parley::style::{FontFamily, FontStack, StyleProperty};
use smallvec::SmallVec; use smallvec::SmallVec;
use tracing::{trace_span, Span}; use tracing::{trace_span, Span};
use vello::peniko::{Fill, Format, Image}; use vello::peniko::{color::palette, Fill, Image, ImageFormat};
use vello::Scene; use vello::Scene;
use winit::window::Window; use winit::window::Window;
@ -73,14 +73,20 @@ impl Widget for CustomWidget {
// and we only want to clear this widget's area. // and we only want to clear this widget's area.
let size = ctx.size(); let size = ctx.size();
let rect = size.to_rect(); 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 // Create an arbitrary bezier path
let mut path = BezPath::new(); let mut path = BezPath::new();
path.move_to(Point::ORIGIN); path.move_to(Point::ORIGIN);
path.quad_to((60.0, 120.0), (size.width, size.height)); path.quad_to((60.0, 120.0), (size.width, size.height));
// Create a color // 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 // Stroke the path with thickness 5.0
scene.stroke( scene.stroke(
&Stroke::new(5.0), &Stroke::new(5.0),
@ -92,8 +98,8 @@ impl Widget for CustomWidget {
// Rectangles: the path for practical people // Rectangles: the path for practical people
let rect = Rect::from_origin_size((10.0, 10.0), (100.0, 100.0)); 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) // Note the Color:from_rgba8 which includes an alpha channel (7F in this case)
let fill_color = Color::rgba8(0x00, 0x00, 0x00, 0x7F); let fill_color = Color::from_rgba8(0x00, 0x00, 0x00, 0x7F);
scene.fill(Fill::NonZero, Affine::IDENTITY, fill_color, None, &rect); scene.fill(Fill::NonZero, Affine::IDENTITY, fill_color, None, &rect);
// To render text, we first create a LayoutBuilder and set the text properties. // 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's burn some CPU to make a (partially transparent) image buffer
let image_data = make_image_data(256, 256); 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); let transform = ObjectFit::Fill.affine_to_fill(ctx.size(), size);
scene.draw_image(&image_data, transform); scene.draw_image(&image_data, transform);
} }

View File

@ -48,7 +48,7 @@ fn main() {
.with_style(StyleProperty::FontSize(14.0)) .with_style(StyleProperty::FontSize(14.0))
.with_alignment(Alignment::Middle), .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![ let button_inputs = vec![
GridParams { GridParams {
x: 0, x: 0,

View File

@ -11,7 +11,7 @@
use masonry::dpi::LogicalSize; use masonry::dpi::LogicalSize;
use masonry::widget::{Image, ObjectFit, RootWidget}; use masonry::widget::{Image, ObjectFit, RootWidget};
use masonry::{Action, AppDriver, DriverCtx, WidgetId}; use masonry::{Action, AppDriver, DriverCtx, WidgetId};
use vello::peniko::{Format, Image as ImageBuf}; use vello::peniko::{Image as ImageBuf, ImageFormat};
use winit::window::Window; use winit::window::Window;
struct Driver; struct Driver;
@ -24,7 +24,12 @@ fn main() {
let image_bytes = include_bytes!("./assets/PicWithAlpha.png"); let image_bytes = include_bytes!("./assets/PicWithAlpha.png");
let image_data = image::load_from_memory(image_bytes).unwrap().to_rgba8(); let image_data = image::load_from_memory(image_bytes).unwrap().to_rgba8();
let (width, height) = image_data.dimensions(); 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 image = Image::new(png_data).fit_mode(ObjectFit::Contain);
let window_size = LogicalSize::new(650.0, 450.0); let window_size = LogicalSize::new(650.0, 450.0);

View File

@ -145,7 +145,7 @@ impl TestHarnessParams {
pub const DEFAULT_SIZE: Size = Size::new(400., 400.); pub const DEFAULT_SIZE: Size = Size::new(400., 400.);
/// Default background color for tests. /// 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 { impl Default for TestHarnessParams {

View File

@ -12,30 +12,31 @@ use crate::Insets;
// Colors are from https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/ // 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) // They're picked for visual distinction and accessibility (99 percent)
pub const WINDOW_BACKGROUND_COLOR: Color = Color::rgb8(0x29, 0x29, 0x29); pub const WINDOW_BACKGROUND_COLOR: Color = Color::from_rgba8(0x29, 0x29, 0x29, 0xff);
pub const TEXT_COLOR: Color = Color::rgb8(0xf0, 0xf0, 0xea); pub const TEXT_COLOR: Color = Color::from_rgba8(0xf0, 0xf0, 0xea, 0xff);
pub const DISABLED_TEXT_COLOR: Color = Color::rgb8(0xa0, 0xa0, 0x9a); pub const DISABLED_TEXT_COLOR: Color = Color::from_rgba8(0xa0, 0xa0, 0x9a, 0xff);
pub const PLACEHOLDER_COLOR: Color = Color::rgb8(0x80, 0x80, 0x80); pub const PLACEHOLDER_COLOR: Color = Color::from_rgba8(0x80, 0x80, 0x80, 0xff);
pub const PRIMARY_LIGHT: Color = Color::rgb8(0x5c, 0xc4, 0xff); pub const PRIMARY_LIGHT: Color = Color::from_rgba8(0x5c, 0xc4, 0xff, 0xff);
pub const PRIMARY_DARK: Color = Color::rgb8(0x00, 0x8d, 0xdd); pub const PRIMARY_DARK: Color = Color::from_rgba8(0x00, 0x8d, 0xdd, 0xff);
pub const PROGRESS_BAR_RADIUS: f64 = 4.; pub const PROGRESS_BAR_RADIUS: f64 = 4.;
pub const BACKGROUND_LIGHT: Color = Color::rgb8(0x3a, 0x3a, 0x3a); pub const BACKGROUND_LIGHT: Color = Color::from_rgba8(0x3a, 0x3a, 0x3a, 0xff);
pub const BACKGROUND_DARK: Color = Color::rgb8(0x31, 0x31, 0x31); pub const BACKGROUND_DARK: Color = Color::from_rgba8(0x31, 0x31, 0x31, 0xff);
pub const FOREGROUND_LIGHT: Color = Color::rgb8(0xf9, 0xf9, 0xf9); pub const FOREGROUND_LIGHT: Color = Color::from_rgba8(0xf9, 0xf9, 0xf9, 0xff);
pub const FOREGROUND_DARK: Color = Color::rgb8(0xbf, 0xbf, 0xbf); pub const FOREGROUND_DARK: Color = Color::from_rgba8(0xbf, 0xbf, 0xbf, 0xff);
pub const DISABLED_FOREGROUND_LIGHT: Color = Color::rgb8(0x89, 0x89, 0x89); pub const DISABLED_FOREGROUND_LIGHT: Color = Color::from_rgba8(0x89, 0x89, 0x89, 0xff);
pub const DISABLED_FOREGROUND_DARK: Color = Color::rgb8(0x6f, 0x6f, 0x6f); pub const DISABLED_FOREGROUND_DARK: Color = Color::from_rgba8(0x6f, 0x6f, 0x6f, 0xff);
pub const BUTTON_DARK: Color = Color::BLACK; pub const BUTTON_DARK: Color = Color::BLACK;
pub const BUTTON_LIGHT: Color = Color::rgb8(0x21, 0x21, 0x21); pub const BUTTON_LIGHT: Color = Color::from_rgba8(0x21, 0x21, 0x21, 0xff);
pub const DISABLED_BUTTON_DARK: Color = Color::rgb8(0x28, 0x28, 0x28); pub const DISABLED_BUTTON_DARK: Color = Color::from_rgba8(0x28, 0x28, 0x28, 0xff);
pub const DISABLED_BUTTON_LIGHT: Color = Color::rgb8(0x38, 0x38, 0x38); pub const DISABLED_BUTTON_LIGHT: Color = Color::from_rgba8(0x38, 0x38, 0x38, 0xff);
pub const BUTTON_BORDER_RADIUS: f64 = 4.; pub const BUTTON_BORDER_RADIUS: f64 = 4.;
pub const BUTTON_BORDER_WIDTH: f64 = 2.; pub const BUTTON_BORDER_WIDTH: f64 = 2.;
pub const BORDER_DARK: Color = Color::rgb8(0x3a, 0x3a, 0x3a); pub const BORDER_DARK: Color = Color::from_rgba8(0x3a, 0x3a, 0x3a, 0xff);
pub const BORDER_LIGHT: Color = Color::rgb8(0xa1, 0xa1, 0xa1); pub const BORDER_LIGHT: Color = Color::from_rgba8(0xa1, 0xa1, 0xa1, 0xff);
pub const SELECTED_TEXT_BACKGROUND_COLOR: Color = Color::rgb8(0x43, 0x70, 0xA8); pub const SELECTED_TEXT_BACKGROUND_COLOR: Color = Color::from_rgba8(0x43, 0x70, 0xA8, 0xff);
pub const SELECTED_TEXT_INACTIVE_BACKGROUND_COLOR: Color = Color::rgb8(0x74, 0x74, 0x74); pub const SELECTED_TEXT_INACTIVE_BACKGROUND_COLOR: Color =
pub const SELECTION_TEXT_COLOR: Color = Color::rgb8(0x00, 0x00, 0x00); 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 CURSOR_COLOR: Color = Color::WHITE;
pub const TEXT_SIZE_NORMAL: f32 = 15.0; pub const TEXT_SIZE_NORMAL: f32 = 15.0;
pub const TEXT_SIZE_LARGE: f32 = 24.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_RADIUS: f64 = 2.;
pub const TEXTBOX_BORDER_WIDTH: f64 = 1.; pub const TEXTBOX_BORDER_WIDTH: f64 = 1.;
pub const TEXTBOX_INSETS: Insets = Insets::new(4.0, 4.0, 4.0, 4.0); 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_COLOR: Color = Color::from_rgba8(0xff, 0xff, 0xff, 0xff);
pub const SCROLLBAR_BORDER_COLOR: Color = Color::rgb8(0x77, 0x77, 0x77); pub const SCROLLBAR_BORDER_COLOR: Color = Color::from_rgba8(0x77, 0x77, 0x77, 0xff);
pub const SCROLLBAR_MAX_OPACITY: f64 = 0.7; pub const SCROLLBAR_MAX_OPACITY: f64 = 0.7;
pub const SCROLLBAR_FADE_DELAY: u64 = 1500; pub const SCROLLBAR_FADE_DELAY: u64 = 1500;
pub const SCROLLBAR_WIDTH: f64 = 8.; 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; pub const WIDGET_CONTROL_COMPONENT_PADDING: f64 = 4.0;
static DEBUG_COLOR: &[Color] = &[ static DEBUG_COLOR: &[Color] = &[
Color::rgb8(230, 25, 75), Color::from_rgba8(230, 25, 75, 255),
Color::rgb8(60, 180, 75), Color::from_rgba8(60, 180, 75, 255),
Color::rgb8(255, 225, 25), Color::from_rgba8(255, 225, 25, 255),
Color::rgb8(0, 130, 200), Color::from_rgba8(0, 130, 200, 255),
Color::rgb8(245, 130, 48), Color::from_rgba8(245, 130, 48, 255),
Color::rgb8(70, 240, 240), Color::from_rgba8(70, 240, 240, 255),
Color::rgb8(240, 50, 230), Color::from_rgba8(240, 50, 230, 255),
Color::rgb8(250, 190, 190), Color::from_rgba8(250, 190, 190, 255),
Color::rgb8(0, 128, 128), Color::from_rgba8(0, 128, 128, 255),
Color::rgb8(230, 190, 255), Color::from_rgba8(230, 190, 255, 255),
Color::rgb8(170, 110, 40), Color::from_rgba8(170, 110, 40, 255),
Color::rgb8(255, 250, 200), Color::from_rgba8(255, 250, 200, 255),
Color::rgb8(128, 0, 0), Color::from_rgba8(128, 0, 0, 255),
Color::rgb8(170, 255, 195), Color::from_rgba8(170, 255, 195, 255),
Color::rgb8(0, 0, 128), Color::from_rgba8(0, 0, 128, 255),
Color::rgb8(128, 128, 128), Color::from_rgba8(128, 128, 128, 255),
Color::rgb8(255, 255, 255), Color::from_rgba8(255, 255, 255, 255),
Color::rgb8(0, 0, 0), Color::from_rgba8(0, 0, 0, 255),
]; ];
/// A color used for debug painting. /// A color used for debug painting.

View File

@ -53,7 +53,7 @@ impl Button {
/// use masonry::Color; /// use masonry::Color;
/// use masonry::widget::{Button, Label}; /// 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); /// let button = Button::from_label(label);
/// ``` /// ```
pub fn from_label(label: Label) -> Self { pub fn from_label(label: Label) -> Self {

View File

@ -144,7 +144,7 @@ impl Widget for Image {
// --- MARK: TESTS --- // --- MARK: TESTS ---
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use vello::peniko::Format; use vello::peniko::ImageFormat;
use super::*; use super::*;
use crate::assert_render_snapshot; use crate::assert_render_snapshot;
@ -154,7 +154,7 @@ mod tests {
#[test] #[test]
fn empty_paint() { fn empty_paint() {
// TODO - Blob::empty() function? // 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 image_widget = Image::new(image_data);
let mut harness = TestHarness::create(image_widget); let mut harness = TestHarness::create(image_widget);
@ -177,7 +177,7 @@ mod tests {
.flatten() .flatten()
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into(), .into(),
Format::Rgba8, ImageFormat::Rgba8,
2, 2,
2, 2,
); );
@ -189,7 +189,7 @@ mod tests {
#[test] #[test]
fn edit_image() { 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 render_1 = {
let image_widget = Image::new(image_data.clone()); let image_widget = Image::new(image_data.clone());
@ -200,7 +200,8 @@ mod tests {
}; };
let render_2 = { 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 image_widget = Image::new(other_image_data);
let mut harness = TestHarness::create_with_size(image_widget, Size::new(40.0, 60.0)); let mut harness = TestHarness::create_with_size(image_widget, Size::new(40.0, 60.0));
@ -220,7 +221,7 @@ mod tests {
#[test] #[test]
fn layout() { 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); let harness_size = Size::new(100.0, 50.0);
// Contain. // Contain.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:edd25ff7fe73ed988c6bcd234a45a745d56a2b546896a9983434a26d3007417b oid sha256:1cb022806d289f4bce2657980b376af42b332d838edfecb0dfc807d059d2975f
size 5302 size 5187

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:f92e5d63eab954b39012854bafa8ce2d9badfdae4304108bd7e290c2b1cb7143 oid sha256:d5d77599d5f7c9fce3c46a651e2bcdb3bfc4172c465efc7db009c91b42e957ab
size 5026 size 4927

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:f92e5d63eab954b39012854bafa8ce2d9badfdae4304108bd7e290c2b1cb7143 oid sha256:d5d77599d5f7c9fce3c46a651e2bcdb3bfc4172c465efc7db009c91b42e957ab
size 5026 size 4927

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:e52f1f8d696af90e035cbb77f1eda99d14bf6fc2d800866040d0976a7c5d2a25 oid sha256:dde5ee4144c465a2dfc2e7407bcece68abf37fa03da97da4e5335a765c82662f
size 6693 size 6623

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:81afa7e7ef34369d9edfe042b0c60d1eef1b911c098ac625164171b8b7e49e11 oid sha256:d69e1dc3b6b4e4135aacfa2e11f48e195784a3b8e1561f4e2bbf9ba3ec295cbf
size 6971 size 6984

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:1d1c79d02e5f0b22b6326e7926c0af2880cdb9c4e852b04fde63cab9cce10da5 oid sha256:cf744b668ff527dfcbd9d23dca2d0d927e39f309cdc515ece463eed3fc0c2ddd
size 6897 size 6561

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c11cb16bc2b5be9b5070fee3d2e25e88f3056f36f6ddc71853e636ee7a101e39 oid sha256:3ef0b3823d2f4b9ca2deed9ec5dc96619158a8ed714757f53a6b65e5df51ba5c
size 635 size 364

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:4436cde23164bedef2f699a4105cdd650516449a3921d82a8ad17da9227462e9 oid sha256:d53376d692e23b02cbd5ec1c2c305f19dda769cef0f1b66013c954e5f24a45d9
size 493 size 349

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:5270d4741adf1d2572030e5f2dace4efaabdc4ea1a5c8c2fb08708fd513cdd6a oid sha256:d53376d692e23b02cbd5ec1c2c305f19dda769cef0f1b66013c954e5f24a45d9
size 699 size 349

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:2c599ae83a3318550d7e261ae499ff3a876f0b8b1a1424754c47181f466b67a6 oid sha256:a90c641cb792340812e0057ad2109408a2973272d5a98b10619d89743079571d
size 613 size 355

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:4436cde23164bedef2f699a4105cdd650516449a3921d82a8ad17da9227462e9 oid sha256:d53376d692e23b02cbd5ec1c2c305f19dda769cef0f1b66013c954e5f24a45d9
size 493 size 349

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c2eac50f05f9ca1bdaa3df31d81f66b26bde9f2bd1890e160426855433790577 oid sha256:76e82f85ba82d1d886892857c3e4d9ecc97adb6a872edfac25bafe277d09ddcd
size 3320 size 1295

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7cd0c911733321222e8fe68360a2570a2843dfd9c6d6722852e5cbc04aa59f82 oid sha256:0746bee1ea93550a8388661fac6a70e5b1e278e583ac2b9e1b982b3b208646a6
size 5158 size 5064

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:aed3d622ba753a6f9e54d66bce387ed3a3b60fa534da4bcdc37134d7c2549a80 oid sha256:c224de22f3a435a92853bf7eb1fc6fc34d7a89ea7fdb617eb1a4698143671e76
size 5553 size 5458

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:3f09e9fefc145cf0b2c9cd9bac9416f15d70122187d3dd2e94f53096aff65efd oid sha256:ef17088123c59d18f2d37bd1c591d75f30d878ba7af17f05db45f489460de320
size 5886 size 5788

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:ddc713af21f3ef041f68340d60e436cc72549a44f635a833bb74ec0b227e0409 oid sha256:649a0fad748a9c025c1862b47d91493ca87f3b92aabad9ab6ac287de64774863
size 5889 size 5781

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:e17e08d69d8bb7a3e1075f106a3d0d74cef347cfecda307671c3309eb68f3d4f oid sha256:132dcf01f585c2a58b86c4fb6d518059dbeb858e8143ef133acb69f513027749
size 5491 size 5399

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:552d71b4588d1492e0a773c9bdb554dc331ee18774bd3359065e736074a0160b oid sha256:70415497ab4fa856a15c12f40afc3c65715cbe5c4a42228af4baf553f385efad
size 4823 size 4727

View File

@ -574,7 +574,8 @@ impl Widget for SizedBox {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use insta::assert_debug_snapshot; use insta::assert_debug_snapshot;
use vello::peniko::{Color, Gradient}; use vello::peniko::color::palette;
use vello::peniko::Gradient;
use super::*; use super::*;
use crate::assert_render_snapshot; use crate::assert_render_snapshot;
@ -605,7 +606,7 @@ mod tests {
let widget = SizedBox::empty() let widget = SizedBox::empty()
.width(40.0) .width(40.0)
.height(40.0) .height(40.0)
.border(Color::BLUE, 5.0) .border(palette::css::BLUE, 5.0)
.rounded(5.0); .rounded(5.0);
let mut harness = TestHarness::create(widget); let mut harness = TestHarness::create(widget);
@ -617,7 +618,7 @@ mod tests {
#[test] #[test]
fn label_box_no_size() { fn label_box_no_size() {
let widget = SizedBox::new(Label::new("hello")) let widget = SizedBox::new(Label::new("hello"))
.border(Color::BLUE, 5.0) .border(palette::css::BLUE, 5.0)
.rounded(5.0); .rounded(5.0);
let mut harness = TestHarness::create(widget); let mut harness = TestHarness::create(widget);
@ -631,7 +632,7 @@ mod tests {
let widget = SizedBox::new(Label::new("hello")) let widget = SizedBox::new(Label::new("hello"))
.width(40.0) .width(40.0)
.height(40.0) .height(40.0)
.border(Color::BLUE, 5.0) .border(palette::css::BLUE, 5.0)
.rounded(5.0); .rounded(5.0);
let mut harness = TestHarness::create(widget); let mut harness = TestHarness::create(widget);
@ -643,7 +644,7 @@ mod tests {
#[test] #[test]
fn label_box_with_padding() { fn label_box_with_padding() {
let widget = SizedBox::new(Label::new("hello")) let widget = SizedBox::new(Label::new("hello"))
.border(Color::BLUE, 5.0) .border(palette::css::BLUE, 5.0)
.rounded(5.0) .rounded(5.0)
.padding((60., 40.)); .padding((60., 40.));
@ -658,7 +659,7 @@ mod tests {
let widget = SizedBox::new(Label::new("hello")) let widget = SizedBox::new(Label::new("hello"))
.width(40.0) .width(40.0)
.height(40.0) .height(40.0)
.background(Color::PLUM); .background(palette::css::PLUM);
let mut harness = TestHarness::create(widget); let mut harness = TestHarness::create(widget);
@ -672,14 +673,14 @@ mod tests {
.width(40.) .width(40.)
.height(40.) .height(40.)
.rounded(20.) .rounded(20.)
.border(Color::LIGHT_SKY_BLUE, 5.) .border(palette::css::LIGHT_SKY_BLUE, 5.)
.background( .background(
Gradient::new_sweep((30., 30.), 0., std::f32::consts::TAU).with_stops([ Gradient::new_sweep((30., 30.), 0., std::f32::consts::TAU).with_stops([
(0., Color::WHITE), (0., palette::css::WHITE),
(0.25, Color::BLACK), (0.25, palette::css::BLACK),
(0.5, Color::RED), (0.5, palette::css::RED),
(0.75, Color::GREEN), (0.75, palette::css::GREEN),
(1., Color::WHITE), (1., palette::css::WHITE),
]), ]),
); );
@ -694,8 +695,8 @@ mod tests {
let widget = SizedBox::new(Label::new("hello")) let widget = SizedBox::new(Label::new("hello"))
.width(40.0) .width(40.0)
.height(40.0) .height(40.0)
.background(Color::PLUM) .background(palette::css::PLUM)
.border(Color::LIGHT_SKY_BLUE, 5.) .border(palette::css::LIGHT_SKY_BLUE, 5.)
.padding(100.); .padding(100.);
let mut harness = TestHarness::create(widget); let mut harness = TestHarness::create(widget);
@ -710,8 +711,8 @@ mod tests {
SizedBox::new(Label::new("hello")) SizedBox::new(Label::new("hello"))
.width(40.0) .width(40.0)
.height(40.0) .height(40.0)
.background(Color::PLUM) .background(palette::css::PLUM)
.border(Color::LIGHT_SKY_BLUE, 5.), .border(palette::css::LIGHT_SKY_BLUE, 5.),
) )
.padding(100.); .padding(100.);

View File

@ -111,10 +111,6 @@ impl Widget for Spinner {
let t = self.t; let t = self.t;
let (width, height) = (ctx.size().width, ctx.size().height); let (width, height) = (ctx.size().width, ctx.size().height);
let center = Point::new(width / 2.0, height / 2.0); 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; let scale_factor = width.min(height) / 40.0;
for step in 1..=12 { 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 angle = Vec2::from_angle((step / 12.0) * -2.0 * PI);
let ambit_start = center + (10.0 * scale_factor * angle); let ambit_start = center + (10.0 * scale_factor * angle);
let ambit_end = center + (20.0 * scale_factor * angle); let ambit_end = center + (20.0 * scale_factor * angle);
let alpha = (fade * original_alpha as f64) as u8; let color = self.color.multiply_alpha(fade as f32);
let color = Color::rgba8(r, g, b, alpha);
scene.stroke( scene.stroke(
&Stroke::new(3.0 * scale_factor).with_caps(Cap::Square), &Stroke::new(3.0 * scale_factor).with_caps(Cap::Square),
@ -160,6 +155,7 @@ mod tests {
use super::*; use super::*;
use crate::assert_render_snapshot; use crate::assert_render_snapshot;
use crate::testing::TestHarness; use crate::testing::TestHarness;
use crate::vello::peniko::color::palette;
#[test] #[test]
fn simple_spinner() { fn simple_spinner() {
@ -178,7 +174,7 @@ mod tests {
#[test] #[test]
fn edit_spinner() { fn edit_spinner() {
let image_1 = { 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)); let mut harness = TestHarness::create_with_size(spinner, Size::new(30.0, 30.0));
harness.render() harness.render()
@ -191,7 +187,7 @@ mod tests {
harness.edit_root_widget(|mut spinner| { harness.edit_root_widget(|mut spinner| {
let mut spinner = spinner.downcast::<Spinner>(); let mut spinner = spinner.downcast::<Spinner>();
Spinner::set_color(&mut spinner, Color::PURPLE); Spinner::set_color(&mut spinner, palette::css::PURPLE);
}); });
harness.render() harness.render()

View File

@ -15,7 +15,7 @@ use parley::PlainEditor;
use smallvec::SmallVec; use smallvec::SmallVec;
use tracing::{trace_span, Span}; use tracing::{trace_span, Span};
use vello::kurbo::{Rect, Vec2}; use vello::kurbo::{Rect, Vec2};
use vello::peniko::{Brush, Color, Fill}; use vello::peniko::{color::palette, Brush, Fill};
use vello::Scene; use vello::Scene;
use winit::keyboard::{Key, NamedKey}; use winit::keyboard::{Key, NamedKey};
@ -900,11 +900,17 @@ impl<const EDITABLE: bool> Widget for TextArea<EDITABLE> {
for rect in self.editor.selection_geometry().iter() { for rect in self.editor.selection_geometry().iter() {
// TODO: If window not focused, use a different color // TODO: If window not focused, use a different color
// TODO: Make configurable // 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) { if let Some(cursor) = self.editor.cursor_geometry(1.5) {
// TODO: Make configurable // 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<const EDITABLE: bool> Widget for TextArea<EDITABLE> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use vello::{kurbo::Size, peniko::Color}; use vello::{kurbo::Size, peniko::color::palette};
use super::*; use super::*;
use crate::testing::TestHarness; use crate::testing::TestHarness;
@ -1021,7 +1027,7 @@ mod tests {
#[test] #[test]
fn edit_textarea() { fn edit_textarea() {
let base_target = { 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)); 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)); 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| { harness.edit_root_widget(|mut root| {
let mut area = root.downcast::<TextArea<false>>(); let mut area = root.downcast::<TextArea<false>>();
TextArea::set_brush(&mut area, Color::BROWN); TextArea::set_brush(&mut area, palette::css::BROWN);
}); });
let with_updated_brush = harness.render(); let with_updated_brush = harness.render();

View File

@ -33,7 +33,7 @@ Lots of things need improvements.
## Minimum supported Rust Version (MSRV) ## 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. 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. It will not be treated as a breaking change and as such can even happen with small patch releases.

View File

@ -6,6 +6,7 @@
#![expect(clippy::cast_possible_truncation, reason = "Deferred: Noisy")] #![expect(clippy::cast_possible_truncation, reason = "Deferred: Noisy")]
use masonry::widget::{CrossAxisAlignment, GridParams, MainAxisAlignment}; use masonry::widget::{CrossAxisAlignment, GridParams, MainAxisAlignment};
use vello::peniko::color::palette;
use winit::dpi::LogicalSize; use winit::dpi::LogicalSize;
use winit::error::EventLoopError; use winit::error::EventLoopError;
use winit::window::Window; use winit::window::Window;
@ -13,7 +14,7 @@ use xilem::view::{
button, flex, grid, label, sized_box, Axis, Flex, FlexSequence, FlexSpacer, GridExt, button, flex, grid, label, sized_box, Axis, Flex, FlexSequence, FlexSpacer, GridExt,
GridSequence, Label, GridSequence, Label,
}; };
use xilem::{Color, EventLoop, EventLoopBuilder, WidgetView, Xilem}; use xilem::{EventLoop, EventLoopBuilder, WidgetView, Xilem};
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
enum MathOperator { enum MathOperator {
@ -221,9 +222,9 @@ fn app_logic(data: &mut Calculator) -> impl WidgetView<Calculator> {
// Top row // Top row
expanded_button( expanded_button(
label("CE").brush(if data.get_current_number().is_empty() { label("CE").brush(if data.get_current_number().is_empty() {
Color::MEDIUM_VIOLET_RED palette::css::MEDIUM_VIOLET_RED
} else { } else {
Color::WHITE palette::css::WHITE
}), }),
Calculator::clear_entry, Calculator::clear_entry,
) )

View File

@ -9,6 +9,7 @@
use std::sync::Arc; use std::sync::Arc;
use vello::peniko::color::palette;
use vello::peniko::{Blob, Image}; use vello::peniko::{Blob, Image};
use winit::dpi::LogicalSize; use winit::dpi::LogicalSize;
use winit::error::EventLoopError; use winit::error::EventLoopError;
@ -19,7 +20,7 @@ use xilem::view::{
button, flex, image, inline_prose, portal, prose, sized_box, spinner, worker, Axis, FlexExt, button, flex, image, inline_prose, portal, prose, sized_box, spinner, worker, Axis, FlexExt,
FlexSpacer, Padding, FlexSpacer, Padding,
}; };
use xilem::{Color, EventLoop, EventLoopBuilder, TextAlignment, WidgetView, Xilem}; use xilem::{EventLoop, EventLoopBuilder, TextAlignment, WidgetView, Xilem};
/// The main state of the application. /// The main state of the application.
struct HttpCats { struct HttpCats {
@ -81,7 +82,7 @@ impl HttpCats {
"Status code {selected_code} selected, but this was not found." "Status code {selected_code} selected, but this was not found."
)) ))
.alignment(TextAlignment::Middle) .alignment(TextAlignment::Middle)
.brush(Color::YELLOW), .brush(palette::css::YELLOW),
), ),
None, None,
) )
@ -156,7 +157,7 @@ async fn image_from_url(url: &str) -> anyhow::Result<Image> {
let data = image.into_vec(); let data = image.into_vec();
Ok(Image::new( Ok(Image::new(
Blob::new(Arc::new(data)), Blob::new(Arc::new(data)),
vello::peniko::Format::Rgba8, vello::peniko::ImageFormat::Rgba8,
width, width,
height, height,
)) ))

View File

@ -9,6 +9,7 @@
use std::time::Duration; use std::time::Duration;
use vello::peniko::color::palette;
use winit::error::EventLoopError; use winit::error::EventLoopError;
use xilem::core::{fork, run_once}; use xilem::core::{fork, run_once};
use xilem::tokio::time; use xilem::tokio::time;
@ -65,7 +66,7 @@ fn app_logic(data: &mut AppData) -> impl WidgetView<AppData> {
fork( fork(
flex(( flex((
flex(( flex((
label("Label").brush(Color::REBECCA_PURPLE), label("Label").brush(palette::css::REBECCA_PURPLE),
label("Bold Label").weight(FontWeight::BOLD), label("Bold Label").weight(FontWeight::BOLD),
// TODO masonry doesn't allow setting disabled manually anymore? // TODO masonry doesn't allow setting disabled manually anymore?
// label("Disabled label").disabled(), // label("Disabled label").disabled(),
@ -149,7 +150,7 @@ fn run(event_loop: EventLoopBuilder) -> Result<(), EventLoopError> {
}; };
Xilem::new(data, app_logic) 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()) .run_windowed(event_loop, "First Example".into())
} }

View File

@ -9,13 +9,14 @@ use std::time::Duration;
use time::error::IndeterminateOffset; use time::error::IndeterminateOffset;
use time::macros::format_description; use time::macros::format_description;
use time::{OffsetDateTime, UtcOffset}; use time::{OffsetDateTime, UtcOffset};
use vello::peniko::color::palette;
use winit::error::EventLoopError; use winit::error::EventLoopError;
use xilem::core::fork; use xilem::core::fork;
use xilem::view::{ use xilem::view::{
button, flex, inline_prose, label, portal, prose, sized_box, task, variable_label, Axis, button, flex, inline_prose, label, portal, prose, sized_box, task, variable_label, Axis,
FlexExt, FlexSpacer, 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. /// The state of the application, owned by Xilem and updated by the callbacks below.
struct Clocks { struct Clocks {
@ -73,7 +74,10 @@ fn local_time(data: &mut Clocks) -> impl WidgetView<Clocks> {
(None, offset) (None, offset)
} else { } 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, UtcOffset::UTC,
) )
}; };
@ -118,7 +122,7 @@ impl TimeZone {
label(format!("UTC{}", self.offset)).brush( label(format!("UTC{}", self.offset)).brush(
if data.local_offset.is_ok_and(|it| it == self.offset) { if data.local_offset.is_ok_and(|it| it == self.offset) {
// TODO: Consider accessibility here. // TODO: Consider accessibility here.
Color::ORANGE palette::css::ORANGE
} else { } else {
masonry::theme::TEXT_COLOR masonry::theme::TEXT_COLOR
}, },

View File

@ -47,7 +47,7 @@ If you wish to use Xilem Core in environments where an allocator is not availabl
## Minimum supported Rust Version (MSRV) ## 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. 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. It will not be treated as a breaking change and as such can even happen with small patch releases.

View File

@ -52,7 +52,7 @@ pub fn main() {
## Minimum supported Rust Version (MSRV) ## 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. 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. It will not be treated as a breaking change and as such can even happen with small patch releases.

View File

@ -64,13 +64,18 @@ fn join(iter: &mut impl Iterator<Item: std::fmt::Display>, 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 { fn brush_to_string(brush: &Brush) -> String {
match brush { match brush {
Brush::Solid(color) => { Brush::Solid(color) => {
if color.a == 0 { if color.components[3] == 0.0 {
"none".into() "none".into()
} else { } else {
format!("#{:02x}{:02x}{:02x}", color.r, color.g, color.b) format!("{:x}", color.discard_alpha().to_rgba8())
} }
} }
_ => todo!("gradients not implemented"), _ => 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 { fn opacity_attr_modifier(attr: &'static str, brush: &Brush) -> AttributeModifier {
let opacity = match brush { 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, _ => None,
}; };
@ -280,3 +292,21 @@ where
self.child.message(view_state, id_path, message, app_state) 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");
}
}

View File

@ -22,17 +22,17 @@ use xilem_web::{
}; };
const RAINBOW_COLORS: [Color; 11] = [ const RAINBOW_COLORS: [Color; 11] = [
Color::rgb8(228, 3, 3), // Red Color::from_rgba8(228, 3, 3, 255), // Red
Color::rgb8(255, 140, 0), // Orange Color::from_rgba8(255, 140, 0, 255), // Orange
Color::rgb8(255, 237, 0), // Yellow Color::from_rgba8(255, 237, 0, 255), // Yellow
Color::rgb8(0, 128, 38), // Green Color::from_rgba8(0, 128, 38, 255), // Green
Color::rgb8(0, 76, 255), // Indigo Color::from_rgba8(0, 76, 255, 255), // Indigo
Color::rgb8(115, 41, 130), // Violet Color::from_rgba8(115, 41, 130, 255), // Violet
Color::rgb8(214, 2, 112), // Magenta Color::from_rgba8(214, 2, 112, 255), // Magenta
Color::rgb8(155, 79, 150), // Lavender Color::from_rgba8(155, 79, 150, 255), // Lavender
Color::rgb8(0, 56, 168), // Blue Color::from_rgba8(0, 56, 168, 255), // Blue
Color::rgb8(91, 206, 250), // Light Blue Color::from_rgba8(91, 206, 250, 255), // Light Blue
Color::rgb8(245, 169, 184), // Pink Color::from_rgba8(245, 169, 184, 255), // Pink
]; ];
struct SplineLine { struct SplineLine {
@ -183,10 +183,7 @@ impl Draw {
.name("color") .name("color")
.checked(self.selected_color == i) .checked(self.selected_color == i)
.on_input(move |state: &mut Self, _| state.selected_color = i), .on_input(move |state: &mut Self, _| state.selected_color = i),
div(()).style(s( div(()).style(s("background-color", format!("{:x}", color.to_rgba8()))),
"background-color",
format!("#{:02x}{:02x}{:02x}", color.r, color.g, color.b),
)),
)) ))
.class("color"); .class("color");
i += 1; i += 1;

View File

@ -12,6 +12,7 @@ use xilem_web::{
modifiers::style as s, modifiers::style as s,
svg::{ svg::{
kurbo::{Circle, Line, Rect, Stroke, Vec2}, kurbo::{Circle, Line, Rect, Stroke, Vec2},
peniko::color::palette,
peniko::Color, peniko::Color,
}, },
App, DomView, PointerMsg, App, DomView, PointerMsg,
@ -69,12 +70,12 @@ fn app_logic(state: &mut AppState) -> impl DomView<AppState> {
web_sys::console::log_1(&"app logic clicked".into()); web_sys::console::log_1(&"app logic clicked".into());
}), }),
Rect::new(210.0, 100.0, 310.0, 200.0) Rect::new(210.0, 100.0, 310.0, 200.0)
.fill(Color::LIGHT_GRAY) .fill(palette::css::LIGHT_GRAY)
.stroke(Color::BLUE, Default::default()) .stroke(palette::css::BLUE, Default::default())
.scale((state.x / 100.0 + 1.0, state.y / 100.0 + 1.0)), .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(320.0, 100.0, 420.0, 200.0).class("red"),
Rect::new(state.x, state.y, state.x + 100., state.y + 100.) 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)), .pointer(|s: &mut AppState, msg| s.grab.handle(&mut s.x, &mut s.y, &msg)),
text("drag me around") text("drag me around")
.style(s( .style(s(
@ -88,7 +89,7 @@ fn app_logic(state: &mut AppState) -> impl DomView<AppState> {
web_sys::console::log_1(&format!("pointer event {e:?}").into()); web_sys::console::log_1(&format!("pointer event {e:?}").into());
}), }),
Line::new((310.0, 210.0), (410.0, 310.0)).stroke( 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]), Stroke::new(1.0).with_dashes(state.x, [7.0, 1.0]),
), ),
Circle::new((460.0, 260.0), 45.0).on_click(|_, _| { Circle::new((460.0, 260.0), 45.0).on_click(|_, _| {