I decided to completely abandon the use of raster graphics in the GUI of the plug-ins being developed, replacing it with vector graphics. However, not everything turned out to be as good as we would like to see an elegant graphical interface.
The first trouble arose when using a complex linear gradient using NanoVG (there is no such problem with Skia).
As I later found out, the problem is hidden in the NanoVGPaint function.
Namely, in this place:
NVGcolor icol = NanoVGColor(pattern.GetStop(0).mColor, pBlend);
NVGcolor ocol = NanoVGColor(pattern.GetStop(pattern.NStops() - 1).mColor, pBlend);
That is, the implementation of a linear gradient implies only extreme points, ignoring intermediate ones.
The idea of splitting the path into several parts in accordance with the parts is gradient and coloring these sections separately is difficult to implement and, in my opinion, smacks of perversion.
Any other ideas?