Update NDK, more KTX usage (#4792)

* Update NDK

* Utilize more KTX extensions
This commit is contained in:
Taco
2021-04-08 17:56:01 -04:00
committed by GitHub
parent b2d697131c
commit b3471234ad
6 changed files with 17 additions and 34 deletions

View File

@@ -4,6 +4,7 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.Rect
import androidx.core.graphics.createBitmap
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.InputStream
@@ -99,7 +100,7 @@ object ImageUtil {
val singlePage = Rect(0, 0, width / 2, height)
val half = Bitmap.createBitmap(width / 2, height, Bitmap.Config.ARGB_8888)
val half = createBitmap(width / 2, height)
val part = when (side) {
Side.RIGHT -> Rect(width - width / 2, 0, width, height)
Side.LEFT -> Rect(0, 0, width / 2, height)
@@ -122,7 +123,7 @@ object ImageUtil {
val height = imageBitmap.height
val width = imageBitmap.width
val result = Bitmap.createBitmap(width / 2, height * 2, Bitmap.Config.ARGB_8888)
val result = createBitmap(width / 2, height * 2)
val canvas = Canvas(result)
// right -> upper
val rightPart = when (upperSide) {