v134 · graphics
OffscreenCanvas getContextAttributes
Add the getContextAttributes interface from CanvasRenderingContext2D to OffscreenCanvasRenderingContext2D.
concepts
-
OffscreenCanvas getContextAttributes
OffscreenCanvas exposes getContextAttributes() — useful for verifying alpha/colorSpace/willReadFrequently on a worker-thread context.
-
Worker round-trip
The motivating bug: request settings, transfer the canvas to a worker, ask the worker what attributes the engine actually granted. Side-by-side requested-vs-actual scoreboard.
-
Attribute Lab
Toggle every context attribute (alpha, colorSpace, desynchronized, willReadFrequently). Live table compares requested vs granted, with a sample render of the resulting bitmap.
-
Image Pipeline
Four-stage OffscreenCanvas pipeline (source → filter → composite → output). Each stage calls getContextAttributes() to verify alpha, colorSpace, and willReadFrequently were granted as requested — mismatches are flagged before the pipeline runs.
why it shipped
There is a lot of duplicated spec text for CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D, especially related to how CanvasRenderingContext2DSettings is handled.