Everything inside the "main" closed bezier curve is in solid color specified by the user and everything
in
between the "main" and the "outside" closed bezier curve is a ramp
where the control points on the outside have a black and transparant
color.
Currently, our implementation does the following:
- Subdivide the 2 bezier curves in a good enough number of steps so that it is not visible at the render resolution
- Tesselate the internal bezier, which is now a polygon, into triangles, triangle fans and triangle strips: send those primitive to OpenGL directly with the solid color
- Tesselate manually the region between the inner and outter polygons, by progressively iterating on the edges as triangles or triangle fans where possible. Send those primitives to OpenGL with correct vertices color and a special fragment shader is applied to compute the Ramp with user supplied parameters (Fall-off, Ramp type, etc....)
At first it looks like the correct approach to port this to skia would be to use Coons patch instead of tesselating on our own: We would have everything inside the inner closed bezier split into Coons patchs and everything in between the 2 splines as Coons patchs as well.
However I'm not aware of a simple way to achieve transformation of a closed bezier curve into an arbitrary amount of Coons patch. Does skia knows how to do so ? The only thing I could find on the internet to do so is https://github.com/vectorgraphics/asymptote/blob/master/base/bezulate.asy in the Asymptote library.
A second, less attractive approach would be to keep the current workflow but somehow inject this in the middle of other Skia operations, either as raw OpenGL or by using the Skia API... but is there any way to apply GLSL fragment shaders and upload OpenGL primitives ?
Thank you for your time,
Alexandre