diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9926c7..ba50d0f 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.75" + RUST_MIN_VER: "1.82" # List of packages that will be checked with the minimum supported Rust version. # This should be limited to packages that are intended for publishing. RUST_MIN_VER_PKGS: "-p vello_svg" diff --git a/CHANGELOG.md b/CHANGELOG.md index facb3fc..122cc0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,11 +13,12 @@ You can find its changes [documented below](#050-2024-11-20). ## [Unreleased][] -This release has an [MSRV][] of 1.75. +This release has an [MSRV][] of 1.82. ### Changed - Feature flag raster image formats (enabled by default) ([#50] by [@nicoburns]) +- Updated to Vello 0.4.0 ([#53][] by [@nicoburns][] and [@waywardmonkeys][]) ## [0.5.0][] (2024-11-20) diff --git a/Cargo.lock b/Cargo.lock index e74b861..bc12041 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,18 +202,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" @@ -285,7 +285,7 @@ checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -404,7 +404,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -423,6 +423,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "color" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c387f6cef110ee8eaf12fca5586d3d303c07c594f4a5f02c768b6470b70dbd" + [[package]] name = "color_quant" version = "1.1.0" @@ -435,37 +441,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "combine" version = "4.6.7" @@ -628,17 +603,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 = "data-url" version = "0.3.1" @@ -665,7 +629,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -819,9 +783,9 @@ checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" [[package]] name = "font-types" -version = "0.7.3" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3971f9a5ca983419cdc386941ba3b9e1feba01a0ab888adf78739feb2798492" +checksum = "11c3a23a5a151afb1f74ea797f8c300dee41eff9ee3cb1bf94ed316d860c46b3" dependencies = [ "bytemuck", ] @@ -867,7 +831,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -986,9 +950,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", @@ -1026,14 +990,13 @@ 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", ] @@ -1092,21 +1055,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 = "heck" version = "0.5.0" @@ -1257,7 +1205,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -1639,9 +1587,9 @@ dependencies = [ [[package]] name = "naga" -version = "22.1.0" +version = "23.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" +checksum = "364f94bc34f61332abebe8cad6f6cd82a5b65cff22c828d05d0968911462ca4f" dependencies = [ "arrayvec", "bit-set", @@ -1753,7 +1701,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -1842,10 +1790,11 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "peniko" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a648c93f502a0bef0a9cb47fa1335994958a2744667d3f82defe513f276741a" +checksum = "2ec061f435b573ff602b2c5690f1a5bfcf461327194654cfbfce4412b95cf2a1" dependencies = [ + "color", "kurbo", "smallvec", ] @@ -2035,9 +1984,9 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.22.7" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69aacb76b5c29acfb7f90155d39759a29496aebb49395830e928a9703d2eec2f" +checksum = "f6f9e8a4f503e5c8750e4cd3b32a4e090035c46374b305a15c70bad833dca05f" dependencies = [ "bytemuck", "font-types", @@ -2220,11 +2169,13 @@ version = "0.0.0" dependencies = [ "anyhow", "byte-unit", + "bytemuck", "clap", "getrandom", "inquire", "instant", "rand", + "skrifa", "ureq", "vello", "vello_svg", @@ -2278,7 +2229,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -2352,9 +2303,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "skrifa" -version = "0.22.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe" +checksum = "6667e349abb2e6e850b31bc638a11f7fadd7e4cf113b71947c46bf6d5fe0dbc9" dependencies = [ "bytemuck", "read-fonts", @@ -2482,17 +2433,6 @@ dependencies = [ "siphasher", ] -[[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]] name = "syn" version = "2.0.92" @@ -2512,7 +2452,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -2563,7 +2503,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -2574,7 +2514,7 @@ checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -2831,19 +2771,18 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vello" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc44dd4eb9af6a41551b9a82c93d068bd832693d6f78ab118ad19780d8e1202e" +checksum = "aa359d6cc48a5afec128b6a3829116700c33bd6d4a9ce81efd0b1e6ac55e9777" dependencies = [ "bytemuck", "futures-intrusive", "log", "peniko", "png", - "raw-window-handle", "skrifa", "static_assertions", - "thiserror 1.0.69", + "thiserror 2.0.11", "vello_encoding", "vello_shaders", "wgpu", @@ -2851,9 +2790,9 @@ dependencies = [ [[package]] name = "vello_encoding" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8110c14702a4e17f9200f6e3c4fe05dda5a22bf031ae4feafed4a61429f66fb2" +checksum = "847f24259aa73e1d5baf453856034f471eeffbf006072e41f7c8397da4f89f65" dependencies = [ "bytemuck", "guillotiere", @@ -2864,13 +2803,13 @@ dependencies = [ [[package]] name = "vello_shaders" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cad02d6f29f2212a6ee382a8fec6f9977d0cceefacf07f8e361607ffe3988d" +checksum = "88db8f16a08862b63bbbf90666d367187ff15d3bb157f3d83798497914f2c94f" dependencies = [ "bytemuck", "naga", - "thiserror 1.0.69", + "thiserror 2.0.11", "vello_encoding", ] @@ -2927,7 +2866,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -2957,7 +2896,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.92", + "syn", "wasm-bindgen-shared", ] @@ -3026,7 +2965,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3070,7 +3009,7 @@ checksum = "54171416ce73aa0b9c377b51cc3cb542becee1cd678204812e8392e5b0e4a031" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -3292,9 +3231,9 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[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", @@ -3317,9 +3256,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", @@ -3342,9 +3281,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", @@ -3352,15 +3291,14 @@ dependencies = [ "bit-set", "bitflags 2.6.0", "block", + "bytemuck", "cfg_aliases", "core-graphics-types", - "d3d12", "glow", "glutin_wgl_sys", "gpu-alloc", "gpu-allocator", "gpu-descriptor", - "hassle-rs", "js-sys", "khronos-egl", "libc", @@ -3382,26 +3320,21 @@ dependencies = [ "wasm-bindgen", "web-sys", "wgpu-types", - "winapi", + "windows", + "windows-core", ] [[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" @@ -3435,9 +3368,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.52.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ "windows-core", "windows-targets 0.52.6", @@ -3445,10 +3378,55 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.52.0" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ + "windows-result", "windows-targets 0.52.6", ] @@ -3846,7 +3824,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", "synstructure", ] @@ -3868,7 +3846,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] @@ -3888,7 +3866,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", "synstructure", ] @@ -3917,7 +3895,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.92", + "syn", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b6fcf27..e0210cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ license = "Apache-2.0 OR MIT" repository = "https://github.com/linebender/vello_svg" # Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files # and with the MSRV in the `Unreleased` section of CHANGELOG.md. -rust-version = "1.75" +rust-version = "1.82" [workspace.lints] # LINEBENDER LINT SET - Cargo.toml - v2 @@ -74,7 +74,7 @@ clippy.wildcard_dependencies = "warn" [workspace.dependencies] # NOTE: Make sure to keep this in sync with the version badge in README.md -vello = { version = "0.3.0", default-features = false } +vello = { version = "0.4.0", default-features = false } [package] name = "vello_svg" diff --git a/README.md b/README.md index acf68c0..3e4ad3b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Linebender Zulip](https://img.shields.io/badge/Linebender-%23gpu-blue?logo=Zulip)](https://xi.zulipchat.com/#narrow/stream/197075-gpu) [![dependency status](https://deps.rs/repo/github/linebender/vello_svg/status.svg)](https://deps.rs/repo/github/linebender/vello_svg) [![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](#license) -[![vello version](https://img.shields.io/badge/vello-v0.3.0-purple.svg)](https://crates.io/crates/vello)\ +[![vello version](https://img.shields.io/badge/vello-v0.4.0-purple.svg)](https://crates.io/crates/vello)\ [![Crates.io](https://img.shields.io/crates/v/vello_svg.svg)](https://crates.io/crates/vello_svg) [![Docs](https://docs.rs/vello_svg/badge.svg)](https://docs.rs/vello_svg) [![Build status](https://github.com/linebender/vello_svg/workflows/CI/badge.svg)](https://github.com/linebender/vello_svg/actions) @@ -63,7 +63,7 @@ There is also a web demo [available here](https://linebender.github.io/vello_svg ## Minimum supported Rust Version (MSRV) -This version of Vello SVG has been verified to compile with **Rust 1.75** and later. +This version of Vello SVG has been verified to compile with **Rust 1.82** and later. Future versions of Vello SVG 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/examples/scenes/Cargo.toml b/examples/scenes/Cargo.toml index 230e1cb..0f3f291 100644 --- a/examples/scenes/Cargo.toml +++ b/examples/scenes/Cargo.toml @@ -13,8 +13,10 @@ workspace = true vello = { workspace = true } vello_svg = { path = "../.." } anyhow = "1" +bytemuck = { version = "1.21.0", features = ["derive"] } clap = { version = "4.5.1", features = ["derive"] } rand = "0.8.5" +skrifa = "0.26.4" instant = "0.1" # Used for the `download` command diff --git a/examples/scenes/src/lib.rs b/examples/scenes/src/lib.rs index d02bff2..6a2c63a 100644 --- a/examples/scenes/src/lib.rs +++ b/examples/scenes/src/lib.rs @@ -31,7 +31,7 @@ mod svg; mod test_scenes; use std::path::PathBuf; -use anyhow::{anyhow, Result}; +use anyhow::Result; use clap::{Args, Subcommand}; #[cfg(not(target_arch = "wasm32"))] use download::Download; @@ -40,7 +40,7 @@ pub use svg::{default_scene, scene_from_files}; pub use test_scenes::test_scenes; use vello::kurbo::Vec2; -use vello::peniko::Color; +use vello::peniko::{color, Color}; use vello::Scene; pub struct SceneParams<'a> { @@ -146,6 +146,6 @@ impl Command { } } -fn parse_color(s: &str) -> Result { - Color::parse(s).ok_or(anyhow!("'{s}' is not a valid color")) +fn parse_color(s: &str) -> Result { + color::parse_color(s).map(|c| c.to_alpha_color()) } diff --git a/examples/scenes/src/simple_text.rs b/examples/scenes/src/simple_text.rs index 711430a..5341999 100644 --- a/examples/scenes/src/simple_text.rs +++ b/examples/scenes/src/simple_text.rs @@ -2,12 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use std::sync::Arc; + +use skrifa::{ + raw::{FileRef, FontRef}, + MetadataProvider, +}; use vello::kurbo::Affine; -use vello::peniko::{Blob, Brush, BrushRef, Font, StyleRef}; -use vello::skrifa::raw::FontRef; -use vello::skrifa::MetadataProvider; -use vello::Glyph; -use vello::Scene; +use vello::peniko::{color::palette, Blob, Brush, BrushRef, Fill, Font, StyleRef}; +use vello::{Glyph, Scene}; // This is very much a hack to get things working. // On Windows, can set this to "c:\\Windows\\Fonts\\seguiemj.ttf" to get color @@ -69,7 +71,7 @@ impl RobotoText { let brush = brush.into(); let style = style.into(); let axes = font_ref.axes(); - let font_size = vello::skrifa::instance::Size::new(size); + let font_size = skrifa::instance::Size::new(size); let var_loc = axes.location(variations.iter().copied()); let charmap = font_ref.charmap(); let metrics = font_ref.metrics(font_size, &var_loc); @@ -82,7 +84,7 @@ impl RobotoText { .font_size(size) .transform(transform) .glyph_transform(glyph_transform) - .normalized_coords(var_loc.coords()) + .normalized_coords(bytemuck::cast_slice(var_loc.coords())) .brush(brush) .draw( style, @@ -114,8 +116,7 @@ impl RobotoText { transform: Affine, text: &str, ) { - use vello::peniko::{Color, Fill}; - let brush = brush.unwrap_or(&Brush::Solid(Color::WHITE)); + let brush = brush.unwrap_or(&Brush::Solid(palette::css::WHITE)); self.add_run( scene, font, @@ -130,7 +131,6 @@ impl RobotoText { } fn to_font_ref(font: &Font) -> Option> { - use vello::skrifa::raw::FileRef; let file_ref = FileRef::new(font.data.as_ref()).ok()?; match file_ref { FileRef::Font(font) => Some(font), diff --git a/examples/with_winit/Cargo.toml b/examples/with_winit/Cargo.toml index b668deb..6e6757f 100644 --- a/examples/with_winit/Cargo.toml +++ b/examples/with_winit/Cargo.toml @@ -20,7 +20,7 @@ path = "src/main.rs" workspace = true [dependencies] -vello = { workspace = true, features = ["buffer_labels", "wgpu"] } +vello = { workspace = true, features = ["wgpu"] } scenes = { path = "../scenes" } anyhow = "1" clap = { version = "4.5.1", features = ["derive"] } diff --git a/examples/with_winit/src/stats.rs b/examples/with_winit/src/stats.rs index ccfc298..aca2c29 100644 --- a/examples/with_winit/src/stats.rs +++ b/examples/with_winit/src/stats.rs @@ -41,7 +41,7 @@ impl Snapshot { scene.fill( Fill::NonZero, offset, - &Brush::Solid(Color::rgba8(0, 0, 0, 200)), + &Brush::Solid(Color::from_rgba8(0, 0, 0, 200)), None, &Rect::new(0., 0., width, height), ); @@ -118,9 +118,9 @@ impl Snapshot { let s = Affine::scale_non_uniform(1., -h); #[allow(clippy::match_overlapping_arm)] let color = match *sample { - ..=16_667 => Color::rgb8(100, 143, 255), - ..=33_334 => Color::rgb8(255, 176, 0), - _ => Color::rgb8(220, 38, 127), + ..=16_667 => Color::from_rgb8(100, 143, 255), + ..=33_334 => Color::from_rgb8(255, 176, 0), + _ => Color::from_rgb8(220, 38, 127), }; scene.fill( Fill::NonZero, diff --git a/src/lib.rs b/src/lib.rs index bfcfff5..c481030 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,8 +34,13 @@ // The following lints are part of the Linebender standard set, // but resolving them has been deferred for now. // Feel free to send a PR that solves one or more of these. -#![allow(missing_docs, clippy::shadow_unrelated, clippy::missing_errors_doc)] -#![cfg_attr(test, allow(unused_crate_dependencies))] // Some dev dependencies are only used in tests +#![allow( + missing_docs, + clippy::shadow_unrelated, + clippy::missing_errors_doc, + reason = "Deferred" +)] +#![cfg_attr(test, allow(unused_crate_dependencies, reason = "Deferred"))] // Some dev dependencies are only used in tests mod render; diff --git a/src/util.rs b/src/util.rs index 031ddb2..e0b7474 100644 --- a/src/util.rs +++ b/src/util.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use vello::kurbo::{Affine, BezPath, Point, Rect, Stroke}; +use vello::peniko::color::{palette, DynamicColor}; use vello::peniko::{Brush, Color, Fill}; use vello::Scene; @@ -98,7 +99,7 @@ pub fn into_image(image: image::ImageBuffer, Vec>) -> Image let image_data: Vec = image.into_vec(); Image::new( Blob::new(std::sync::Arc::new(image_data)), - vello::peniko::Format::Rgba8, + vello::peniko::ImageFormat::Rgba8, width, height, ) @@ -107,7 +108,7 @@ pub fn into_image(image: image::ImageBuffer, Vec>) -> Image pub fn to_brush(paint: &usvg::Paint, opacity: usvg::Opacity) -> Option<(Brush, Affine)> { match paint { usvg::Paint::Color(color) => Some(( - Brush::Solid(Color::rgba8( + Brush::Solid(Color::from_rgba8( color.red, color.green, color.blue, @@ -119,14 +120,14 @@ pub fn to_brush(paint: &usvg::Paint, opacity: usvg::Opacity) -> Option<(Brush, A let stops: Vec = gr .stops() .iter() - .map(|stop| { - let mut cstop = vello::peniko::ColorStop::default(); - cstop.color.r = stop.color().red; - cstop.color.g = stop.color().green; - cstop.color.b = stop.color().blue; - cstop.color.a = (stop.opacity() * opacity).to_u8(); - cstop.offset = stop.offset().get(); - cstop + .map(|stop| vello::peniko::ColorStop { + offset: stop.offset().get(), + color: DynamicColor::from_alpha_color(Color::from_rgba8( + stop.color().red, + stop.color().green, + stop.color().blue, + (stop.opacity() * opacity).to_u8(), + )), }) .collect(); let start = Point::new(gr.x1() as f64, gr.y1() as f64); @@ -149,14 +150,14 @@ pub fn to_brush(paint: &usvg::Paint, opacity: usvg::Opacity) -> Option<(Brush, A let stops: Vec = gr .stops() .iter() - .map(|stop| { - let mut cstop = vello::peniko::ColorStop::default(); - cstop.color.r = stop.color().red; - cstop.color.g = stop.color().green; - cstop.color.b = stop.color().blue; - cstop.color.a = (stop.opacity() * opacity).to_u8(); - cstop.offset = stop.offset().get(); - cstop + .map(|stop| vello::peniko::ColorStop { + offset: stop.offset().get(), + color: DynamicColor::from_alpha_color(Color::from_rgba8( + stop.color().red, + stop.color().green, + stop.color().blue, + (stop.opacity() * opacity).to_u8(), + )), }) .collect(); @@ -200,7 +201,7 @@ pub fn default_error_handler(scene: &mut Scene, node: &usvg::Node) { scene.fill( Fill::NonZero, Affine::IDENTITY, - Color::RED.multiply_alpha(0.5), + palette::css::RED.with_alpha(0.5), None, &rect, );