mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-25 07:51:26 +01:00
save and restore canvas around drawing the background
This commit is contained in:
parent
bab1211339
commit
f9f247ecaf
@ -11,12 +11,15 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
canvas.save()
|
||||
|
||||
if (backgroundBitmap != null) {
|
||||
val left = (width - backgroundBitmap!!.width) / 2
|
||||
val top = (height - backgroundBitmap!!.height) / 2
|
||||
canvas.drawBitmap(backgroundBitmap, left.toFloat(), top.toFloat(), null)
|
||||
}
|
||||
|
||||
canvas.restore()
|
||||
}
|
||||
|
||||
fun updateBackgroundBitmap(bitmap: Bitmap) {
|
||||
|
Loading…
Reference in New Issue
Block a user