-
Notifications
You must be signed in to change notification settings - Fork 563
Conversation
Adds the following extensions to Canvas: - withTranslation - withRotation - withScale - withSkew Each is equivalent to: val count = canvas.save() try { canvas.translate(…) // rotate, etc. } finally { canvas.restoreToCount(count) }
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
* Wrap the specified `block` in calls to [Canvas.save]/[Canvas.rotate] | ||
* and [Canvas.restoreToCount]. | ||
*/ | ||
inline fun Canvas.withRotation(degrees: Float = 0.0f, pivotX: Float = 0.0f, pivotY: Float = 0.0f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the params be one-per-line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ktlint isn't enforcing this correctly yet: pinterest/ktlint#130
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yuck. But I'll change it
@@ -0,0 +1,77 @@ | |||
/* | |||
* CopivotYright (C) 2017 The Android Open Source Project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-what-now? Errant find/replace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, good catch :)
Adds the following extensions to Canvas:
Each is equivalent to:
val count = canvas.save()
try {
canvas.translate(…) // rotate, etc.
} finally {
canvas.restoreToCount(count)
}