Re: [w3ctag/design-reviews] CanvasRenderingContext2D API Improvements (#627)

Hey @LeaVerou! Thank you so much for the feedback. Very glad to hear that you all are on board with the bulk of these changes. It’s exciting to have the opportunity to make the web platform more expressive and useful! As per your concerns:

**CSSColorValue as input:**
As @annevk has pointed out in [this issue](https://github.com/whatwg/html/pull/6609) if CSSColorValues can stringify then we can use them as style input without changing anything in the specification. A User Agent could short-circuit this and accept the object as an input, but the code would still work the same with the string translation. Would it be ok to add a note to that effect on the spec?


**TextModifiers:**
With the original proposal, we were trying to make sure that all text related attributes were prepended by the string `text` or `font`, which is the case for current text/font properties on CanvasRenderingContext2D. But we also see the rationale behind keeping the names equivalent to those found in HTMLElement style. Unless there’s any other mention to the contrary, we’ll go ahead and change the two affected ones: `textLetterSpacing` and `textWordSpacing` will become `letterSpacing` and `wordSpacing`, respectively.

**Perspective Transforms:**
We’re okay to table this feature for the time being.

**SVG Filters:**
The under-powering is intentional and based on implementer feedback. As @litherum mentioned [here](https://github.com/whatwg/html/issues/5621):
> if we're going to add filter support, we should start with a small set of popular filters, and only expand the set if compelling needs arise. Also, we should start with the "linked-list" model of filters that the css filter() function accepts, rather than arbitrary graphs that are allowed by SVG.

This is a rather large change and it made sense to bite off a smaller chunk for the time being. The proposed syntax could be trivially extended to support DAGs in the future, by allowing CanvasFilters as parameters values.
 
One of the major motivations for this feature is to make filters available on WebWorkers with OffscreenCanvas. SVG and CSS are DOM dependent, and not trivially available on WebWorkers and thus a new syntax would already be necessary. This proposal has the advantage of being trivially parseable (as a regular Javascript object) and familiar to Javascript developers. Attribute names are copied verbatim from the SVG implementation also with the goal of being as un-surprising as possible.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/627#issuecomment-854034216

Received on Thursday, 3 June 2021 17:05:53 UTC