Commit graph

27 commits

Author SHA1 Message Date
Chad Brokaw f19dbdb1b5 Update piet-scene to depend on peniko
This adds a new dependency on peniko, reintroduces kurbo for geometry (!), removes the now defunct types from piet-scene and updates all the test scenes to use the new types.
2022-11-22 14:49:51 -05:00
Chad Brokaw a9170c4330 prevent bad encoding with only move-tos 2022-11-07 23:26:51 -05:00
Chad Brokaw 373b027780 more robust path encoding 2022-11-07 23:08:10 -05:00
Chad Brokaw d07fda8ef8 Make transforms stateless
Removes the transform state mutator from SceneBuilder and adds transform parameters to push_layer, fill and stroke methods.
2022-10-19 15:20:04 -04:00
Chad Brokaw c0fcdbad58 make gradient ramps late bound
Removes ResourceContext type. This makes scenes and fragments nearly identical. Should they be merged?
2022-10-19 15:20:04 -04:00
Chad Brokaw 782e7d51d2 Remove piet API & replace w/ fragments
Removes the dependency on the piet crate and replaces all uses with the scene crate.  Also does some cleanup of the scene API, renaming some types and moving them all to the crate root for better ergonomics.
2022-10-19 15:19:20 -04:00
Chad Brokaw 2e8be24fc9 fix fragment transform logic 2022-08-05 14:00:30 -04:00
Chad Brokaw 8943fa7ea6 encode absolute transforms
This removes the GPU transform stage, changes shaders to reference transforms directly from the scene, and modifies the render context to maintain a transform stack.
2022-07-15 14:36:20 -04:00
Chad Brokaw 663607dd12
Merge pull request #171 from dfrg/kurbo_conv
Add kurbo conversions to scene API
2022-05-19 18:18:47 -04:00
Chad Brokaw 5252a33c5d Oops. Delete one remaining lossy conversion 2022-05-19 18:16:30 -04:00
Chad Brokaw d30750e8a7 Remove poorly named functions
Moves the more descriptive comments to the free functions.
2022-05-19 18:07:07 -04:00
Chad Brokaw 39b773c611 Replace lossy conversions with methods 2022-05-19 18:04:00 -04:00
Chad Brokaw 938d6fc052 Add clip mode for blends
This matches the changes in the fix_blends PR.
2022-05-19 16:59:14 -04:00
Chad Brokaw a20dd43b39 Updates to scene/fragment builder
* Add impl Into<Affine> for pushing transforms.
* Small QOL API changes to Scene and Fragment.
* Add some missing docs.
2022-05-18 16:26:31 -04:00
Chad Brokaw e600bdbbe4 Remove PlusDarker composition mode
Reassigns value 13 to PlusLighter to match the upcoming blend fixes
2022-05-18 16:23:17 -04:00
Chad Brokaw 94f7b51bc5 Add kurbo conversions
Adds kurbo as an optional dependency and implements conversions to/from the common types.

This also removes the direct pinot dependency and changes moscato (temporarily) to a git based dep to allow iteration on the underlying glyph loading code without PR churn here.
2022-05-18 16:22:27 -04:00
Raph Levien 307bf8d227 More blend mode fixes
Adds a test to visualize the blend modes. Fixes a dumb bug in blend.h and also a more subtle issue where default blending is not the same as clipping, as the former needs to always push a blend group (to cause isolation) and the latter does not. This might be something we need to get back to.

This should fix the rendering, so it fairly closely resembles the Mozilla reference image. There's also a compile-time switch to disable sRGB conversion, which is (sadly) needed for compatible rendering.
2022-05-17 16:12:05 -07:00
Chad Brokaw 3afe2eaac2 Fix transform stack bugs in color glyph loader 2022-05-11 14:39:09 -04:00
Chad Brokaw 6f9e53459a Address review feedback
* Change pgpu-render header file generator to add a comment noting that the file is auto-generated
* Remove bin target and associated dependencies from piet-scene crate
* Remove FP constructors from the Color type
* Better codegen and rounding in Color::to_premul_u32()
* Add kurbo attribution for piet_scene::geometry module
2022-05-10 20:07:41 -04:00
Chad Brokaw a9356cc50b Change color packing to match target format 2022-05-10 04:19:36 -04:00
Chad Brokaw 532b6ee808 Add C api for glyph rendering
First cut at a public C api that supports glyph rendering on Metal targets.
2022-05-10 03:56:06 -04:00
Chad Brokaw e12b063cd3 Add Renderer::upload_scene()
This allows rendering from raw stream data and may be temporary depending on the crate structure after the traditional piet api is removed.
2022-05-10 00:53:48 -04:00
Chad Brokaw ba7f85731c add glyph provider API
This exposes a new uniform API for generating scene fragments for glyph outlines.
2022-05-02 04:15:48 -04:00
Chad Brokaw d243d38b04 render using the new scene API
This commit implements actual rendering for the new piet-scene crate.

In particular, it adds a new EncodedSceneRef type in piet_gpu::encoder to store references to the raw stream data. This is used as a proxy for both PietGpuRenderContext and piet_scene::scene::Scene to feed data into the renderer.

Much of this is still hacky for expedience and because the intention is to be a transitional state that maintains both interfaces until we can move to the new scene API and add a wrapper for the traditional piet API.

The general structure and relationships between these crates need further discussion.
2022-04-18 03:48:10 -04:00
Chad Brokaw db2c4d21c9 Remove unused path representation 2022-04-11 06:14:58 -04:00
Chad Brokaw f8f91e4207 Add layer encoding 2022-04-11 06:05:40 -04:00
Chad Brokaw 753b97c342 Rebase on radial branch 2022-04-11 05:30:08 -04:00