John Vandenberg
91d821a1f2
fix typos ( #556 )
2024-03-05 10:56:30 +00:00
Andrea Frigido
d0f8005169
Update license field following SPDX 2.1 license expression standard ( #540 )
2024-02-06 16:59:01 +00:00
5225225
1df5537940
Fix links in docs, fix/ignore some doctests
2022-02-08 20:49:40 +00:00
Sebastian
65d8c7d6d9
Expose Contour points.
2021-12-21 23:47:35 -05:00
floppyhammer
7a57ce2ff9
Fix Cohen-Sutherland algorithm implementation for d3d9
2021-07-16 10:34:18 +08:00
liaojian
7a92724548
bugfix #436 which endless loop in clip::clip_line_segment_to_rect method
2020-08-30 01:18:50 +08:00
Patrick Walton
4060baa80c
Document the rest of `pathfinder_content`
2020-07-29 12:17:16 -07:00
Patrick Walton
41ad372253
Clip line segments before tiling them.
...
This reduces pathological behavior from very large off-screen segments.
Part of #416 .
2020-07-28 12:56:05 -07:00
Sebastian K
dd0ac124d8
Add ColorMatrix filter
2020-07-23 12:46:59 -07:00
Patrick Walton
1570c38217
Clamp to prevent overflow when interpolating between two gradient stops.
...
Closes #397 .
2020-07-16 10:37:31 -07:00
Patrick Walton
c24fdf318d
Document `pathfinder_content` more
2020-07-15 17:58:44 -07:00
Patrick Walton
bb89f52d39
Cache images from frame to frame.
...
Images are cached for one frame; if they are not used the next frame, they're
freed.
2020-07-15 12:36:52 -07:00
Patrick Walton
e2e3ec7e21
Document the `pathfinder_content::outline` module
2020-07-14 12:08:00 -07:00
Patrick Walton
2b69ff778f
Implement gradient wrap/spread modes in SVG.
...
Closes #386 .
2020-07-13 12:36:45 -07:00
Sebastian K
bff7111310
remove remainds
2020-07-07 21:23:11 +03:00
Sebastian K
7815047329
merge
2020-07-07 21:17:24 +03:00
Sebastian K
c6a5f5f2fb
Merge branch 'master' of https://github.com/servo/pathfinder into PR5
2020-07-07 21:14:25 +03:00
Sebastian K
496556f873
remove mirror_and_close
2020-07-07 21:13:47 +03:00
Sebastian K
9d86f663ed
Add a new `Outline::len()` method
2020-06-24 17:47:30 -07:00
Sebastian K
e5eee41b48
Micro-optimize `Contour::from_rect()`
2020-06-24 17:43:16 -07:00
Sebastian K
5eb346f77d
Add an `Outline::with_capacity()` method
2020-06-24 17:43:16 -07:00
Sebastian K
4dea6aa258
Add a `transformed()` method to `Outline` and `Contour`.
2020-06-24 17:43:14 -07:00
Sebastian K
3486d55565
Add a function to merge two outlines
2020-06-24 17:11:07 -07:00
Patrick Walton
eabe1b239d
Update `pathfinder_content`
2020-06-23 13:15:59 -07:00
Sebastian K
6b6a3b324d
add Outline::{len, from_rect_rounded}
2020-06-17 09:04:27 +03:00
Sebastian K
d954cbd05c
add Contour::{from_rect_rounded, push_svg_arc}
2020-06-17 08:49:14 +03:00
Sebastian K
26e41b82ff
add Outline::with_capacity, Contour::transformed and a small fix
2020-06-17 08:49:07 +03:00
Sebastian K
7e05972549
add mirror_and_close path operator
2020-06-17 08:48:35 +03:00
Sebastian K
636d5da589
add Outline::transformed
2020-06-17 08:45:07 +03:00
Sebastian K
541ad28f64
add Outline::merge to combine two outlines
2020-06-17 08:44:52 +03:00
Patrick Walton
6ed3237b10
Remove path rect clipping, since it's no longer required
2020-05-15 19:13:18 -07:00
Patrick Walton
37c993eee6
Remove monotonic conversion, since it's no longer required
2020-05-15 19:12:46 -07:00
Veedrac
033a150639
Order and sample gradient correctly
...
Zero-width gradient sections should be ‘ignored’.
The visible endpoints should be precisely the first
and last colors added at that point.
https://html.spec.whatwg.org/multipage/canvas.html#interpolation
2020-05-11 21:47:39 +01:00
Veedrac
1c48e8900e
Faster sorting strategy, remove SortedVector
...
point_queue is only sorted by y coordinate to coordinate
work to one strip at a time. This is more efficiently handled
by punting later work into a next_point_queue,
and never explicitly sorting the data.
active_edges is only sorted by x coordinate for the tile-by-tile
work in process_old_active_edges. It is much more efficient
to sort once inside that function.
2020-05-11 21:47:35 +01: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
1cd5966d3d
Publish `pathfinder_content` and `pathfinder_renderer` to crates.io
2020-04-17 13:23:45 -07:00
Patrick Walton
07ce2a2536
Add a scene field to render target IDs to reduce the chance of misuse
2020-04-16 16:54:52 -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
a196f1eff8
Fix spriting imperfections in the thumbnails in the NanoVG
2020-04-09 12:15:39 -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
eb2b622615
Remove `draw_render_target()` in favor of the standard tile-based rendering
...
path
2020-04-03 13:05:53 -07:00
Patrick Walton
cd37791d72
Implement the `drawImage()` method on canvas.
...
Closes #223 .
2020-04-02 16:30:49 -07:00
Patrick Walton
794dd55038
Add some implicit conversions between scalars and vectors where appropriate
2020-04-01 17:20:32 -07:00
Patrick Walton
3d71703950
Stop copying images every frame on CPU.
...
We can avoid reuploading them to the GPU every frame as well, but this is a
bigger, and easier, win for now.
2020-04-01 13:01:08 -07:00
Patrick Walton
e6d8aab974
Don't draw backwards miters.
2020-03-31 19:38:43 -07:00
Patrick Walton
764953a643
Fix counterclockwise arc drawing logic
2020-03-31 17:59:41 -07:00
Patrick Walton
f142f045aa
Detect coincident points and bail out of the line join code as necessary.
2020-03-31 13:31:22 -07:00
Patrick Walton
c7ca630aad
Search backward for a non-coincident point if the two ending points of a capped
...
stroke are coincident.
This prevents a divide by zero in normalization.
2020-03-31 13:29:47 -07:00
Patrick Walton
9212c742b7
Avoid taking the square root of a negative number in `arc_from_cos()`.
2020-03-31 13:28:55 -07:00
Patrick Walton
df4021e3c5
Limit the number of trips through the round join loop.
...
This is a safety measure to prevent infinite loops.
2020-03-31 13:27:47 -07:00
Patrick Walton
93f5fbc6d2
Add convenience constructors: `vec2f`, `vec2i`, `Vector2F::zero()`,
...
`Vector2I::zero()`
2020-03-31 11:29:21 -07:00
Patrick Walton
d83f54457c
Merge pull request #290 from s3bk/patch-1
...
add Contour::clear
2020-03-30 22:01:04 -07:00
Patrick Walton
f1d7a0bfa3
Make the gradient construction methods more convenient
2020-03-30 21:32:55 -07:00
Patrick Walton
7ac822bc2e
Cache image hashes.
2020-03-30 16:48:01 -07:00
Sebastian
cb91f40d7a
add Contour::clear
2020-03-28 19:22:39 +03:00
Patrick Walton
b6762cecb8
Don't include the closing segment when printing a path as a string.
...
Closes #279 .
Closes #282 .
2020-03-27 15:40:27 -07:00
Patrick Walton
7b53cc6731
Close all subpaths right before filling them.
...
Closes #269 .
2020-03-27 14:50:02 -07:00
Patrick Walton
c258616bad
Add `Path2D::add_path()`
2020-03-27 12:33:06 -07:00
Patrick Walton
15718d297c
Add `Contour::with_capacity()` from #289
2020-03-27 10:06:56 -07:00
Patrick Walton
55df287fec
Move radial gradients from the CPU to the GPU
2020-03-26 21:24:20 -07:00
Patrick Walton
0c24619dd0
Add a `clear` method to `Outline` as suggested in #289
2020-03-26 08:34:47 -07:00
Patrick Walton
0c93045f50
Replace the individual tile shaders with an ubershader
2020-03-25 21:59:51 -07:00
Patrick Walton
0b0c45a49a
Collapse linear gradients down to a single 256x1 sliver instead of a 256x256
...
square
2020-03-05 16:58:26 -08: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
d0f4579864
Move `RenderTargetId` out of the `pattern` module
2020-03-03 15:50:48 -08:00
Adam Nemecek
3d39c5e9b7
trimmed whitespace
2020-02-27 08:13:14 -08:00
Patrick Walton
e913f83eee
Remove obsolete TODOs
2020-02-27 04:03:08 -08:00
Patrick Walton
3a014d78eb
Implement a blur filter for canvas shadows
2020-02-26 18:43:41 -08:00
Patrick Walton
d1c7da8bd2
Implement pattern repeating and image smoothing control
2020-02-26 14:56:05 -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
1deb53fa9c
Implement the remaining Porter-Duff compositing operators
2020-02-25 18:37:23 -08:00
Patrick Walton
0a3f64eb44
Implement the difference and exclusion blend modes
2020-02-25 14:55:58 -08:00
Patrick Walton
a8e33d3d3d
Add the soft light blend mode
2020-02-25 14:39:06 -08:00
Patrick Walton
9b4217300f
Implement the source-in, destination-in, source-out, and destination-atop blend
...
modes to round out the assortment of Porter-Duff blend modes
2020-02-25 12:52:11 -08:00
Patrick Walton
02012431ca
Implement color dodge and color burn blend modes
2020-02-25 11:37:42 -08:00
Patrick Walton
5b228ed825
Implement multiply, screen, hard light, and overlay blend modes.
2020-02-24 21:23:17 -08:00
Patrick Walton
5421525eaa
Implement the HSL filters (called "non-separable blend modes" in the spec).
...
These cannot be implemented with the standard OpenGL blending functions, so we
have to do them manually in a shader, which requires a good deal of machinery
to create intermediate framebuffers and so forth.
2020-02-24 15:37:44 -08:00
Patrick Walton
67d12adb6c
Replace layers with render targets, which can be used as patterns.
...
This allows us to efficiently handle a lot of workloads that require multiple
HTML canvases, without CPU readback. For example, you can render paths to a
render target, then turn that render target into a repeating pattern that you
fill other paths with. Or you can render paths to a render target and then
composite that render target as a whole with a blend mode.
This introduces a new `DrawRenderTarget` render command that blits a render
target without any paths involved. This is basically just a hack that works
around the fact that our tiled renderer doesn't yet support effects that widen
the ink region (i.e. blurs). It can be removed once we have that support.
2020-02-21 22:14:18 -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
4933efb513
Add Lighten and Darken composite ops
2020-02-20 20:38:43 -08:00
Patrick Walton
ab55b9509b
Fix handling of solid tiles with the Clear blend mode
2020-02-20 18:15:20 -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
16a2de88df
Rename "postprocessing" to "effects" and start initial work on composite ops
2020-02-20 14:22:07 -08:00
Patrick Walton
cc9711e151
Transform some paints in the canvas API
2020-02-18 16:06:39 -08:00
Patrick Walton
dcd12279d4
Fix counterclockwise arc logic
2020-02-18 14:36:02 -08:00
Patrick Walton
4419553acc
Clamp gradient time to [0, 1]
2020-02-18 14:35:37 -08:00
Patrick Walton
3ad1c25796
Implement the even-odd fill rule
2020-02-17 14:44:48 -08:00
Patrick Walton
90445bac7e
Implement basic support for non-repeating image patterns.
2020-02-11 17:20:21 -08:00
Patrick Walton
aad467e716
Implement basic radial gradients.
...
This doesn't handle the case where the circles are not concentric yet.
2020-02-10 22:15:50 -08:00
Patrick Walton
5a21557a6d
Implement basic linear gradients.
...
This is not a very efficient implementation yet, but it seems to work.
2020-02-10 16:01:05 -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
Emmanuel Gil Peyrot
cc6fe7864b
Add quickcheck build-dependency
...
quickcheck usage in pathfinder_content had been added in
b8f622203a
, but not to the Cargo.toml.
This makes tests pass again.
2020-02-05 14:35:20 +01:00
Patrick Walton
b269723254
Switch to per-pixel texture lookup for paints.
...
This is a prerequisite for supporting gradients and images.
2020-02-04 21:50:13 -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
Patrick Walton
eb66459ef4
Fold the `.round()` method on SIMD vectors into float-to-int conversion.
...
This drops our requirements from SSE4.1 to SSE2.
Closes #241 .
2019-12-29 15:05:01 -08:00
Patrick Walton
e9c3fe6f31
Allow overloaded `*` to work between transforms and line segments and
...
transforms and rects
2019-07-12 11:59:04 -07:00
Patrick Walton
437eda96da
Overload `*` between transforms and points
2019-07-12 11:55:01 -07:00
Patrick Walton
2c984de1ea
Add convenience translation, rotation, and scaling methods to `Transform2D`
2019-07-12 11:34:48 -07:00
Patrick Walton
1eb28a5539
Fix incorrect definition of 2D transform multiplication
2019-07-12 11:26:09 -07:00