w3c / css-houdini-drafts

Mirror of https://hg.css-houdini.org/drafts
https://drafts.css-houdini.org/
Other
1.84k stars 141 forks source link

[css-paint-worklet] How to manipulate pixel data of CSS PaintWorklet context #1015

Open ku8ar opened 3 years ago

ku8ar commented 3 years ago

Original question

PaintRenderingContext2D does not have putImageData and an ImageData interface. If PaintWorklet allowed pixel manipulation with CanvasRenderingContext2D, it would be possible to create beautiful placeholders (e.g. using BlurHash algorithm). Why doesn't PaintWorklet allow direct manipulation of pixels? Or maybe there is any other way to draw an image in PaintWorklet from Uint8ClampedArray source?

krijnhoetmer commented 3 years ago

I was wondering the same while playing with this BlurHash/Paint API experiment. Are there any plans to introduce this?

tabatkins commented 3 years ago

The PaintWorklet context is currently restricted to the operations that can be translated into DisplayLists and similar underlying browser drawing tech, so that it can be stored, painted, and replayed more easily without needing to allocate potentially-large pixel buffers.