Commit graph

44 commits

Author SHA1 Message Date
Arman Uguray
cf25068795 [test_scenes] Add test scenes that demonstrate incorrect clipping
Added a test scene that demonstrates the clipping bugs reported in
vello#286 and vello#333.
2023-06-28 18:38:44 -07:00
Raph Levien
6ed6e4a940 Address review feedback 2023-05-31 17:44:57 -07:00
Raph Levien
f60cb0c31b Merge branch 'main' into failure 2023-05-31 17:37:43 -07:00
Raph Levien
3774928b24 Enforce clippy lints
This turns on clippy checking and also fixes all lints in the code.

Many lints are obvious improvements. Only a small number are slightly annoying, so I think overall worth having a vanilla default config.
2023-05-18 16:13:32 -07:00
Raph Levien
f3587b1240 Merge branch 'main' into failure 2023-05-18 11:14:22 -07:00
Chad Brokaw
780cff09db add examples from COLRv1 spec 2023-05-16 02:35:20 -04:00
Chad Brokaw
b103a55301 rework radial gradients
Adds full support for COLRv1 radial gradients based on the two-point conical gradient algorithm at https://skia.org/docs/dev/design/conical/

Also adds robustness to degenerate cases in gradient encoding:
* Radial where p0 == p1 && r0 == r1 renders transparent solid
* Empty stops render as transparent solid
* Single stop renders as solid
2023-05-09 18:09:53 -04:00
Chad Brokaw
ced6309a3b support two point radial with r0 > 0.0 2023-05-06 03:27:53 -04:00
Chad Brokaw
2db555145e clean up test scene code 2023-05-03 15:29:45 -04:00
Chad Brokaw
15cd306af6 Extend modes for gradients
This patch implements the pad, repeat and reflect extend modes for gradient brushes. Adds a new example demonstrating the functionality.

Also fixes a few bugs:
* Clamps alpha in blend.wgsl for the `blend_compose` function. The `Plus` mode was generating `alpha > 1.0` leading to incorrect rendering.
* Small change to radial gradients in fine.wgsl to reject pixels outside the cone when the circles don't nest. This requires further work to properly extend the cone when one of the radii is not 0.
2023-04-30 23:11:57 -04:00
Raph Levien
a20c9e1592 Oops, forgot to commit mmark.rs 2023-04-29 08:18:04 -07:00
Raph Levien
f4a2fc616b Mmark example
This commit ports the mmark example from the mmark branch, and also makes the complexity adjustable through up/down arrow keys.
2023-04-29 07:55:31 -07:00
Raph Levien
495229bf10 Combine tiger and splash screen
Always show the tiger, and include key bindings.
2023-04-28 17:15:28 -07:00
Raph Levien
152fa00843 Basic splash screen
Just has key bindings for now.
2023-04-28 16:44:37 -07:00
Arman Uguray
bb117da352 Enable wasm-bindgen feature of instant crate 2023-04-23 16:00:01 -07:00
Arman Uguray
5543ad01fe [examples] Use instant crate's time::Instant
crates.io/crates/instant provides a std::time::Instant implementation
that works on both WASM and non-wasm builds.
2023-04-23 12:02:39 -07:00
Arman Uguray
23f26ef2a1 [svg] Log parse and render times separately
The examples logged the total processing time for an SVG including both
parse and GPU buffer encoding times. Times for these two operations are
now logged separately.
2023-04-21 18:31:20 -07:00
Arman Uguray
6d2b98cade [vello_encoding] Re-export vello_encoding::Glyph from vello
This makes it so that users of the vello crate that use the Glyph type
don't need to directly depend on the vello_encoding crate.
2023-04-18 14:46:16 -07:00
Arman Uguray
db2fefdc8f [vello_encoding] Move the encoding module into its own crate
This change moves the vello encoding logic to a new crate under
crates/encoding. Combined with the `vello_shaders` crate, this enables
lightweight integration of the Vello pipelines into renderers that don't
depend on wgpu (or perhaps written in languages other than Rust).

The Scene/Fragment API currently remain the vello crate.
2023-04-18 14:46:14 -07:00
Raph Levien
8cfe903f7e Change image to flower
Using vector graphics for the image doesn't make a huge amount of sense. The flower photo is by Raph and happily licensed to anyone who wants to use it.
2023-03-22 15:53:44 -07:00
Chad Brokaw
eb8cc5275f Replace font backend
This replaces the old moscato font backend with one that has proper support for variable fonts.
2023-03-21 19:27:21 -04:00
Daniel McNab
fd6bfe91d6
Fix handling of interactivity (#295)
* Fix handling of interactivity

* Sort out silly mixup
2023-03-16 13:38:43 +00:00
Chad Brokaw
923c949e95 Remove some unused imports 2023-03-10 21:00:42 -05:00
Chad Brokaw
37f05b853c Address initial review feedback
* Add comment about naughty ptr2int cast
* Change Option to anyhow::Result in test scene ImageCache
* Replace magic constant with pixel stride from selected format
2023-03-10 15:14:34 -05:00
Chad Brokaw
165b3a083b Let's add images 2023-03-09 17:18:03 -05:00
Chad Brokaw
69dd838d09 post rebase fixups 2023-03-06 11:41:12 -05:00
Chad Brokaw
5e216adfa8 Merge branch 'main' into glyph-run 2023-03-06 08:17:45 -05:00
Daniel McNab
5156447346
Make the with_winit example run on android (#273) 2023-03-05 11:33:30 +00:00
Chad Brokaw
fca106a5ce Merge branch 'main' into glyph-run 2023-03-03 20:30:10 -05:00
Arman Uguray
12d5dcd34f Use clap to parse base-color option; remove unused width/height parameters 2023-03-03 14:28:07 -08:00
Arman Uguray
d72ad14059 Add a test scene that animates the base color
The test scenes can now supply their own optional base (background)
color. In the with_winit example, we also allow the user to provide a
base color as a CLI option. The precedence is as follows:

   1. Use the color from the CLI options, if any.
   2. Otherwise use the scene provided base color, if any.
   3. Otherwise default to black.
2023-03-03 11:30:12 -08:00
Arman Uguray
3bbf108df5 Renamed clear_color to base_color; addressed review comments 2023-03-02 14:29:44 -08:00
Chad Brokaw
82391534c0 small fixes
* make SimpleText::add_run accept glyph_transform and style parameters so it doesn't unconditionally do oblique strokes
* replace fill/stroke methods on DrawGlyphs with a single draw method that accepts either fill or stroke styles
* update peniko rev to access the new style types used above
* for now, change glyph cache to only cache non-zero fills. Prior to this, style was ignored in the key which could lead to incorrect rendering.
2023-02-24 16:13:48 -05:00
Chad Brokaw
2ef58adad5 Glyph run API 2023-02-23 22:59:03 -05:00
Chad Brokaw
c65c19dc4f add additional test scene 2023-02-22 22:32:04 -05:00
Jason Davies
5f59a2e818
Fix include_str! compile error in examples/scenes. (#279)
I don't think CARGO_MANIFEST_DIR should ever end in "/", though I've
only checked on Linux and macOS.
2023-02-11 09:44:18 +00:00
Daniel McNab
56939df615 Re-use render context in headless 2023-02-09 09:34:53 +00:00
Daniel McNab
6e1481db40 Finish the headless example 2023-02-07 16:26:56 +00:00
Arman Uguray
2690c3602d
Merge pull request #271 from armansito/pr-conflation-examples
Introduce test scenes that demonstrate conflation artifacts
2023-02-06 15:24:38 -08:00
Daniel McNab
ef44c17f92
Update dependencies, and add more metadata (#272) 2023-02-06 20:12:46 +00:00
Arman Uguray
97e6e12799 Use accessible colors that maintain contrast in the conflation scene 2023-02-03 12:27:42 -08:00
Arman Uguray
fff43bba0d ran cargo fmt; fixed spelling in comment 2023-02-03 09:34:12 -08:00
Arman Uguray
dc2e6690c4 Introduce test scenes that demonstrates conflation artifacts
Added two scenes that demonstrate conflation artifacts as described in
https://github.com/linebender/vello/issues/49. The first scene
demonstrates adjacent triangles and rects that belong to the same path
and use opposite winding.

The second scene demonstrates strokes with overlapping square caps
(these strokes are currently expressed as rects painted with the NonZero
fill rule).
2023-02-03 09:32:41 -08:00
Daniel McNab
020a7f5c01
Split the examples into frontends with a shared scene repository (#262) 2023-02-03 10:22:39 +00:00