← Back to release summary

New Canvas 2D API

Category
Graphics
Type
Chromium catches up
Status
Enabled by default (Chrome 99)
Intent stage
Prepare to ship

Summary

Updated functionality for the Canvas2D API. Adds nine new features/functions to CanvasRenderingContext2D: - "ContextLost" and "ContextRestored" events - "willReadFrequently" option for canvases where lots of readback is expected - More CSS text modifier support - A reset function - A roundRect draw primitive - Conic gradients - Better support for SVG filters https://github.com/fserb/canvas2d

Motivation

Canvas is the web’s direct mode rendering solution that closely matches traditional programming models. This is particularly targeted for games and full featured apps. 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. There's a always a balance to be struck when adding new APIs to the web. That said, it's important that Canvas2D is able to address developer's use cases in game development and text manipulation. 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 3 pillars: 1. feature parity with other 2D APIs; 2. access to current capabilities of the Web/CSS; 3. performance improvement. https://github.com/fserb/canvas2D/blob/master/rationale.md

Standards & signals

Docs: https://github.com/GoogleChromeLabs/puppy-content/blob/puppy/content/en-US/api/canvasrenderingcontext2d/CanvasRenderingContext2D.md

Explainers: https://github.com/fserb/canvas2d https://youtu.be/dfOKFSDG7IM

View on chromestatus.com