Skip to content
Update Canvas 2D API
Branch: master
Clone or download
Latest commit 9207846 Oct 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images Add conicCurveTo page Oct 4, 2019
spec Add conicCurveTo page Oct 4, 2019
LICENSE.md Batch drawImage explainer Sep 14, 2019
README.md Link to page Oct 4, 2019
template.md Added status Sep 18, 2019

README.md

Update Canvas 2D API

This repo contains proposal for an updated version of the Canvas 2D API.

Feature list

  • Batch drawImage. Support for multiple images being drawn within a single API call.

  • Canvas context loss. Allow canvas to be discarded and re-drawn by demand.

  • willReadFrequently. context creation attribute.

  • Array color input. support for new color input on Canvas.

  • Text modifiers. CSS text/font properties on Canvas.

  • Clear function. Draw primitive.

  • RoundRect. Draw primitive.

  • Conic curves. Draw primitive.

  • Non-affine transforms. Allow for perspective transforms Canvas 2D rendering. Support 3x3 transform matrices.

  • New Gradients. Draw primitive.

  • Modern filters. Support composited filters, create a filter object that can be updated, and support more SVG-like filters.

  • Recorded pictures. Create a record object that receives all the commands from a Canvas2D and can be replayed multiple times.

  • Path2D Inspection. Allow inspection of Path2D objects, that are currently opaque.

Rationale

The current Canvas 2D API was originally proposed in 2013. Since then, a lot of 2D graphics APIs have appeared and changed what developers expect from a good 2D API. This proposal tries to modernize Canvas 2D API, considering current and future usage of Canvas and considering the following:

  1. Canvas is the web’s direct mode rendering solution that closely matches traditional programming models. This is a particularly common need for games and full featured apps.

  2. A common bottleneck for Canvas2D rendering is how many Javascript functions are needed to render a particular scene. With this in mind, adding more expressive APIs (that allow you to render the same scene with fewer commands) will result in better performance.

  3. Modern 2D developers sometimes have to fallback to GL for features that are expected to be available in 2D but currently aren’t supported by Canvas 2D.

  4. Modern browsers implement a rich set of rendering features that are currently unavailable to developers. Bridging that gap and giving more power to developers is a good thing.

You can’t perform that action at this time.