Skip to content

Commit

Permalink
Resurrect pico_svg and use it to replace vello_svg in the examples. (#…
Browse files Browse the repository at this point in the history
…518)

* WIP: resurrect pico_svg and use it to load scenes.

* Add viewbox and width/height support to pico_svg.

* Accept more single-function transforms in pico_svg.

* Add copyright header to pico_svg.rs

* Remove vello_svg.

* Clean up pico_svg lints.

* Parse multiple transforms in attribute.

* Add scaleX and scaleY to pico_svg.

* Render fuchsia unit square on error, to work around #291.

* Print Display rather than Debug for Err in svg.rs

* Interpret combined viewBox and width/height correctly.

* Fix lint.

* Clean up std::result qualified names.

* Mention new vello_svg repository in ## Integrations

* Improve color parsing in pico_svg.

* Address review comments.
  • Loading branch information
xorgy authored Apr 22, 2024
1 parent 6c1e8b8 commit 17585c3
Show file tree
Hide file tree
Showing 10 changed files with 339 additions and 547 deletions.
1 change: 0 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ The repository is structured as such:
- `tests/` - Helper code for writing tests; current has a single smoke test and not much else.
- `doc/` - Various documents detailing the vision for Vello as it was developed. This directory should probably be refactored away; adding to it not recommended.
- `examples/` - Example projects using Vello. Each example is its own crate, with its own dependencies. The simplest example is the `shapes` one.
- `integrations/vello_svg` - An SVG rendered based on Vello and usvg. Used in examples. May be moved to `crates/` in the future.
- `shader/` - This is where the magic happens. WGSL shaders that define the compute operations (often variations of prefix sum) that Vello does to render a scene.
- `shared/` - Shared types, functions and constants included in other shaders through non-standard `#import` preprocessor directives (see "Shader templating").
- `src/` - Code for the main `vello` crate.
Expand Down
209 changes: 2 additions & 207 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ members = [
"crates/shaders",
"crates/tests",

"integrations/vello_svg",

"examples/headless",
"examples/with_winit",
"examples/with_bevy",
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ More formal benchmarks are on their way.

### SVG

This repository also includes [`vello_svg`](./integrations/vello_svg/), which supports converting a [`usvg`](https://crates.io/crates/usvg) `Tree` into a Vello scene.
[`vello_svg`](https://github.com/linebender/vello_svg/), supports converting a [`usvg`](https://crates.io/crates/usvg) `Tree` into a Vello scene.

This is currently incomplete; see its crate level documentation for more information.

This is used in the [winit](#winit) example for the SVG rendering.
It is currently incomplete; see its documentation for more information.

### Lottie

Expand All @@ -139,7 +137,7 @@ Examples must be selected using the `--package` (or `-p`) Cargo flag.
### Winit

Our [winit] example ([examples/with_winit](https://github.com/linebender/vello/tree/main/examples/with_winit)) demonstrates rendering to a [winit] window.
By default, this renders the [GhostScript Tiger] as well as all SVG files you add in the [examples/assets/downloads/](https://github.com/linebender/vello/tree/main/examples/assets/downloads) directory using [`vello_svg`](#svg).
By default, this renders the [GhostScript Tiger] as well as all SVG files you add in the [examples/assets/downloads/](https://github.com/linebender/vello/tree/main/examples/assets/downloads) directory.
A custom list of SVG file paths (and directories to render all SVG files from) can be provided as arguments instead.
It also includes a collection of test scenes showing the capabilities of `vello`, which can be shown with `--test-scenes`.

Expand Down
3 changes: 2 additions & 1 deletion examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ workspace = true

[dependencies]
vello = { path = "../../" }
vello_svg = { path = "../../integrations/vello_svg" }
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
image = "0.24.9"
rand = "0.8.5"
instant = { workspace = true }
# for pico_svg
roxmltree = "0.19"

# Used for the `download` command
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
1 change: 1 addition & 0 deletions examples/scenes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
pub mod download;
mod images;
mod mmark;
mod pico_svg;
mod simple_text;
mod svg;
mod test_scenes;
Expand Down
Loading

0 comments on commit 17585c3

Please sign in to comment.