mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
clean up ImageUtil
This commit is contained in:
parent
87fe634b1c
commit
a29a14970d
1 changed files with 1 additions and 18 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue