Commit Graph

52 Commits

Author SHA1 Message Date
Patrick Walton 561582c0ac Add SVG dashing support 2020-04-21 09:29:36 -07:00
Patrick Walton 6c996981a3 Fix some transform issues and implement transformed radial gradients in SVG.
In particular, this fixes the usvg-to-Pathfinder transform conversion and the
definition of `Transform2F::row_major()`.

Makes `drops.svg` from the MPVG samples work.
2020-04-20 16:40:02 -07:00
Patrick Walton d8875efd61 Update build result flags (unsupported feature flags) in the SVG backend 2020-04-17 16:37:12 -07:00
Patrick Walton d9a93a102c Publish `pathfinder_svg` to crates.io 2020-04-17 13:57:04 -07:00
Patrick Walton cdbe2fbb6b Introduce the concept of a base color in order to handle canvas shadow alpha
correctly
2020-04-13 18:31:25 -07:00
Patrick Walton 895f73096e Switch back to instanced drawing for tiles.
Improves tile build time by something around 2x in the NanoVG demo.
2020-04-08 17:16:54 -07:00
Patrick Walton 93f5fbc6d2 Add convenience constructors: `vec2f`, `vec2i`, `Vector2F::zero()`,
`Vector2I::zero()`
2020-03-31 11:29:21 -07:00
Patrick Walton a8f7438cd9 Remove transforms from paths.
Paints aren't scale-invariant when rendered into the texture atlas, so they
actually do need individual transforms.
2020-03-04 16:28:21 -08:00
Patrick Walton 12574101e5 Add a transform field to `DrawPath`.
This is currently applied to the outline and should eventually be applied to
paints as well.
2020-03-03 11:18:01 -08:00
Patrick Walton 77b3555828 Separate opacity out from paint.
This allows `globalAlpha` to work on render targets.
2020-02-26 12:43:07 -08:00
Patrick Walton 36538d5748 Implement a few more blend modes and switch to premultiplied alpha for layer
compositing
2020-02-20 22:22:15 -08:00
Patrick Walton 6acd2d91f7 Implement `clear_rect()` in the canvas front-end by introducing the concept of
per-path blend modes.

These should be useful for some canvas composite operations as well.
2020-02-20 15:52:40 -08:00
Patrick Walton d9e994e46d Transition the existing postprocessing system to a layers system.
This is preparatory work for composite ops and blurs.

Closes #261.
2020-02-20 11:21:45 -08:00
Patrick Walton 3ad1c25796 Implement the even-odd fill rule 2020-02-17 14:44:48 -08:00
Patrick Walton 243f2cc9b2 Add basic, incomplete support for clip paths in SVG 2020-02-16 15:02:37 -08:00
Patrick Walton 496b55ee4e Add front-end support for clip paths. They don't do anything yet. 2020-02-15 13:21:12 -08:00
Patrick Walton fefa3c3cd3 Rename `PathObject` to `DrawPath` to differentiate it from a clip path 2020-02-15 12:39:15 -08:00
Emmanuel Gil Peyrot 6ce416e77c Bump all outdated dependencies
I’m pleasantly surprised that none of these required any (visible) code
change, but tests pass so let’s go with that. :)
2020-02-06 09:39:50 +01:00
Patrick Walton 706b6dbd1d Add an API for gradients to the canvas frontend, not implemented yet 2020-02-05 20:01:11 -08:00
Patrick Walton 2db43797c3 Split colors out into their own crate.
A lot of downstream consumers of `pathfinder_gpu` want to use colors without
the path stuff.
2020-01-31 09:17:04 +01:00
Sebastian K e38e2d800f update usvg to 0.8 2019-12-28 11:46:31 +03:00
Patrick Walton 1eb28a5539 Fix incorrect definition of 2D transform multiplication 2019-07-12 11:26:09 -07:00
Patrick Walton bcac119324 Rename `Transform2DF` to `Transform2F` and `Transform3DF` to `Transform4F` 2019-07-11 14:59:10 -07:00
Patrick Walton b886c157c1 Use 2-lane instead of 4-lane SIMD types for 2D vectors.
Also, this commit rewrites the `add_fill()` method to stop using shuffle
instructions, which can be slow and make the code overly complicated. The
shuffle instructions have been removed from the various SIMD backends.
2019-06-26 16:38:37 -07:00
Patrick Walton 431dcf3d2e Rename `pathfinder_geometry::basic` to simply `pathfinder_geometry`, and move
the remaining code in that crate to a new crate, `pathfinder_content`

The old hierarchy was confusing.
2019-06-21 10:06:19 -07:00
Patrick Walton 010bc66073 Upgrade `resvg` to 0.7 2019-06-20 17:13:15 -07:00
Patrick Walton a1b0df0a42 Rename `Point2DF` to `Vector2F`, `Point3DF` to `Vector4F`, and `LineSegmentF`
to `LineSegment2F`.

Straw poll on Twitter suggested that these names were preferred.
2019-06-03 12:39:29 -07:00
Patrick Walton 48f825077c Add new join and cap features to SVG, fixing the demo 2019-05-30 20:55:58 -07:00
Patrick Walton e1bcc11ace Change the `F32` and `I32` suffixes to `F` and `I` to match the C API.
They're shorter and less noisy.
2019-05-29 19:17:16 -07:00
Patrick Walton 51877426ea Take paths by reference, not by value, in outline stroke-to-fill. 2019-05-29 15:15:40 -07:00
Patrick Walton e282eb57d5 Implement interior miter line joins (not yet endpoints) 2019-05-16 11:10:15 -07:00
Patrick Walton 272b63a017 Implement square line caps 2019-05-16 10:43:43 -07:00
Patrick Walton 0deb12b3a2 Implement `fill-opacity` and `stroke-opacity` in SVG 2019-05-14 18:09:01 -07:00
Patrick Walton c09ef3ae7c Fix SVG and demo compilation errors 2019-05-13 18:19:10 -07:00
Patrick Walton a5d373cb91 Rename "object" to "path" in preparation for image objects 2019-05-10 12:03:38 -07:00
Patrick Walton 9de7d95d33 Start a simple HTML canvas-like API, and add a minimal example to show how to
use it.
2019-05-03 14:15:38 -07:00
Patrick Walton 5c5e4e9313 Factor the scene thread out of the demo and into the renderer proper.
This simplifies Pathfinder's API considerably. Now users get off-main-thread
scene building "for free".
2019-05-01 17:12:25 -07:00
Patrick Walton c49ec850a1 Run `rustfmt` on the SVG crate 2019-04-29 16:58:09 -07:00
Patrick Walton e4b613c2c8 Stroke then transform instead of the reverse. 2019-03-26 19:56:59 -07:00
Patrick Walton 25558c2177 Only emit warnings for non-empty `<defs>` nodes.
Inkscape likes to put empty `<defs>` nodes in the file, which don't do
anything, so we technically support them.
2019-03-07 11:24:20 -08:00
Patrick Walton b80ab2ad25 Only show the "Text Effects" button when a monochrome SVG is loaded 2019-03-06 19:35:57 -08:00
Patrick Walton 40209b6fe8 Show a warning when unsupported SVG features are used 2019-03-06 18:25:08 -08:00
Patrick Walton ad0691c146 Move the generic UI code in the renderer crate to a separate crate 2019-03-05 15:13:55 -08:00
Patrick Walton 0da196aa92 Scale the SVG appropriately in the demo 2019-02-21 20:19:42 -08:00
Patrick Walton fc62e9bc71 Subdivide offset curves to an error bound. 2019-02-20 18:27:27 -08:00
Patrick Walton 3a8478a048 Remove all Lyon dependencies.
We may want to re-merge at a later date, but for now all relevant algorithms
have been appropriately SIMD-ified.
2019-02-20 16:46:50 -08:00
Patrick Walton d75ed71af4 WIP before moving to a segment basis 2019-02-20 12:41:43 -08:00
Patrick Walton 7151d82d76 Stop converting SVG paths to monotonic paths early 2019-02-05 12:23:43 -08:00
Patrick Walton fe410e066f Add a SIMD rect type 2019-02-05 10:03:20 -08:00
Patrick Walton 63b47f1abe Move basic geometry primitives to the `pathfinder_geometry::basic` module 2019-02-04 20:20:32 -08:00
Patrick Walton d98b244bda Fix transforms 2019-01-17 14:16:29 -08:00
Patrick Walton 821b54b8f4 Factor renderer and SVG code out into separate crates 2019-01-14 14:20:36 -08:00