mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
20 lines
594 B
Kotlin
20 lines
594 B
Kotlin
package com.github.libretube.util
|
|
|
|
import android.graphics.Bitmap
|
|
import com.github.libretube.obj.PreviewFrame
|
|
|
|
object BitmapUtil {
|
|
/**
|
|
* Cut off a new bitmap from the image that contains multiple preview thumbnails
|
|
*/
|
|
fun cutBitmapFromPreviewFrame(bitmap: Bitmap, previewFrame: PreviewFrame): Bitmap {
|
|
return Bitmap.createBitmap(
|
|
bitmap,
|
|
previewFrame.positionX * previewFrame.frameWidth,
|
|
previewFrame.positionY * previewFrame.frameHeight,
|
|
previewFrame.frameWidth,
|
|
previewFrame.frameHeight
|
|
)
|
|
}
|
|
}
|