paintComplexShading

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

Renders the complex shading types, so every backend supports them identically with no code of its own:

  • 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. For an opaque, normal paint, neighbouring cells overlap by about half a device pixel, so the page does not show through the seams between their anti-aliased edges.

  • KiteShading.TriangleMesh and KiteShading.PatchMesh: rasterized here into one image of the device pixels they cover, which the canvas draws with KiteCanvas.drawImage. See paintMesh.

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 paint.