paintComplexShading

fun KiteCanvas.paintComplexShading(shading: KiteShading, ctm: Matrix, clipPath: KitePath?, alpha: Double = 1.0, blendMode: BlendMode = BlendMode.Normal): Boolean

Renders the T-40 shading types through plain KiteCanvas.fillPath calls, so every backend supports them identically with zero bespoke code:

  • KiteShading.FunctionBased: a 64x64 cell grid over the domain, each cell filled with the function's colour at its centre, mapped by the shading /Matrix.

  • KiteShading.TriangleMesh: each triangle recursively subdivided (depth 3, 64 sub-triangles) with vertex-colour interpolation, a backend-free Gouraud approximation smoother than per-triangle flat fill.

  • KiteShading.PatchMesh: the pre-tessellated flat quads.

Returns false for axial/radial/unsupported so the caller proceeds to its native gradient path. clipPath (the pattern/sh fill region) and the shading /BBox clip via push/popClip around the cells.