This commit is contained in:
2026-02-10 19:02:21 +08:00
parent 3d29e17225
commit 655e9cd56e
12 changed files with 333 additions and 46 deletions
@@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import java.io.File
object ImageUtil {
fun uriToBitmap(context: Context, uri: Uri): Bitmap? {
@@ -23,4 +24,13 @@ object ImageUtil {
}
}
// 直接解码文件路径
fun decodeFromFile(file: File): Bitmap? {
return if (file.exists()) {
BitmapFactory.decodeFile(file.absolutePath)
} else {
null
}
}
}