Android Graphics Utilities / it.czerwinski.android.graphics / android.graphics.Canvas / withRadialTranslation

withRadialTranslation

inline fun Canvas.withRadialTranslation(distance: Float, angle: Float, block: Canvas.() -> Unit): Unit

Wraps the specified block in a call to Canvas.withTranslation() with the specified radial coordinates.

Example:

canvas.withRadialTranslation(
    distance = 10.0f,
    angle = 30.0f
) {
    drawRect(rect, paint)
}

Parameters

distance - Translation distance.

angle - Translation angle in degrees.

block - A block of instructions to be executed with the specified translation.

Receiver The canvas.