postcss-conic-gradient icon indicating copy to clipboard operation
postcss-conic-gradient copied to clipboard

Update canvas conic implementation

Open jonathantneal opened this issue 7 years ago • 3 comments

The conic gradient script should be updated, as it uses a version of the conic gradient polyfill that is a few years ago.

The latest and most feature-rich version appears to live at https://github.com/LeaVerou/conic-gradient/blob/665dbb4e104cc0dffdbe1715eb164c389892fd60/conic-gradient.js

@khovansky-al, could we use this version of the file and apply the deltas required by CanvasKit? We could add this to the next branch.

jonathantneal avatar Dec 13 '18 02:12 jonathantneal

Yes, I will make the required changes, hopefully tonight.

khovansky-al avatar Dec 13 '18 10:12 khovansky-al

@jonathantneal Alright, I tried porting that implementation over to CanvasKit. It uses a new approach to calculate color values using reference linear gradient generated by another buffer canvas.

I encountered a couple of bugs with Linear Gradient Shader but figured out fixes for most of them and will continue to figure out the remaining tomorrow. If it turns out that something is not easily fixable then I will for now just fall back to the latest master revision of the polyfill that still has more features than our current one but doesn't use gradients for color calculation yet.

Btw. CanvasKit was rapidly evolving lately and now has HTMLCanvas that is a wrapper over what we use right now and has same syntax and call signatures as a browser canvas. That's a perk that will allow for even less differences with original polyfill code in terms of drawing.

khovansky-al avatar Dec 14 '18 00:12 khovansky-al

https://www.npmjs.com/package/canvaskit-wasm

kjlubick avatar Dec 18 '18 13:12 kjlubick