Fix: differentiate Default/Simple/Bold watermark styles - Simple now uses lighter bg with dark text

This commit is contained in:
2026-03-06 22:00:59 +08:00
parent 5e6b1b72b5
commit a082d76620
80 changed files with 35 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
#Fri Mar 06 19:06:55 CST 2026
#Fri Mar 06 21:58:44 CST 2026
path.4=14/classes.dex
path.3=12/classes.dex
path.2=10/classes.dex

View File

@@ -1 +1 @@
ëXè¾ú¹Ñ~Ì>Åô­ï`
ëXè¾ú¹Ñ~Ì>Åô­ï`ý¿ÄJùÉïNÔî×

View File

@@ -90,7 +90,7 @@ fun CameraScreen(
onNavigateToSettings: () -> Unit,
onNavigateToMerge: (List<Uri>) -> Unit,
preferencesManager: PreferencesManager
) {
) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
@@ -99,6 +99,7 @@ fun CameraScreen(
var isCapturing by remember { mutableStateOf(false) }
var flashMode by remember { mutableIntStateOf(ImageCapture.FLASH_MODE_AUTO) }
var locationText by remember { mutableStateOf("") }
var recorderName by remember { mutableStateOf("") }
var isLocationLoading by remember { mutableStateOf(true) }
var currentWatermarkStyle by remember { mutableStateOf(WatermarkStyle.Default) }
var currentImageQuality by remember { mutableStateOf(ImageQuality.Standard) }
@@ -113,6 +114,11 @@ fun CameraScreen(
shutterSound.load(MediaActionSound.SHUTTER_CLICK)
}
// 读取记录人信息(偏好)
LaunchedEffect(Unit) {
preferencesManager.recorderName.collect { recorderName = it }
}
// 权限状态
val permissionsState = rememberMultiplePermissionsState(
permissions = listOf(
@@ -234,7 +240,8 @@ fun CameraScreen(
shutterSound.play(MediaActionSound.SHUTTER_CLICK)
flashVisible = true
scope.launch { delay(150); flashVisible = false }
}
},
recorderName = recorderName
)
}
}
@@ -527,7 +534,8 @@ private fun capturePhoto(
locationText: String,
onComplete: (Uri) -> Unit,
onError: () -> Unit = {},
onFeedback: (() -> Unit)? = null
onFeedback: (() -> Unit)? = null,
recorderName: String = ""
) {
Log.d("CameraScreen", "capturePhoto called, locationText=$locationText")
val photoFile = File(
@@ -559,7 +567,8 @@ private fun capturePhoto(
bitmap,
timeText,
locationText,
watermarkStyle
watermarkStyle,
recorderName
)
// 保存到相册

View File

@@ -98,7 +98,8 @@ object ImageProcessor {
sourceBitmap: Bitmap,
timeText: String,
locationText: String,
style: WatermarkStyle
style: WatermarkStyle,
recorderName: String = ""
): Bitmap {
val result = sourceBitmap.copy(Bitmap.Config.ARGB_8888, true)
val canvas = Canvas(result)
@@ -111,6 +112,18 @@ object ImageProcessor {
if (timeText.isNotBlank()) lines.add(timeText)
if (locationText.isNotBlank()) lines.add(locationText)
val bgColor = when (style) {
WatermarkStyle.Default -> android.graphics.Color.argb(180, 40, 40, 40)
WatermarkStyle.Simple -> android.graphics.Color.argb(180, 100, 100, 100)
WatermarkStyle.Bold -> android.graphics.Color.argb(180, 0, 122, 255)
else -> android.graphics.Color.argb(180, 40, 40, 40)
}
val textColor = when (style) {
WatermarkStyle.Simple -> android.graphics.Color.argb(230, 30, 30, 30)
else -> android.graphics.Color.argb(230, 255, 255, 255)
}
if (lines.isNotEmpty()) {
val textAreaHeight = lines.size * lineHeight + padding * 2
val textAreaWidth = result.width * 0.5f
@@ -118,11 +131,11 @@ object ImageProcessor {
val textAreaTop = result.height - textAreaHeight - padding / 2
val bgPaint = android.graphics.Paint().apply {
color = android.graphics.Color.argb(180, 40, 40, 40)
color = bgColor
}
canvas.drawRoundRect(
textAreaLeft - padding / 2,
textAreaTop,
textAreaTop.toFloat(),
result.width.toFloat(),
result.height.toFloat(),
20f, 20f, bgPaint
@@ -145,7 +158,7 @@ object ImageProcessor {
val textPaint = android.graphics.Paint().apply {
isAntiAlias = true
textSize = baseFontSize
color = android.graphics.Color.argb(230, 255, 255, 255)
color = textColor
typeface = Typeface.create("sans-serif-medium", Typeface.NORMAL)
textAlign = android.graphics.Paint.Align.RIGHT
}