Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Canvas 2D context #25

Open
ricochet1k opened this issue Jan 13, 2018 · 0 comments
Open

Implement Canvas 2D context #25

ricochet1k opened this issue Jan 13, 2018 · 0 comments

Comments

@ricochet1k
Copy link
Contributor

Docs: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D

The Canvas 2D context is an important step, since it will be the primary way of rendering text.

There are a few backend library possibilities for this, and none are clearly best.

  • Skia is probably the fastest. The servo project maintains a binding here. Since the rust bindings are auto-generated, they have no documentation, although the original Skia project has docs. The servo version has a GlContext backend but it uses Gl in a way that causes a double-indirect for every function call.
  • Cairo is the nearest competitor to Skia, and is what Gtk uses to draw everything. There is no GL backend, so this would render entirely on the CPU. This is not necessarily a bad thing, and could probably be moved onto its own thread if necessary. Cairo is generally considered fast, though not as fast as Skia.
  • Piston2D-graphics is a good Rust-native 2d graphics engine with multiple backends. It is still a young project, and does not yet support several of the features the Canvas 2D api needs, such as gradients. Complex path drawing can be provided by lyon. Generally, graphics works by generating triangles and rendering them on the GPU.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant