Add date/time to top of merged image - format: yyyy年M月d日 HH:mm:ss

This commit is contained in:
2026-03-06 23:03:27 +08:00
parent 9f1c6052e5
commit d0048c1d1c
39 changed files with 25 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
#Fri Mar 06 22:54:40 CST 2026
#Fri Mar 06 23:02:01 CST 2026
path.4=14/classes.dex
path.3=12/classes.dex
path.2=10/classes.dex

View File

@@ -1 +1 @@
ëXè¾ú¹Ñ~Ì>Åô­ï`ý¿ÄJùÉïNÔî×úbå4å²×?Í#àÀ2èjÓ*ú3
ëXè¾ú¹Ñ~Ì>Åô­ï`ý¿ÄJùÉïNÔî×úbå4å²×?Í#àÀ2èjÓ*ú3ð²À

View File

@@ -234,12 +234,13 @@ object ImageProcessor {
0f
}
// 顶部标题区域高度
// 顶部标题区域高度(标题 + 日期时间,两行)
val topTitleHeight = if (title.isNotBlank()) {
val titlePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
textSize = outputWidth / 20f
}
titlePaint.fontMetrics.let { it.descent - it.ascent } + 40f
val lineHeight = titlePaint.fontMetrics.let { it.descent - it.ascent }
lineHeight * 2 + 50f // 两行文字高度 + 间距
} else 0f
// 图片区域高度
@@ -262,16 +263,32 @@ object ImageProcessor {
Paint().apply { color = android.graphics.Color.WHITE }
)
// 深色标题文字
// 标题文字
val titlePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
textSize = outputWidth / 20f
color = android.graphics.Color.argb(255, 51, 51, 51) // 深灰色文字
color = android.graphics.Color.argb(255, 51, 51, 51)
typeface = Typeface.create("sans-serif", Typeface.BOLD)
textAlign = android.graphics.Paint.Align.CENTER
isAntiAlias = true
}
val titleY = topTitleHeight / 2 + titlePaint.fontMetrics.let { it.descent - it.ascent } / 2
val lineHeight = titlePaint.fontMetrics.let { it.descent - it.ascent }
// 第一行:标题
val titleY = topTitleHeight * 0.3f + titlePaint.fontMetrics.let { it.descent - it.ascent } / 2
canvas.drawText(title, outputWidth / 2f, titleY, titlePaint)
// 第二行:日期时间
val dateFormat = java.text.SimpleDateFormat("yyyy年M月d日 HH:mm:ss", java.util.Locale.getDefault())
val dateTimeText = dateFormat.format(java.util.Date())
val datePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
textSize = outputWidth / 28f
color = android.graphics.Color.argb(255, 80, 80, 80)
typeface = Typeface.create("sans-serif", Typeface.NORMAL)
textAlign = android.graphics.Paint.Align.CENTER
isAntiAlias = true
}
val dateY = topTitleHeight * 0.75f + datePaint.fontMetrics.let { it.descent - it.ascent } / 2
canvas.drawText(dateTimeText, outputWidth / 2f, dateY, datePaint)
}
// 绘制图片网格