core-ktx / androidx.graphics / android.graphics.Canvas

Extensions for android.graphics.Canvas

withRotation

fun Canvas.withRotation(degrees: Float = 0.0f, pivotX: Float = 0.0f, pivotY: Float = 0.0f, block: Canvas.() -> Unit): Unit

Wrap the specified block in calls to Canvas.save/Canvas.rotate and Canvas.restoreToCount.

withSave

fun Canvas.withSave(block: Canvas.() -> Unit): Unit

Wrap the specified block in calls to Canvas.save and Canvas.restoreToCount.

withScale

fun Canvas.withScale(x: Float = 1.0f, y: Float = 1.0f, pivotX: Float = 0.0f, pivotY: Float = 0.0f, block: Canvas.() -> Unit): Unit

Wrap the specified block in calls to Canvas.save/Canvas.scale and Canvas.restoreToCount.

withSkew

fun Canvas.withSkew(x: Float = 0.0f, y: Float = 0.0f, block: Canvas.() -> Unit): Unit

Wrap the specified block in calls to Canvas.save/Canvas.skew and Canvas.restoreToCount.

withTranslation

fun Canvas.withTranslation(x: Float = 0.0f, y: Float = 0.0f, block: Canvas.() -> Unit): Unit

Wrap the specified block in calls to Canvas.save/Canvas.translate and Canvas.restoreToCount.