If I draw some dots on a Canvas with drawCircle, is there a way to put some shadows behind each dot? (I'm porting some iOS/CoreGraphics code, a scatter plot with shadows behind the points.)
robnik
04/26/2021, 9:44 PM
I found a way. If anyone else searches for this, here it is:
Copy code
val shadowColor = 0x66000000
val shadowPaint = Paint()
val shadowFrameworkPaint = shadowPaint.asFrameworkPaint()
shadowFrameworkPaint.setShadowLayer(
shadowRadius.toPx(),
shadowOffsetX.toPx(),
shadowOffsetY.toPx(),
shadowColor
)
drawIntoCanvas {
it.drawCircle(center=point, radius=10f, shadowPaint)
}