1、服务器抠图结果添加打底方案,防止失败后无法编辑
This commit is contained in:
shenzuqiang 2026-03-13 10:52:01 +08:00
parent ec0149decb
commit 62061c8fe6
2 changed files with 2 additions and 3 deletions

View File

@ -209,7 +209,7 @@ fun CutoutScreen(navController: NavController, viewModel: CutoutViewModel = view
if(isLoadingCutoutMethodFromService){ if(isLoadingCutoutMethodFromService){
// 服务器完成抠图后,再执行本地加载 // 服务器完成抠图后,再执行本地加载
viewModel.cutoutImageFromService(context, it){isSuccess, croppedBitmap -> viewModel.cutoutImageFromService(context, it){isSuccess, croppedBitmap ->
if (isSuccess) { if (isSuccess && croppedBitmap != null) {
cutoutResultBitmap.value = croppedBitmap cutoutResultBitmap.value = croppedBitmap
// 重置头像变换 // 重置头像变换
headTransform.value = TransformState() headTransform.value = TransformState()

View File

@ -77,10 +77,9 @@ class CutoutViewModel : BaseViewModel() {
if (response.status) { if (response.status) {
Log.i("CutoutViewModel", "抠图成功: ${response.data}") Log.i("CutoutViewModel", "抠图成功: ${response.data}")
val resultUrl = Uri.decode(response.data.toString()) val resultUrl = Uri.decode(response.data.toString())
// 将 http 替换为 https // 将 http 替换为 https
//val resultUrl = response.data.toString().replace("http://", "https://") //val resultUrl = resultUrl.replace("http://", "https://")
saveUrlToCache(resultUrl, onResult) saveUrlToCache(resultUrl, onResult)
} else { } else {
errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "抠图失败" }) errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "抠图失败" })