Commit Graph

27 Commits

Author SHA1 Message Date
Patrick Walton 0012f09eeb Fix examples 2019-06-20 21:43:57 -07:00
Patrick Walton 7973148603 Implement basic shadows (no blur yet) 2019-06-03 21:09:04 -07:00
Patrick Walton bd248bf850 Implement line dash offset 2019-06-03 19:36:08 -07:00
Patrick Walton 1a42bbf4d3 Implement dashing for line segments (no curves yet) 2019-06-03 14:16:58 -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 678b6f12c7 Add support for counterclockwise winding to arcs 2019-06-01 12:56:31 -07:00
Patrick Walton 44167beff5 Implement `Path2D::arc_to`. 2019-05-31 16:01:53 -07:00
Patrick Walton 0b9a41c533 Treat the miter limit as part of the canvas state, allowing it to be saved and
restored even if miter joins are not in use.

In my opinion, this behavior is less logical, but it matches the behavior of
the HTML canvas API, which we aim to remain close to.
2019-05-30 21:39:08 -07:00
Patrick Walton 95f3337c6f Add the `ellipse` method to canvas paths 2019-05-30 17:24:12 -07:00
Patrick Walton 9756aa89f9 Base the core arc primitive on a unit chord and transform.
This lets us handle ellipses better.
2019-05-30 17:19:21 -07:00
Patrick Walton 607a518544 Implement canvas text align 2019-05-30 15:08:15 -07:00
Patrick Walton 8d078ff345 Add an initial implementation of canvas `measureText` 2019-05-30 12:38:32 -07:00
Patrick Walton 9138e1e0bb Pass in the font context to the canvas rendering context constructor so that it
can be reused.

Creating a system font source can do I/O on some platforms, so obviously we
don't want to do it every frame.
2019-05-29 21:15:42 -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 e04cc273ee Add enough C bindings to recreate `canvas_minimal` in C.
Closes #12.
2019-05-25 20:21:38 -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 6eab3fa2d8 Implement `globalAlpha` for canvas 2019-05-14 18:26:10 -07:00
Patrick Walton 7518fa65c0 Update dependencies 2019-05-13 18:47:19 -07:00
Patrick Walton c7382a8b2c Add affine transform support to the canvas implementation 2019-05-13 18:40:25 -07:00
Patrick Walton f24d93819b Add arc building methods and switch the Moiré demo to use them.
Also, stop taking points by reference in many methods, for consistency.
2019-05-13 12:42:13 -07:00
Patrick Walton a5d373cb91 Rename "object" to "path" in preparation for image objects 2019-05-10 12:03:38 -07:00
Patrick Walton a078766dc6 Implement basic text rendering in canvas with `skribo` and `font-kit`.
Skribo currently writes some debugging info to standard output. A patch is
forthcoming to fix that.
2019-05-09 15:21:18 -07:00
Patrick Walton 3ba4ce117c Add graphics state saving and restoration to the canvas API 2019-05-03 17:45:01 -07:00
Patrick Walton a86a87a670 Allow fill and stroke colors to be changed 2019-05-03 17:37:27 -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