drawShadow

fun drawShadow(canvas: Canvas, path: Path, zPlaneParams: Point3, lightPos: Point3, lightRadius: Float, ambientColor: Int, spotColor: Int, transparentOccluder: Boolean, geometricOnly: Boolean)

Draw an offset spot shadow and outlining ambient shadow for the given path using a disc light. The shadow may be cached, depending on the path type and canvas matrix. If the matrix is perspective or the path is volatile, it will not be cached.

Parameters

canvas

The canvas on which to draw the shadows.

path

The occluder used to generate the shadows.

zPlaneParams

Values for the plane function which returns the Z offset of the occluder from the canvas based on local x and y values (the current matrix is not applied).

lightPos

The 3D position of the light relative to the canvas plane. This is independent of the canvas's current matrix.

lightRadius

The radius of the disc light.

ambientColor

The color of the ambient shadow.

spotColor

The color of the spot shadow.

transparentOccluder

The occluding object is not opaque. Knowing that the occluder is opaque allows us to cull shadow geometry behind it and improve performance.

geometricOnly

Don't try to use analytic shadows.