clean up ImageUtil

This commit is contained in:
Jays2Kings 2023-02-26 20:43:57 -05:00
parent 87fe634b1c
commit a29a14970d

View file

@ -101,7 +101,7 @@ object ImageUtil {
Format.Webp -> type.isAnimated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P
else -> false
}
} catch (e: Exception) {
} catch (_: Exception) {
}
return false
}
@ -328,23 +328,6 @@ object ImageUtil {
return ColorDrawable(backgroundColor)
}
/**
* Check whether the image is a double-page spread
* @return true if the width is greater than the height
*/
fun isDoublePage(imageStream: InputStream): Boolean {
imageStream.mark(imageStream.available() + 1)
val imageBytes = imageStream.readBytes()
val options = BitmapFactory.Options().apply { inJustDecodeBounds = true }
BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size, options)
imageStream.reset()
return options.outWidth > options.outHeight
}
fun splitBitmap(
imageBitmap: Bitmap,
secondHalf: Boolean,