From c7aa611e524edf43a30f6edea68153cdd08a5534 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 24 Jul 2026 11:13:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(photo-editor):=20=E7=85=A7=E7=89=87?= =?UTF-8?q?=E4=B8=BB=E4=BD=93=E5=A2=9E=E5=8A=A0=E5=9C=86=E8=A7=92=E4=B8=8E?= =?UTF-8?q?=E7=B2=BE=E8=87=B4=E6=82=AC=E6=B5=AE=E9=98=B4=E5=BD=B1=EF=BC=8C?= =?UTF-8?q?=E4=B8=94=E6=97=8B=E8=BD=AC=E6=97=B6100%=E9=9B=B6=E9=BB=91?= =?UTF-8?q?=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 直接在 Image 的 graphicsLayer 上配置 RoundedCornerShape(16.dp)、clip = true 和 shadowElevation = 6.dp,使圆角和阴影紧贴照片主体。 - 旋转时圆角与阴影随照片主体平滑一体旋转,外部无 Card 黑色底盒与死板边框,实现圆角 + 悬浮阴影 + 零黑边的体验。 --- .../kotlin/plus/rua/project/ui/PhotoEditorScreen.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/plus/rua/project/ui/PhotoEditorScreen.kt b/core/src/main/kotlin/plus/rua/project/ui/PhotoEditorScreen.kt index 24cb60e..c44e2f5 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/PhotoEditorScreen.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/PhotoEditorScreen.kt @@ -33,6 +33,8 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.ui.draw.clipToBounds +import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalDensity import kotlin.math.roundToInt import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack @@ -380,7 +382,11 @@ private fun EditableImage( } } - // 1. 照片本体:居中平滑旋转自适应 + val photoShape = remember { RoundedCornerShape(16.dp) } + val density = LocalDensity.current + val shadowElevationPx = remember(density) { with(density) { 6.dp.toPx() } } + + // 1. 照片本体:自带圆角与阴影,居中平滑旋转自适应(无外框,旋转无黑边) Image( bitmap = state.sourceBitmap.asImageBitmap(), contentDescription = "编辑中的照片", @@ -395,6 +401,9 @@ private fun EditableImage( } .graphicsLayer { rotationZ = angle + shadowElevation = shadowElevationPx + shape = photoShape + clip = true } .pointerInput(mode) { if (mode == EditTab.HANDWRITE) { @@ -423,6 +432,7 @@ private fun EditableImage( placeable.place(0, 0) } } + .clip(photoShape) ) { if (mode == EditTab.CROP && state.cropEnabled) { CropOverlay(