refactor: color edit panel

This commit is contained in:
zhoubinjia committed 2026-09-03 17:46:59 +08:00
1 parent 8c1f5248c1
commit bdfe099f53
34 files changed
+1806 -905

No files matched your search

@@ -319,7 +319,6 @@ class PhotoProcessor(
sdrBitmap,
colorCorrection.baselineLayer,
colorCorrection.creativeLayer,
0f,
noiseReductionValue = 0f,
chromaNoiseReductionValue = 0f,
luminanceGainDownsample = RawGainmapMath.DOWNSAMPLE,
@@ -720,7 +719,6 @@ class PhotoProcessor(
b,
colorCorrection.baselineLayer,
colorCorrection.creativeLayer,
0f,
noiseReductionValue = 0f,
chromaNoiseReductionValue = 0f
)
@@ -756,7 +754,6 @@ class PhotoProcessor(
lutLuminanceGainDownsample: Int = 1,
): Bitmap = withContext(Dispatchers.IO) {
var result = input
val finalSharpening = metadata.sharpening ?: (if (metadata.isImported) 0f else sharpening)
val finalNoiseReduction = metadata.noiseReduction ?: (if (metadata.isImported) 0f else noiseReduction)
val finalChromaNoiseReduction =
metadata.chromaNoiseReduction ?: (if (metadata.isImported) 0f else chromaNoiseReduction)
@@ -783,7 +780,6 @@ class PhotoProcessor(
result,
colorCorrection.baselineLayer,
colorCorrection.creativeLayer,
finalSharpening,
finalNoiseReduction,
finalChromaNoiseReduction,
luminanceGainDownsample = lutLuminanceGainDownsample,
@@ -795,7 +791,6 @@ class PhotoProcessor(
result,
colorCorrection.baselineLayer,
colorCorrection.creativeLayer,
finalSharpening,
finalNoiseReduction,
finalChromaNoiseReduction
)
@@ -70,6 +70,7 @@ object BakedLutExporter {
private fun ColorRecipeParams.toBakeableRecipe(): ColorRecipeParams {
return copy(
sharpness = 0f,
filmGrain = 0f,
clarity = 0f,
vignette = 0f,
@@ -31,6 +31,7 @@ internal data class ColorPassLocations(
val uToneToeLocation: Int,
val uToneShoulderLocation: Int,
val uTonePivotLocation: Int,
val uSharpeningLocation: Int,
val uFilmGrainLocation: Int,
val uFilmGrainSeedLocation: Int,
val uFilmGrainPixelScaleLocation: Int,
@@ -131,6 +132,7 @@ internal class PreviewColorProgramCache {
uToneToeLocation = GLES30.glGetUniformLocation(program, "uToneToe"),
uToneShoulderLocation = GLES30.glGetUniformLocation(program, "uToneShoulder"),
uTonePivotLocation = GLES30.glGetUniformLocation(program, "uTonePivot"),
uSharpeningLocation = GLES30.glGetUniformLocation(program, "uSharpening"),
uFilmGrainLocation = GLES30.glGetUniformLocation(program, "uFilmGrain"),
uFilmGrainSeedLocation = GLES30.glGetUniformLocation(program, "uFilmGrainSeed"),
uFilmGrainPixelScaleLocation = GLES30.glGetUniformLocation(program, "uFilmGrainPixelScale"),
@@ -18,7 +18,6 @@ import com.hinnka.mycamera.processor.GlesComputeWorkGroup
import com.hinnka.mycamera.processor.DenoiseStrength
import com.hinnka.mycamera.raw.DenoiseProfileNlmConfig
import com.hinnka.mycamera.raw.DenoiseProfileShaders
import com.hinnka.mycamera.raw.RawSharpenPass
import com.hinnka.mycamera.utils.LargeDirectBuffer
import com.hinnka.mycamera.utils.PLog
import kotlinx.coroutines.asCoroutineDispatcher
@@ -336,7 +335,6 @@ class LutImageProcessor(context: Context? = null) {
* @param argbData RGBA 16-bit 格式的像素数据 (ShortBuffer) [width, height, r1, g1, b1, a1, ...]
* @param lutConfig LUT 配置
* @param colorRecipeParams 色彩配方参数
* @param sharpeningValue 锐化强度
* @param noiseReductionValue 降噪强度
* @param chromaNoiseReductionValue 减少杂色强度
*/
@@ -347,7 +345,6 @@ class LutImageProcessor(context: Context? = null) {
colorSpace: ColorSpace,
lutConfig: LutConfig?,
colorRecipeParams: ColorRecipeParams?,
sharpeningValue: Float = 0f,
noiseReductionValue: Float = 0f,
chromaNoiseReductionValue: Float = 0f,
lutMaskType: Int = 0,
@@ -366,8 +363,8 @@ class LutImageProcessor(context: Context? = null) {
val softLight = effectiveRecipeParams?.softLight ?: 0f
val redHalation = effectiveRecipeParams?.redHalation ?: 0f
// 后期处理参数
val sharpening: Float = sharpeningValue
// 锐度属于色彩配方,在完成 sRGB 调色后统一处理;不读取 RAW/元数据锐化值。
val sharpening: Float = effectiveRecipeParams?.sharpness?.coerceIn(-1f, 1f) ?: 0f
val noiseReduction: Float = noiseReductionValue
val chromaNoiseReduction: Float = chromaNoiseReductionValue
val chromaDenoiseStrength = DenoiseStrength.clamp(chromaNoiseReduction)
@@ -440,7 +437,6 @@ class LutImageProcessor(context: Context? = null) {
colorSpace: ColorSpace,
baselineLayer: LutRenderLayer?,
creativeLayer: LutRenderLayer?,
sharpeningValue: Float = 0f,
noiseReductionValue: Float = 0f,
chromaNoiseReductionValue: Float = 0f,
): Bitmap {
@@ -462,7 +458,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap = baseBitmap,
lutConfig = creativeLayer.lutConfig,
colorRecipeParams = creativeLayer.colorRecipeParams,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue
)
@@ -474,7 +469,6 @@ class LutImageProcessor(context: Context? = null) {
colorSpace = colorSpace,
lutConfig = baselineLayer.lutConfig,
colorRecipeParams = baselineLayer.colorRecipeParams,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue
)
@@ -485,7 +479,6 @@ class LutImageProcessor(context: Context? = null) {
colorSpace = colorSpace,
lutConfig = creativeLayer?.lutConfig,
colorRecipeParams = creativeLayer?.colorRecipeParams,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue
)
@@ -498,7 +491,6 @@ class LutImageProcessor(context: Context? = null) {
* @param bitmap 输入图片
* @param lutConfig LUT 配置
* @param colorRecipeParams 色彩配方参数
* @param sharpeningValue 锐化强度
* @param noiseReductionValue 降噪强度
* @param chromaNoiseReductionValue 减少杂色强度
*/
@@ -506,7 +498,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap: Bitmap,
lutConfig: LutConfig?,
colorRecipeParams: ColorRecipeParams?,
sharpeningValue: Float = 0f,
noiseReductionValue: Float = 0f,
chromaNoiseReductionValue: Float = 0f,
lutMaskType: Int = 0,
@@ -524,8 +515,8 @@ class LutImageProcessor(context: Context? = null) {
val softLight = effectiveRecipeParams?.softLight ?: 0f
val redHalation = effectiveRecipeParams?.redHalation ?: 0f
// 后期处理参数(仅在软件处理模式下生效)
val sharpening: Float = sharpeningValue
// 锐度属于色彩配方,在完成 sRGB 调色后统一处理;不读取 RAW/元数据锐化值。
val sharpening: Float = effectiveRecipeParams?.sharpness?.coerceIn(-1f, 1f) ?: 0f
val noiseReduction: Float = noiseReductionValue
val chromaNoiseReduction: Float = chromaNoiseReductionValue
val chromaDenoiseStrength = DenoiseStrength.clamp(chromaNoiseReduction)
@@ -599,7 +590,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap: Bitmap,
baselineLayer: LutRenderLayer?,
creativeLayer: LutRenderLayer?,
sharpeningValue: Float = 0f,
noiseReductionValue: Float = 0f,
chromaNoiseReductionValue: Float = 0f,
): Bitmap {
@@ -618,7 +608,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap = baseBitmap,
lutConfig = creativeLayer.lutConfig,
colorRecipeParams = creativeLayer.colorRecipeParams,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue
)
@@ -627,7 +616,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap = bitmap,
lutConfig = baselineLayer.lutConfig,
colorRecipeParams = baselineLayer.colorRecipeParams,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue
)
@@ -635,7 +623,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap = bitmap,
lutConfig = creativeLayer?.lutConfig,
colorRecipeParams = creativeLayer?.colorRecipeParams,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue
)
@@ -651,7 +638,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap: Bitmap,
baselineLayer: LutRenderLayer?,
creativeLayer: LutRenderLayer?,
sharpeningValue: Float = 0f,
noiseReductionValue: Float = 0f,
chromaNoiseReductionValue: Float = 0f,
luminanceGainDownsample: Int = 1,
@@ -660,7 +646,6 @@ class LutImageProcessor(context: Context? = null) {
bitmap = bitmap,
baselineLayer = baselineLayer,
creativeLayer = creativeLayer,
sharpeningValue = sharpeningValue,
noiseReductionValue = noiseReductionValue,
chromaNoiseReductionValue = chromaNoiseReductionValue,
)
@@ -1068,7 +1053,7 @@ class LutImageProcessor(context: Context? = null) {
val postClarityTextureId = if (clarityApplied) clarityOutputTextureId else outputTextureId
val postClarityFramebufferId = if (clarityApplied) clarityOutputFboId else framebufferId
val sharpened = sharpening > 0f &&
val sharpened = kotlin.math.abs(sharpening) > 0.0001f &&
renderLutSharpenPass(postClarityTextureId, width, height, sharpening)
val postSharpenTextureId = if (sharpened) lutSharpenTextureId else postClarityTextureId
val postSharpenFramebufferId = if (sharpened) lutSharpenFboId else postClarityFramebufferId
@@ -1445,8 +1430,8 @@ class LutImageProcessor(context: Context? = null) {
if (lutSharpenProgram == 0) {
lutSharpenProgram = createFragmentProgram(
IMAGE_VERTEX_SHADER,
RawSharpenPass.FRAGMENT_SHADER,
"LutSharpen",
SrgbSharpnessShader.FRAGMENT_SHADER,
"SrgbSharpness",
)
}
}
@@ -1831,7 +1816,7 @@ class LutImageProcessor(context: Context? = null) {
height: Int,
sharpening: Float
): Boolean {
if (sharpening <= 0f) return false
if (kotlin.math.abs(sharpening) <= 0.0001f) return false
ensureLutSharpenProgram()
if (lutSharpenProgram == 0 || !setupLutSharpenFramebuffer(width, height)) {
return false
@@ -1859,11 +1844,11 @@ class LutImageProcessor(context: Context? = null) {
)
GLES30.glUniform1f(
GLES30.glGetUniformLocation(lutSharpenProgram, "uRadius"),
RawSharpenPass.DEFAULT_RADIUS
SrgbSharpnessShader.DEFAULT_RADIUS
)
GLES30.glUniform1f(
GLES30.glGetUniformLocation(lutSharpenProgram, "uThreshold"),
RawSharpenPass.DEFAULT_THRESHOLD
SrgbSharpnessShader.DEFAULT_THRESHOLD
)
GLES30.glUniformMatrix4fv(
GLES30.glGetUniformLocation(lutSharpenProgram, "uMVPMatrix"),
@@ -48,7 +48,7 @@ class LutManager(private val context: Context) {
"exposure", "contrast", "saturation", "temperature", "tint", "fade", "color",
"highlights", "shadows", "toneToe", "toneShoulder", "tonePivot",
"paletteX", "paletteY", "paletteDensity",
"filmGrain", "vignette", "flash", "bleachBypass", "clarity", "bloom", "softLight", "halation", "redHalation", "chromaticAberration",
"filmGrain", "vignette", "flash", "bleachBypass", "clarity", "sharpness", "bloom", "softLight", "halation", "redHalation", "chromaticAberration",
"noise", "lowRes",
"skinHue", "skinChroma", "skinLightness",
"redHue", "redChroma", "redLightness",
@@ -92,6 +92,7 @@ class LutManager(private val context: Context) {
flash = f("flash"),
bleachBypass = f("bleachBypass"),
clarity = f("clarity"),
sharpness = f("sharpness"),
bloom = f("bloom"),
softLight = f("softLight"),
halation = 0f,
@@ -442,6 +442,9 @@ class LutRenderer(context: Context) : GLSurfaceView.Renderer {
@Volatile
var clarity: Float = 0f // -1.0 ~ +1.0
@Volatile
var sharpness: Float = 0f // -1.0 ~ +1.0,sRGB 锐度
@Volatile
var bloom: Float = 0f // 0.0 ~ 1.0
@@ -903,6 +906,7 @@ class LutRenderer(context: Context) : GLSurfaceView.Renderer {
GLES30.glUniform1f(locations.uToneToeLocation, params.toneToe)
GLES30.glUniform1f(locations.uToneShoulderLocation, params.toneShoulder)
GLES30.glUniform1f(locations.uTonePivotLocation, params.tonePivot)
GLES30.glUniform1f(locations.uSharpeningLocation, params.sharpness.coerceIn(-1f, 1f))
GLES30.glUniform1f(locations.uFilmGrainLocation, params.filmGrain)
GLES30.glUniform1f(
locations.uFilmGrainSeedLocation,
@@ -3583,6 +3587,7 @@ class LutRenderer(context: Context) : GLSurfaceView.Renderer {
flash = flash,
bleachBypass = bleachBypass,
clarity = clarity,
sharpness = sharpness,
bloom = bloom,
softLight = softLight,
chromaticAberration = chromaticAberration,
@@ -3677,6 +3682,7 @@ class LutRenderer(context: Context) : GLSurfaceView.Renderer {
flash = params.flash
bleachBypass = params.bleachBypass
clarity = params.clarity
sharpness = params.sharpness
bloom = params.bloom
softLight = params.softLight
chromaticAberration = params.chromaticAberration
@@ -51,6 +51,7 @@ internal object PreviewColorShader {
uniform float uToneToe;
uniform float uToneShoulder;
uniform float uTonePivot;
uniform float uSharpening;
${if (variant.includePreLogFilmGrain) """
uniform float uFilmGrain;
uniform float uFilmGrainSeed;
@@ -386,6 +387,37 @@ internal object PreviewColorShader {
}
""" else ""}
// 锐度是色彩配方的最终 sRGB 空间操作。邻域只用于提取亮度细节,
// 调整量直接叠加到完成曲线、LUT 与空间效果后的 sRGB 结果。
if (uColorRecipeEnabled && abs(uSharpening) > 0.0001) {
vec2 rawDx = vec2(uTexelSize.x, 0.0);
vec2 rawDy = vec2(0.0, uTexelSize.y);
float centerLuma = getLuma(texture(uCameraTexture, uvCoord).rgb);
float neighborLuma = 0.0;
neighborLuma += getLuma(texture(
uCameraTexture,
(uSTMatrix * vec4(rcCoord - rawDx, 0.0, 1.0)).xy
).rgb);
neighborLuma += getLuma(texture(
uCameraTexture,
(uSTMatrix * vec4(rcCoord + rawDx, 0.0, 1.0)).xy
).rgb);
neighborLuma += getLuma(texture(
uCameraTexture,
(uSTMatrix * vec4(rcCoord - rawDy, 0.0, 1.0)).xy
).rgb);
neighborLuma += getLuma(texture(
uCameraTexture,
(uSTMatrix * vec4(rcCoord + rawDy, 0.0, 1.0)).xy
).rgb);
float delta = centerLuma - neighborLuma * 0.25;
float detail = sign(delta) * max(abs(delta) - 0.005, 0.0);
float sharpeningStrength = uSharpening > 0.0
? uSharpening * 2.0
: uSharpening;
color.rgb = sanitizeColor(color.rgb + vec3(detail * sharpeningStrength));
}
fragColor = vec4(clamp(sanitizeColor(color.rgb), 0.0, 1.0), color.a);
}
""".trimIndent()
@@ -520,6 +520,7 @@ class RealtimeVideoRenderer(
GLES30.glUniform1f(locations.uToneToeLocation, params.toneToe)
GLES30.glUniform1f(locations.uToneShoulderLocation, params.toneShoulder)
GLES30.glUniform1f(locations.uTonePivotLocation, params.tonePivot)
GLES30.glUniform1f(locations.uSharpeningLocation, params.sharpness.coerceIn(-1f, 1f))
GLES30.glUniform1f(locations.uFilmGrainLocation, params.filmGrain)
GLES30.glUniform1f(
locations.uFilmGrainSeedLocation,
@@ -0,0 +1,69 @@
package com.hinnka.mycamera.lut
/**
* Final display-referred sharpness pass for encoded sRGB images.
*
* Positive values increase luminance edge contrast. Negative values reduce the same detail and
* converge toward the local Gaussian blur without reversing edges at the -1 endpoint.
*/
internal object SrgbSharpnessShader {
const val DEFAULT_RADIUS = 1f
const val DEFAULT_THRESHOLD = 0.005f
val FRAGMENT_SHADER = """
#version 300 es
precision highp float;
in vec2 vTexCoord;
out vec4 fragColor;
uniform sampler2D uInputTexture;
uniform vec2 uTexelSize;
uniform float uSharpening;
uniform float uRadius;
uniform float uThreshold;
float luminance(vec3 color) {
return dot(color, vec3(0.2126, 0.7152, 0.0722));
}
void main() {
vec3 center = texture(uInputTexture, vTexCoord).rgb;
if (abs(uSharpening) <= 0.0001) {
fragColor = vec4(center, 1.0);
return;
}
float radius = max(uRadius, 0.001);
float sigma = max(radius * 0.5, 0.001);
float twoSigmaSquared = 2.0 * sigma * sigma;
vec3 blur = vec3(0.0);
float weightSum = 0.0;
for (int y = -2; y <= 2; y++) {
for (int x = -2; x <= 2; x++) {
vec2 offset = vec2(float(x), float(y));
float distanceSquared = dot(offset, offset);
float weight = exp(-distanceSquared / twoSigmaSquared);
blur += texture(
uInputTexture,
vTexCoord + offset * uTexelSize * radius
).rgb * weight;
weightSum += weight;
}
}
blur /= max(weightSum, 1e-5);
float centerLuma = luminance(center);
float blurLuma = luminance(blur);
float delta = centerLuma - blurLuma;
float detail = sign(delta) * max(abs(delta) - uThreshold, 0.0);
float sharpeningStrength = uSharpening > 0.0
? uSharpening * 2.0
: uSharpening;
vec3 result = center + center *
(detail / max(centerLuma, 1e-5)) * sharpeningStrength;
fragColor = vec4(clamp(result, 0.0, 1.0), 1.0);
}
""".trimIndent()
}
@@ -20,7 +20,7 @@ import java.nio.ByteOrder
@UnstableApi
class VideoLutEffect(
@Volatile var lutConfig: LutConfig?,
recipeParams: ColorRecipeParams?
recipeParams: ColorRecipeParams?,
) : GlEffect {
@Volatile
var recipeParams: ColorRecipeParams? = recipeParams?.let(ColorPaletteMapper::mergeIntoEffectiveParams)
@@ -664,7 +664,7 @@ private class VideoLutShaderProgram(
}
}
if (uSharpening > 0.0) {
if (abs(uSharpening) > 0.0001) {
vec3 inputColor = texture(uImageTexture, uvCoord).rgb;
float inputLuma = getLuma(inputColor);
float neighborsLuma = 0.0;
@@ -673,8 +673,12 @@ private class VideoLutShaderProgram(
neighborsLuma += getLuma(texture(uImageTexture, uvCoord + vec2(0.0, -uTexelSize.y)).rgb);
neighborsLuma += getLuma(texture(uImageTexture, uvCoord + vec2(0.0, uTexelSize.y)).rgb);
float blurLuma = neighborsLuma * 0.25;
float detail = inputLuma - blurLuma;
color.rgb += detail * uSharpening * 2.0;
float delta = inputLuma - blurLuma;
float detail = sign(delta) * max(abs(delta) - 0.005, 0.0);
float sharpeningStrength = uSharpening > 0.0
? uSharpening * 2.0
: uSharpening;
color.rgb += detail * sharpeningStrength;
}
if (uFilmGrain > 0.001) {
@@ -964,7 +968,10 @@ private class VideoLutShaderProgram(
GLES30.glUniform1i(GLES30.glGetUniformLocation(programId, "uInputColorSpace"), 0) // 默认 sRGB
GLES30.glUniform1f(GLES30.glGetUniformLocation(programId, "uChromaticAberration"), 0f)
GLES30.glUniform1f(GLES30.glGetUniformLocation(programId, "uSharpening"), 0f)
GLES30.glUniform1f(
GLES30.glGetUniformLocation(programId, "uSharpening"),
currentRecipeParams?.sharpness?.coerceIn(-1f, 1f) ?: 0f,
)
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4)
checkGlError("glDrawArrays")
@@ -558,10 +558,10 @@ fun LutSynthesisScreen(
ModalBottomSheet(
onDismissRequest = { showBakeParamsSheet = false },
sheetState = sheetState,
containerColor = Color.Black.copy(alpha = 0.8f),
containerColor = Color.Transparent,
contentColor = Color.White,
scrimColor = Color.Transparent,
dragHandle = { BottomSheetDefaults.DragHandle(color = Color.White.copy(alpha = 0.3f)) }
dragHandle = null,
) {
val paletteState = remember(recipe) {
ColorPaletteState(
@@ -276,6 +276,7 @@ class LutSynthesisViewModel(application: Application) : AndroidViewModel(applica
// 2. 应用去除空间类后的调色烘焙配方
val recipe = _colorRecipe.value
val bakeableRecipe = recipe.copy(
sharpness = 0f,
filmGrain = 0f,
vignette = 0f,
flash = 0f,
@@ -142,6 +142,7 @@ internal object CameraPresetJsonCodec {
flash = obj.float("flash", default.flash),
bleachBypass = obj.float("bleachBypass", default.bleachBypass),
clarity = obj.float("clarity", default.clarity),
sharpness = obj.float("sharpness", default.sharpness),
bloom = obj.float("bloom", default.bloom),
softLight = obj.float("softLight", default.softLight),
halation = default.halation,
@@ -32,6 +32,7 @@ data class ColorRecipeParams(
val flash: Float = 0f, // 0.0 ~ 1.0 (镜头轴向直闪模拟强度,0为无效果)
val bleachBypass: Float = 0f, // 0.0 ~ 1.0 (留银冲洗强度,0为无效果)
val clarity: Float = 0f, // -1.0 ~ 1.0 (局部对比度,0为无效果)
val sharpness: Float = 0f, // -1.0 ~ 1.0 (sRGB 锐度,负值柔化,正值锐化)
val bloom: Float = 0f, // 0.0 ~ 1.0 (Bevy Bloom 泛光强度,0为无效果)
val softLight: Float = 0f, // 0.0 ~ 1.0 (柔光扩散强度,0为无效果)
val halation: Float = 0f, // 0.0 ~ 1.0 (高光扩散强度,0为无效果,模拟 GR3 HDF)
@@ -118,6 +119,7 @@ data class ColorRecipeParams(
flash == 0f &&
bleachBypass == 0f &&
clarity == 0f &&
sharpness == 0f &&
bloom == 0f &&
softLight == 0f &&
redHalation == 0f &&
@@ -202,6 +204,7 @@ data class ColorRecipeParams(
flash == other.flash &&
bleachBypass == other.bleachBypass &&
clarity == other.clarity &&
sharpness == other.sharpness &&
bloom == other.bloom &&
softLight == other.softLight &&
redHalation == other.redHalation &&
@@ -325,6 +328,7 @@ enum class RecipeParam(
FLASH(R.string.recipe_param_flash, 0.0f, 1.0f, 0f),
BLEACH_BYPASS(R.string.recipe_param_bleach_bypass, 0.0f, 1.0f, 0f),
CLARITY(R.string.recipe_param_clarity, -1.0f, 1.0f, 0f),
SHARPNESS(R.string.recipe_param_sharpness, -1.0f, 1.0f, 0f),
BLOOM(R.string.recipe_param_bloom, 0.0f, 1.0f, 0f),
SOFT_LIGHT(R.string.recipe_param_soft_light, 0.0f, 1.0f, 0f),
HDF(R.string.recipe_param_hdf, 0.0f, 1.0f, 0f),
@@ -396,6 +400,7 @@ enum class RecipeParam(
FLASH -> params.flash
BLEACH_BYPASS -> params.bleachBypass
CLARITY -> params.clarity
SHARPNESS -> params.sharpness
BLOOM -> params.bloom
SOFT_LIGHT -> params.softLight
HDF -> params.halation
@@ -463,6 +468,7 @@ enum class RecipeParam(
FLASH -> params.copy(flash = clampedValue)
BLEACH_BYPASS -> params.copy(bleachBypass = clampedValue)
CLARITY -> params.copy(clarity = clampedValue)
SHARPNESS -> params.copy(sharpness = clampedValue)
BLOOM -> params.copy(bloom = clampedValue)
SOFT_LIGHT -> params.copy(softLight = clampedValue)
HDF -> params.copy(halation = clampedValue)
@@ -276,57 +276,6 @@ internal class RawSharpenPass(
const val DEFAULT_NOISE_LIMIT = DEFAULT_THRESHOLD + 128f / 16384f
const val DEFAULT_DARK_LIMIT = 0.08f
/** Single-target shader retained for the bitmap LUT renderer. */
val FRAGMENT_SHADER = """
#version 300 es
precision highp float;
in vec2 vTexCoord;
out vec4 fragColor;
uniform sampler2D uInputTexture;
uniform vec2 uTexelSize;
uniform float uSharpening;
uniform float uRadius;
uniform float uThreshold;
float luminance(vec3 color) {
return dot(color, vec3(0.2126, 0.7152, 0.0722));
}
void main() {
vec3 center = texture(uInputTexture, vTexCoord).rgb;
if (uSharpening <= 0.0) {
fragColor = vec4(center, 1.0);
return;
}
float r = max(uRadius, 0.001);
float sigma = max(r * 0.5, 0.001);
float twoSigma2 = 2.0 * sigma * sigma;
vec3 blur = vec3(0.0);
float weightSum = 0.0;
for (int y = -2; y <= 2; y++) {
for (int x = -2; x <= 2; x++) {
vec2 offset = vec2(float(x), float(y));
float dist2 = dot(offset, offset);
float weight = exp(-dist2 / twoSigma2);
blur += texture(uInputTexture, vTexCoord + offset * uTexelSize * r).rgb * weight;
weightSum += weight;
}
}
blur /= max(weightSum, 1e-5);
float centerLuma = luminance(center);
float blurLuma = luminance(blur);
float delta = centerLuma - blurLuma;
float detail = sign(delta) * max(abs(delta) - uThreshold, 0.0);
vec3 result = center + center * (detail / max(centerLuma, 1e-5)) * uSharpening;
fragColor = vec4(clamp(result, 0.0, 1.0), 1.0);
}
""".trimIndent()
val VERTICAL_BLUR_FRAGMENT_SHADER = """
#version 300 es
precision highp float;
@@ -1736,9 +1736,8 @@ fun CameraScreen(
.fillMaxWidth()
.then(
if (isXpan) {
Modifier.fillMaxHeight()
Modifier.fillMaxHeight().padding(bottom = 48.dp)
} else if (isVideoMode) {
//val bottomPadding = (maxHeight - 160.dp).coerceIn(16.dp, 40.dp)
Modifier.height(maxHeight - 170.dp)
} else {
Modifier
@@ -1748,99 +1747,59 @@ fun CameraScreen(
),
contentAlignment = Alignment.BottomCenter
) {
Column(
val allPresets by viewModel.allPresets.collectAsState()
val activePresetId by viewModel.activePresetId.collectAsState()
val defaultPresetName = stringResource(R.string.preset_new_preset_default)
// LUT 选择器 (内嵌 Presets 列表与统一控制,无多余背景遮挡)
LutSelector(
availableLuts = viewModel.availableLutList,
currentLutId = currentLutId,
thumbnail = viewModel.previewThumbnail,
onLutSelected = { viewModel.setLut(it) },
lutIntensity = (previewRecipeParamsOverride ?: currentRecipeParams).lutIntensity,
onLutIntensityChange = { newIntensity ->
val newParams = (previewRecipeParamsOverride ?: currentRecipeParams)
.copy(lutIntensity = newIntensity)
previewRecipeParamsOverride = newParams
viewModel.updateLutIntensity(newIntensity)
},
allPresets = if (isProfessionalMode) allPresets else emptyList(),
activePresetId = activePresetId.takeIf { isProfessionalMode },
selectedMode = effectiveLutSelectorMode,
onModeSelected = { viewModel.setLutSelectorMode(it) },
availableFrames = viewModel.availableFrameList,
currentFrameId = viewModel.currentFrameId,
onFrameSelected = { viewModel.setFrame(it) },
onFrameManagementClick = {
activePanel = ActivePanel.NONE
onFrameManagementClick()
},
onPresetSelected = { preset ->
discardTransientLookEdits()
if (presetRequiresPreviewTransition(preset)) {
runPreviewTransition { viewModel.applyPreset(preset) }
} else {
viewModel.applyPreset(preset)
}
},
onCreatePresetClick = {
viewModel.prepareCurrentSettingsPresetDraft(defaultPresetName)
onPresetEditClick(null)
},
onPresetManagementClick = onPresetManagementClick,
onEditClick = {
activePanel = ActivePanel.EDIT
},
onManageClick = { lutId ->
activePanel = ActivePanel.NONE
onFilterManagementClick(lutId)
},
categoryOrder = categoryOrder,
modifier = Modifier
.fillMaxWidth()
.then(
if (isXpan) {
Modifier
.padding(bottom = 48.dp)
.background(Color.Black)
} else {
Modifier.background(
Brush.verticalGradient(
colors = listOf(
Color.Transparent,
Color.Black.copy(alpha = 0.2f),
Color.Black.copy(alpha = 0.6f)
)
)
)
}
)
.padding(horizontal = 8.dp)
.padding(4.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
if (effectiveLutSelectorMode == LutSelectorMode.Style) {
val currentLut = viewModel.availableLutList.find { it.id == currentLutId }
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = currentLut?.getName() ?: "",
color = Color.White,
fontSize = 14.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier.weight(1f).basicMarquee()
)
LutEditButton(
onClick = {
activePanel = ActivePanel.EDIT
}
)
}
}
val allPresets by viewModel.allPresets.collectAsState()
val activePresetId by viewModel.activePresetId.collectAsState()
val defaultPresetName = stringResource(R.string.preset_new_preset_default)
// LUT 选择器 (内嵌 Presets 列表)
LutSelector(
availableLuts = viewModel.availableLutList,
currentLutId = currentLutId,
thumbnail = viewModel.previewThumbnail,
onLutSelected = { viewModel.setLut(it) },
allPresets = if (isProfessionalMode) allPresets else emptyList(),
activePresetId = activePresetId.takeIf { isProfessionalMode },
selectedMode = effectiveLutSelectorMode,
onModeSelected = { viewModel.setLutSelectorMode(it) },
availableFrames = viewModel.availableFrameList,
currentFrameId = viewModel.currentFrameId,
onFrameSelected = { viewModel.setFrame(it) },
onFrameManagementClick = {
activePanel = ActivePanel.NONE
onFrameManagementClick()
},
onPresetSelected = { preset ->
discardTransientLookEdits()
if (presetRequiresPreviewTransition(preset)) {
runPreviewTransition { viewModel.applyPreset(preset) }
} else {
viewModel.applyPreset(preset)
}
},
onCreatePresetClick = {
viewModel.prepareCurrentSettingsPresetDraft(defaultPresetName)
onPresetEditClick(null)
},
onPresetManagementClick = onPresetManagementClick,
onEditClick = {
activePanel = ActivePanel.EDIT
},
onManageClick = { lutId ->
activePanel = ActivePanel.NONE
onFilterManagementClick(lutId)
},
categoryOrder = categoryOrder
)
}
.padding(horizontal = 8.dp, vertical = 6.dp)
)
}
}
@@ -41,7 +41,7 @@ fun LutEditBottomSheet(
imageHistogram: ImageHistogram? = null,
showEffects: Boolean = false,
editorTarget: LutEditorTarget = LutEditorTarget.CREATIVE_GLOBAL,
containerColor: Color = Color.Black.copy(alpha = 0.8f),
containerColor: Color = Color.Transparent,
modifier: Modifier = Modifier
) {
val lutEditViewModel: LutEditViewModel = viewModel()
@@ -107,7 +107,8 @@ fun LutEditBottomSheet(
sheetState = sheetState,
containerColor = containerColor,
modifier = modifier,
scrimColor = Color.Transparent
scrimColor = Color.Transparent,
dragHandle = null,
) {
Column(
modifier = Modifier
@@ -151,7 +152,7 @@ fun LutEditBottomSheet(
)
},
imageHistogram = imageHistogram,
showLutIntensity = editorTarget == LutEditorTarget.CREATIVE_GLOBAL,
showLutIntensity = false,
currentEffects = editingParams.toEffectParams().takeIf { showEffects },
onEffectsChange = if (showEffects) {
{ effects -> onParamsUpdated(effects.applyTo(editingParams)) }
@@ -45,7 +45,6 @@ import com.hinnka.mycamera.model.ColorRecipeParams
import kotlin.math.PI
import kotlin.math.atan2
import kotlin.math.cos
import kotlin.math.roundToInt
import kotlin.math.sin
import kotlin.math.sqrt
@@ -167,8 +166,12 @@ fun ColorGradingPanel(
)
Text(
text = "${(selected.hue.coerceIn(0f, 1f) * 360f).roundToInt()}° · " +
"${(selected.amount.coerceIn(0f, 1f) * 100f).roundToInt()}%",
text = String.format(
java.util.Locale.getDefault(),
"%.1f · %.1f",
selected.hue.coerceIn(0f, 1f) * 10f,
selected.amount.coerceIn(0f, 1f) * 10f,
),
color = if (selected.amount > 0.001f) selectedColor else Color.White.copy(alpha = 0.48f),
fontSize = 11.sp,
fontWeight = FontWeight.SemiBold,
@@ -177,35 +180,39 @@ fun ColorGradingPanel(
GradingSliderRow(
label = stringResource(R.string.recipe_grading_luminance),
value = selected.luminance,
valueRange = -1f..1f,
value = selected.luminance * 10f,
valueRange = -10f..10f,
defaultValue = 0f,
valueText = formatSignedPercent(selected.luminance),
valueText = formatSignedValue(selected.luminance * 10f),
onValueChange = {
onParamsChange(
currentParams.withLuminance(selectedRange, it.coerceIn(-1f, 1f))
currentParams.withLuminance(selectedRange, (it / 10f).coerceIn(-1f, 1f))
)
},
)
GradingSliderRow(
label = stringResource(R.string.recipe_grading_balance),
value = currentParams.gradingBalance,
valueRange = -1f..1f,
value = currentParams.gradingBalance * 10f,
valueRange = -10f..10f,
defaultValue = 0f,
valueText = formatSignedPercent(currentParams.gradingBalance),
valueText = formatSignedValue(currentParams.gradingBalance * 10f),
onValueChange = {
onParamsChange(currentParams.copy(gradingBalance = it.coerceIn(-1f, 1f)))
onParamsChange(currentParams.copy(gradingBalance = (it / 10f).coerceIn(-1f, 1f)))
},
)
GradingSliderRow(
label = stringResource(R.string.recipe_grading_blending),
value = currentParams.gradingBlending,
valueRange = 0f..1f,
defaultValue = 0.5f,
valueText = "${(currentParams.gradingBlending.coerceIn(0f, 1f) * 100f).roundToInt()}",
value = currentParams.gradingBlending * 10f,
valueRange = 0f..10f,
defaultValue = 5f,
valueText = String.format(
java.util.Locale.getDefault(),
"%.1f",
currentParams.gradingBlending.coerceIn(0f, 1f) * 10f,
),
onValueChange = {
onParamsChange(currentParams.copy(gradingBlending = it.coerceIn(0f, 1f)))
onParamsChange(currentParams.copy(gradingBlending = (it / 10f).coerceIn(0f, 1f)))
},
)
}
@@ -582,9 +589,8 @@ private fun previewToneColor(
)
}
private fun formatSignedPercent(value: Float): String {
val percent = (value.coerceIn(-1f, 1f) * 100f).roundToInt()
return if (percent > 0) "+$percent" else percent.toString()
private fun formatSignedValue(value: Float): String {
return String.format(java.util.Locale.getDefault(), "%+.1f", value)
}
private const val GRADING_LUMINANCE_PREVIEW_STRENGTH = 0.17f
File diff suppressed because it is too large. Load diff
@@ -95,6 +95,7 @@ private val effectGroupTabs = listOf(
fun EffectsPanel(
currentParams: EffectParams,
onParamsChange: (EffectParams) -> Unit,
excludedEffects: Set<EffectType> = emptySet(),
modifier: Modifier = Modifier
) {
var selectedGroup by remember {
@@ -109,6 +110,7 @@ fun EffectsPanel(
val visibleEffects = effectGroups
.first { (group) -> group == selectedGroup }
.second
.filterNot(excludedEffects::contains)
Column(
modifier = modifier.fillMaxWidth(),
@@ -1,6 +1,7 @@
package com.hinnka.mycamera.ui.components
import androidx.compose.foundation.background
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
@@ -23,6 +24,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.hinnka.mycamera.R
import com.hinnka.mycamera.frame.FrameInfo
import com.hinnka.mycamera.ui.camera.ViewfinderTextShadow
import com.hinnka.mycamera.ui.theme.AccentOrange
/**
@@ -49,11 +51,10 @@ fun FrameSelector(
}
LazyRow(
modifier = modifier
.fillMaxWidth(),
modifier = modifier.fillMaxWidth(),
state = listState,
horizontalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = PaddingValues(horizontal = 8.dp)
horizontalArrangement = Arrangement.spacedBy(8.dp),
contentPadding = PaddingValues(horizontal = 4.dp)
) {
// 无边框选项
item(key = "frame:none") {
@@ -87,30 +88,45 @@ private fun FrameItem(
isCustom: Boolean = false,
modifier: Modifier = Modifier
) {
val backgroundColor = if (isSelected) {
Color.White.copy(alpha = 0.2f)
} else {
Color.Transparent
}
val borderColor = if (isSelected) {
Color.White
} else {
Color.White.copy(alpha = 0.2f)
}
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier
.width(64.dp)
.width(56.dp)
.clip(RoundedCornerShape(8.dp))
.background(backgroundColor)
.border(
width = if (isSelected) 1.5.dp else 1.dp,
color = borderColor,
shape = RoundedCornerShape(8.dp)
)
.clickable { onClick() }
.padding(horizontal = 4.dp, vertical = 5.dp)
) {
Box(
modifier = Modifier
.size(56.dp)
.clip(RoundedCornerShape(8.dp))
.background(
if (isSelected) AccentOrange.copy(alpha = 0.3f)
else Color.White.copy(alpha = 0.1f)
)
.then(
if (isSelected) Modifier.border(2.dp, AccentOrange, RoundedCornerShape(8.dp))
else Modifier
),
.size(42.dp)
.clip(RoundedCornerShape(5.dp))
.background(if (isSelected) Color.White.copy(alpha = 0.15f) else Color.White.copy(alpha = 0.08f)),
contentAlignment = Alignment.Center
) {
Text(
text = name.take(2).uppercase(),
color = if (isSelected) AccentOrange else Color.White.copy(alpha = 0.7f),
fontSize = 16.sp
color = Color.White,
fontSize = 13.sp,
fontWeight = FontWeight.Bold,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
if (isCustom) {
@@ -121,14 +137,14 @@ private fun FrameItem(
color = Color(0xFF4CAF50),
shape = RoundedCornerShape(bottomEnd = 4.dp)
)
.padding(horizontal = 4.dp, vertical = 2.dp)
.padding(horizontal = 3.dp, vertical = 1.dp)
) {
Text(
text = stringResource(R.string.custom_tag),
color = Color.White,
fontSize = 8.sp,
fontSize = 7.sp,
fontWeight = FontWeight.Bold,
lineHeight = 8.sp
lineHeight = 7.sp
)
}
}
@@ -138,11 +154,14 @@ private fun FrameItem(
Text(
text = name,
color = if (isSelected) AccentOrange else Color.White.copy(alpha = 0.7f),
fontSize = 11.sp,
color = Color.White,
fontSize = 10.sp,
fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Normal,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Center
textAlign = TextAlign.Center,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow),
modifier = Modifier.fillMaxWidth().basicMarquee()
)
}
}
@@ -181,7 +200,8 @@ fun FrameControlPanel(
Text(
text = stringResource(R.string.show_app_branding),
color = Color.White,
fontSize = 14.sp
fontSize = 14.sp,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
Switch(
@@ -26,6 +26,7 @@ fun LutIntensitySlider(
enabled: Boolean = true,
modifier: Modifier = Modifier
) {
val displayPercent = (intensity.coerceIn(0f, 1f) * 100f).toInt()
Column(
modifier = modifier
.fillMaxWidth()
@@ -44,16 +45,17 @@ fun LutIntensitySlider(
)
Text(
text = "${(intensity * 100).toInt()}%",
text = "$displayPercent%",
color = if (enabled) Color.White else Color.Gray,
fontSize = 10.sp,
fontSize = 12.sp,
lineHeight = 14.sp,
fontWeight = FontWeight.Bold
fontWeight = FontWeight.Bold,
fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace,
)
}
CustomSlider(
value = intensity,
value = intensity.coerceIn(0f, 1f),
onValueChange = onIntensityChange,
onDoubleTap = {
if (enabled) onIntensityChange(1f)
@@ -10,18 +10,23 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import com.hinnka.mycamera.ui.camera.ViewfinderTextShadow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@@ -42,6 +47,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import com.hinnka.mycamera.ui.icons.AppIcons
import kotlin.math.roundToInt
private sealed class LutCategoryTab {
data object Favorite : LutCategoryTab()
@@ -69,24 +75,82 @@ fun LutEditButton(
) {
Row(
modifier = modifier
.clip(RoundedCornerShape(16.dp))
.clip(RoundedCornerShape(14.dp))
.background(Color.White.copy(alpha = 0.15f))
.border(1.dp, Color.White.copy(alpha = 0.25f), RoundedCornerShape(14.dp))
.clickable(onClick = onClick)
.padding(horizontal = 12.dp, vertical = 6.dp),
.padding(horizontal = 9.dp, vertical = 5.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp)
horizontalArrangement = Arrangement.spacedBy(3.dp)
) {
Icon(
imageVector = AppIcons.Tune,
contentDescription = stringResource(R.string.edit),
tint = Color(0xFFFFD700),
modifier = Modifier.size(14.dp)
tint = Color.White,
modifier = Modifier.size(12.dp)
)
Text(
text = stringResource(R.string.edit),
color = Color.White,
fontSize = 11.sp,
fontWeight = FontWeight.Medium
fontWeight = FontWeight.Medium,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
}
}
@Composable
private fun LutPanelIconButton(
imageVector: ImageVector,
contentDescription: String?,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
Box(
modifier = modifier
.size(26.dp)
.clip(CircleShape)
.background(Color.White.copy(alpha = 0.15f))
.border(1.dp, Color.White.copy(alpha = 0.25f), CircleShape)
.clickable(onClick = onClick),
contentAlignment = Alignment.Center
) {
Icon(
imageVector = imageVector,
contentDescription = contentDescription,
tint = Color.White.copy(alpha = 0.85f),
modifier = Modifier.size(13.dp)
)
}
}
@Composable
private fun LutPanelNewPresetButton(
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier
.clip(RoundedCornerShape(14.dp))
.background(Color.White.copy(alpha = 0.15f))
.border(1.dp, Color.White.copy(alpha = 0.25f), RoundedCornerShape(14.dp))
.clickable(onClick = onClick)
.padding(horizontal = 9.dp, vertical = 5.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(3.dp)
) {
Icon(
imageVector = Icons.Default.Add,
contentDescription = null,
tint = Color.White,
modifier = Modifier.size(12.dp)
)
Text(
text = stringResource(R.string.preset_new),
color = Color.White,
fontSize = 11.sp,
fontWeight = FontWeight.Medium,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
}
}
@@ -102,6 +166,8 @@ fun LutSelector(
currentLutId: String?,
thumbnail: Bitmap?,
onLutSelected: (String?) -> Unit,
lutIntensity: Float? = null,
onLutIntensityChange: ((Float) -> Unit)? = null,
// 预设相关参数 (添加默认值以支持向后兼容)
allPresets: List<CameraPreset> = emptyList(),
activePresetId: String? = null,
@@ -221,93 +287,234 @@ fun LutSelector(
}
}
Column(modifier = modifier.fillMaxWidth()) {
if (supportsFrames || supportsPresets) {
CompositionLocalProvider(LocalTextStyle provides LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)) {
Column(
modifier = modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
// 顶栏第 1 行:当前项名称(居左)+ 操作按钮(编辑 / 新建)与设置图标(居右)
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
.padding(horizontal = 8.dp, vertical = 2.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
LutSelectorModeTab(
text = styleText,
isSelected = actualMode == LutSelectorMode.Style,
onClick = { onModeSelected(LutSelectorMode.Style) }
)
if (supportsFrames) {
LutSelectorModeTab(
text = frameText,
isSelected = actualMode == LutSelectorMode.Frame,
onClick = { onModeSelected(LutSelectorMode.Frame) }
)
}
if (supportsPresets) {
LutSelectorModeTab(
text = presetText,
isSelected = actualMode == LutSelectorMode.Presets,
onClick = { onModeSelected(LutSelectorMode.Presets) }
)
}
}
}
when (actualMode) {
LutSelectorMode.Style -> {
val currentLut = availableLuts.find { it.id == activeLutId }
val currentName = if (activeLutId == null || activeLutId == "none") {
stringResource(R.string.none)
} else {
currentLut?.getName() ?: ""
}
Text(
text = currentName,
color = Color.White,
fontSize = 13.sp,
fontWeight = FontWeight.Bold,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f).padding(end = 8.dp).basicMarquee(),
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
when (actualMode) {
LutSelectorMode.Style -> {
// 分类选择器 (小芯片样式)
Row(
modifier = Modifier.fillMaxWidth().padding(bottom = 4.dp),
verticalAlignment = Alignment.CenterVertically
) {
LazyRow(
modifier = Modifier.weight(1f),
horizontalArrangement = Arrangement.spacedBy(8.dp),
contentPadding = PaddingValues(horizontal = 8.dp)
) {
items(categoryTabs, key = { it.stableKey() }) { category ->
val isSelected = selectedCategory == category
val categoryName = when (category) {
LutCategoryTab.Favorite -> favoriteText
LutCategoryTab.BuiltIn -> builtInText
LutCategoryTab.Uncategorized -> uncategorizedText
is LutCategoryTab.Category -> category.name
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
if (onEditClick != null && activeLutId != null && activeLutId != "none") {
LutEditButton(onClick = onEditClick)
}
Text(
text = categoryName,
color = if (isSelected) Color(0xFFFF6B35) else Color.White.copy(alpha = 0.7f),
fontSize = 11.sp,
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Medium,
modifier = Modifier
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = null
) {
selectedCategory = category
if (onManageClick != null) {
var lastClickTime by remember { mutableLongStateOf(0L) }
LutPanelIconButton(
imageVector = Icons.Default.Settings,
contentDescription = stringResource(R.string.settings_filter_management),
onClick = {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime > 1000) {
lastClickTime = currentTime
onManageClick(activeLutId ?: "")
}
}
.padding(horizontal = 4.dp, vertical = 6.dp)
)
}
}
}
LutSelectorMode.Frame -> {
val currentFrame = availableFrames.find { it.id == currentFrameId }
val currentName = if (currentFrameId == null) stringResource(R.string.none) else (currentFrame?.name ?: "")
Text(
text = currentName,
color = Color.White,
fontSize = 13.sp,
fontWeight = FontWeight.Bold,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f).padding(end = 8.dp).basicMarquee(),
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
if (onFrameManagementClick != null) {
LutPanelIconButton(
imageVector = Icons.Default.Settings,
contentDescription = stringResource(R.string.settings_frame_management),
onClick = onFrameManagementClick
)
}
}
LutSelectorMode.Presets -> {
val currentPreset = allPresets.find { it.id == activePresetId }
val currentName = currentPreset?.let { preset ->
when (preset.id) {
"builtin_default" -> stringResource(R.string.default_text)
"builtin_hasselblad_natural" -> stringResource(R.string.preset_builtin_hasselblad_natural)
"builtin_portrait" -> stringResource(R.string.preset_builtin_portrait)
"builtin_classic_film" -> stringResource(R.string.preset_builtin_classic_film)
"builtin_monochrome" -> stringResource(R.string.preset_builtin_monochrome)
"builtin_cinematic" -> stringResource(R.string.preset_builtin_cinematic)
"builtin_leica_m9_moment" -> stringResource(R.string.preset_builtin_leica_m9_moment)
else -> preset.name
}
} ?: ""
Text(
text = currentName,
color = Color.White,
fontSize = 13.sp,
fontWeight = FontWeight.Bold,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f).padding(end = 8.dp).basicMarquee(),
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
if (onManageClick != null) {
var lastClickTime by remember { mutableLongStateOf(0L) }
Icon(
imageVector = Icons.Default.Settings,
contentDescription = stringResource(R.string.settings_filter_management),
tint = Color.White.copy(alpha = 0.6f),
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
) {
LutPanelNewPresetButton(onClick = onCreatePresetClick)
LutPanelIconButton(
imageVector = Icons.Default.Settings,
contentDescription = stringResource(R.string.settings_preset_management),
onClick = onPresetManagementClick
)
}
}
}
}
// 顶栏第 2 行:模式切换胶囊 [ 滤镜 | 边框 | 预设 ]
if (supportsFrames || supportsPresets) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 2.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
LutSelectorModeTab(
text = styleText,
isSelected = actualMode == LutSelectorMode.Style,
onClick = { onModeSelected(LutSelectorMode.Style) }
)
if (supportsFrames) {
LutSelectorModeTab(
text = frameText,
isSelected = actualMode == LutSelectorMode.Frame,
onClick = { onModeSelected(LutSelectorMode.Frame) }
)
}
if (supportsPresets) {
LutSelectorModeTab(
text = presetText,
isSelected = actualMode == LutSelectorMode.Presets,
onClick = { onModeSelected(LutSelectorMode.Presets) }
)
}
}
}
when (actualMode) {
LutSelectorMode.Style -> {
// 分类选择器 (小芯片样式)
LazyRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(6.dp),
contentPadding = PaddingValues(horizontal = 4.dp)
) {
items(categoryTabs, key = { it.stableKey() }) { category ->
val isSelected = selectedCategory == category
val categoryName = when (category) {
LutCategoryTab.Favorite -> favoriteText
LutCategoryTab.BuiltIn -> builtInText
LutCategoryTab.Uncategorized -> uncategorizedText
is LutCategoryTab.Category -> category.name
}
Text(
text = categoryName,
color = Color.White,
fontSize = 11.sp,
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Normal,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow),
modifier = Modifier
.padding(end = 12.dp)
.size(24.dp)
.clip(CircleShape)
.clickable {
val currentTime = System.currentTimeMillis()
if (currentTime - lastClickTime > 1000) {
lastClickTime = currentTime
onManageClick(currentLutId ?: "")
}
.background(if (isSelected) Color.White.copy(alpha = 0.2f) else Color.Transparent)
.border(
width = 1.dp,
color = if (isSelected) Color.White.copy(alpha = 0.5f) else Color.White.copy(alpha = 0.15f),
shape = CircleShape
)
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = null
) {
selectedCategory = category
}
.padding(4.dp)
.padding(horizontal = 8.dp, vertical = 2.dp)
)
}
}
// 滤镜强度滑块(显示在选择的滤镜上方)
if (activeLutId != null && activeLutId != "none" && lutIntensity != null && onLutIntensityChange != null) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(24.dp)
.padding(horizontal = 6.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
text = stringResource(R.string.filter_intensity),
color = Color.White,
fontSize = 10.sp,
fontWeight = FontWeight.Medium,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
CustomSlider(
value = lutIntensity.coerceIn(0f, 1f),
onValueChange = onLutIntensityChange,
onDoubleTap = { onLutIntensityChange(1f) },
valueRange = 0f..1f,
activeTrackColor = Color.White,
inactiveTrackColor = Color.White.copy(alpha = 0.2f),
thumbColor = Color.White,
modifier = Modifier
.weight(1f)
.height(18.dp)
)
Text(
text = "${(lutIntensity.coerceIn(0f, 1f) * 100).roundToInt()}%",
color = Color.White,
fontSize = 11.sp,
fontFamily = FontFamily.Monospace,
fontWeight = FontWeight.Bold,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
}
}
@@ -315,8 +522,9 @@ fun LutSelector(
LazyRow(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp),
.padding(vertical = 2.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
contentPadding = PaddingValues(horizontal = 4.dp),
state = scrollState
) {
// LUT 列表
@@ -350,37 +558,13 @@ fun LutSelector(
}
}
LutSelectorMode.Frame -> {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 8.dp, vertical = 4.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = frameText,
color = Color.White.copy(alpha = 0.7f),
fontSize = 11.sp,
fontWeight = FontWeight.Medium
)
if (onFrameManagementClick != null) {
Icon(
imageVector = Icons.Default.Settings,
contentDescription = stringResource(R.string.settings_frame_management),
tint = Color.White.copy(alpha = 0.6f),
modifier = Modifier
.size(24.dp)
.clip(CircleShape)
.clickable(onClick = onFrameManagementClick)
.padding(4.dp)
)
}
}
FrameSelector(
availableFrames = availableFrames,
currentFrameId = currentFrameId,
onFrameSelected = requireNotNull(onFrameSelected),
modifier = Modifier.padding(vertical = 4.dp)
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 2.dp)
)
}
LutSelectorMode.Presets -> {
@@ -397,6 +581,7 @@ fun LutSelector(
}
}
}
}
@Composable
private fun LutSelectorModeTab(
@@ -421,24 +606,25 @@ private fun LutSelectorModeTab(
)
.padding(horizontal = 10.dp, vertical = 5.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp)
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
text = text,
color = if (isSelected) Color.White else Color.White.copy(alpha = 0.7f),
fontSize = 12.sp,
fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Medium
color = Color.White,
fontSize = 11.sp,
fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Medium,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
if (badgeText != null) {
Text(
text = badgeText,
color = Color.Black,
fontSize = 9.sp,
fontSize = 8.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.clip(RoundedCornerShape(8.dp))
.clip(RoundedCornerShape(4.dp))
.background(Color(0xFFFFD700))
.padding(horizontal = 5.dp, vertical = 1.dp)
.padding(horizontal = 4.dp, vertical = 1.dp)
)
}
}
@@ -459,29 +645,29 @@ private fun LutItem(
onManageClick: (() -> Unit)? = null,
recipeTarget: BaselineColorCorrectionTarget? = null,
isNone: Boolean = false,
isCustom: Boolean = false, // 添加自定义标识参数
isCustom: Boolean = false,
modifier: Modifier = Modifier
) {
val context = LocalContext.current
val backgroundColor = if (isSelected) {
Color.White.copy(alpha = 0.3f)
Color.White.copy(alpha = 0.2f)
} else {
Color.Black.copy(alpha = 0.5f)
Color.Transparent
}
val borderColor = if (isSelected) {
Color.White
} else {
Color.Gray.copy(alpha = 0.5f)
Color.White.copy(alpha = 0.2f)
}
Column(
modifier = modifier
.width(60.dp)
.width(56.dp)
.clip(RoundedCornerShape(8.dp))
.background(backgroundColor)
.border(
width = if (isSelected) 2.dp else 1.dp,
width = if (isSelected) 1.5.dp else 1.dp,
color = borderColor,
shape = RoundedCornerShape(8.dp)
)
@@ -489,15 +675,15 @@ private fun LutItem(
onClick = onClick,
onLongClick = onManageClick
)
.padding(8.dp),
.padding(horizontal = 4.dp, vertical = 5.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
// 预览区域
Box(
modifier = Modifier
.size(44.dp)
.clip(RoundedCornerShape(4.dp))
.size(42.dp)
.clip(RoundedCornerShape(5.dp))
.then(
if (isNone) {
Modifier.background(Color.DarkGray)
@@ -598,11 +784,12 @@ private fun LutItem(
Text(
text = name,
color = Color.White,
fontSize = 9.sp,
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Normal,
fontSize = 10.sp,
fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Normal,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Center,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow),
modifier = Modifier.fillMaxWidth().basicMarquee()
)
}
@@ -31,6 +31,7 @@ import com.hinnka.mycamera.R
import com.hinnka.mycamera.camera.AspectRatio
import com.hinnka.mycamera.model.CameraPreset
import com.hinnka.mycamera.raw.RawRenderingEngine
import com.hinnka.mycamera.ui.camera.ViewfinderTextShadow
/**
* 拍摄预设面板组件 (取代原先的 PresetDial 拨盘)
@@ -50,7 +51,7 @@ fun PresetsPanel(
Column(
modifier = modifier
.fillMaxWidth()
.padding(vertical = 12.dp),
.padding(vertical = 2.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
// 横向滑动的预设列表
@@ -58,23 +59,23 @@ fun PresetsPanel(
modifier = Modifier
.fillMaxWidth()
.horizontalScroll(scrollState)
.padding(horizontal = 16.dp),
.padding(horizontal = 4.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
// “新建预设”卡片
Card(
shape = RoundedCornerShape(16.dp),
colors = CardDefaults.cardColors(containerColor = Color.Black.copy(alpha = 0.3f)),
shape = RoundedCornerShape(8.dp),
colors = CardDefaults.cardColors(containerColor = Color.Transparent),
modifier = Modifier
.width(80.dp)
.height(80.dp)
.clip(RoundedCornerShape(16.dp))
.width(56.dp)
.height(56.dp)
.clip(RoundedCornerShape(8.dp))
.clickable {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
onCreatePreset()
}
.border(1.dp, Color.White.copy(alpha = 0.15f), RoundedCornerShape(16.dp))
.border(1.dp, Color.White.copy(alpha = 0.2f), RoundedCornerShape(8.dp))
) {
Column(
modifier = Modifier.fillMaxSize(),
@@ -84,16 +85,17 @@ fun PresetsPanel(
Icon(
imageVector = Icons.Default.Add,
contentDescription = stringResource(R.string.preset_new),
tint = Color.White.copy(alpha = 0.8f),
modifier = Modifier.size(22.dp)
tint = Color.White.copy(alpha = 0.85f),
modifier = Modifier.size(16.dp)
)
Spacer(modifier = Modifier.height(6.dp))
Spacer(modifier = Modifier.height(3.dp))
Text(
text = stringResource(R.string.preset_new),
color = Color.White.copy(alpha = 0.8f),
fontSize = 11.sp,
color = Color.White,
fontSize = 10.sp,
fontWeight = FontWeight.Medium,
textAlign = TextAlign.Center
textAlign = TextAlign.Center,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
}
}
@@ -102,7 +104,7 @@ fun PresetsPanel(
allPresets.forEach { preset ->
val isSelected = activePresetId == preset.id
val presetBorderColor by animateColorAsState(
targetValue = if (isSelected) Color(0xFFFFD700) else Color.White.copy(alpha = 0.15f),
targetValue = if (isSelected) Color.White else Color.White.copy(alpha = 0.2f),
label = "presetBorderColor"
)
@@ -119,14 +121,14 @@ fun PresetsPanel(
}
Card(
shape = RoundedCornerShape(16.dp),
shape = RoundedCornerShape(8.dp),
colors = CardDefaults.cardColors(
containerColor = if (isSelected) Color(0xFFFFD700).copy(alpha = 0.1f) else Color.Black.copy(alpha = 0.15f)
containerColor = if (isSelected) Color.White.copy(alpha = 0.2f) else Color.Transparent
),
modifier = Modifier
.width(80.dp)
.height(80.dp)
.clip(RoundedCornerShape(16.dp))
.width(68.dp)
.height(56.dp)
.clip(RoundedCornerShape(8.dp))
.combinedClickable(
onClick = {
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
@@ -137,32 +139,31 @@ fun PresetsPanel(
onManagePresets()
}
)
.border(1.2.dp, presetBorderColor, RoundedCornerShape(16.dp))
.border(if (isSelected) 1.5.dp else 1.dp, presetBorderColor, RoundedCornerShape(8.dp))
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(8.dp),
verticalArrangement = Arrangement.Center,
.padding(horizontal = 4.dp, vertical = 5.dp),
verticalArrangement = Arrangement.SpaceBetween,
horizontalAlignment = Alignment.CenterHorizontally
) {
// 预设名
Text(
text = displayName,
color = if (isSelected) Color(0xFFFFD700) else Color.White,
fontSize = 11.sp,
color = Color.White,
fontSize = 10.sp,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.Center,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow),
modifier = Modifier.padding(horizontal = 2.dp).basicMarquee()
)
Spacer(Modifier.height(8.dp))
// 包含的特性微小徽章(Film, Lut, DCP等)
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
horizontalArrangement = Arrangement.spacedBy(2.dp),
verticalAlignment = Alignment.CenterVertically
) {
val rawRenderingEngine = RawRenderingEngine.fromPersistedName(preset.rawRenderingEngine)
@@ -195,9 +196,10 @@ private fun FeatureBadge(text: String) {
) {
Text(
text = text,
color = Color.White.copy(alpha = 0.6f),
color = Color.White,
fontSize = 6.sp,
fontWeight = FontWeight.Bold
fontWeight = FontWeight.Bold,
style = LocalTextStyle.current.copy(shadow = ViewfinderTextShadow)
)
}
}
@@ -1270,7 +1270,7 @@ fun GalleryEditScreen(
modifier = Modifier.align(Alignment.BottomCenter)
) {
Surface(
color = Color(0x331A1A1A),
color = Color.Transparent,
shape = RoundedCornerShape(topStart = 24.dp, topEnd = 24.dp),
modifier = Modifier
.fillMaxWidth()
@@ -1312,14 +1312,6 @@ fun GalleryEditScreen(
.padding(start = 4.dp)
)
}
Icon(
imageVector = AppIcons.DragHandle,
contentDescription = null,
tint = Color.White.copy(alpha = 0.42f),
modifier = Modifier
.align(Alignment.Center)
.size(width = 32.dp, height = 20.dp)
)
Icon(
imageVector = if (areEditControlsHidden) {
AppIcons.ExpandLess
@@ -1702,20 +1694,6 @@ fun GalleryEditScreen(
)
}
}
SliderSettingItem(
title = stringResource(R.string.settings_sharpening),
value = editSharpening,
valueRange = 0f..1f,
resetValue = 0f,
onValueChange = { viewModel.setSharpening(it) },
onValueChangeFinished = {
if (isRaw) {
viewModel.persistCurrentRawEditMetadata(currentEditSourcePhoto) { success ->
if (success) requestRawPreviewRefresh()
}
}
}
)
SliderSettingItem(
title = stringResource(R.string.settings_noise_reduction),
value = editNoiseReduction,
@@ -1987,7 +1965,7 @@ fun GalleryEditScreen(
showBaselineLutEditSheet = false
showRawBaselineLutSelectorSheet = true
},
containerColor = Color(0x151A1A1A)
containerColor = Color.Transparent
)
}
@@ -336,9 +336,9 @@ fun PresetEditorScreen(
if (showEditSheet) {
ModalBottomSheet(
onDismissRequest = { showEditSheet = false },
containerColor = Color.Black.copy(alpha = 0.86f),
containerColor = Color.Transparent,
scrimColor = Color.Transparent,
dragHandle = { BottomSheetDefaults.DragHandle(color = Color.White.copy(alpha = 0.2f)) }
dragHandle = null,
) {
ColorRecipePanel(
currentParams = colorRecipe,
@@ -3837,6 +3837,20 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
}
}
private var lutIntensitySaveJob: Job? = null
fun updateLutIntensity(intensity: Float) {
val lutId = currentLutId.value
if (lutId == "none") return
val current = currentRecipeParams.value
val updated = current.copy(lutIntensity = intensity.coerceIn(0f, 1f))
lutIntensitySaveJob?.cancel()
lutIntensitySaveJob = viewModelScope.launch {
delay(200)
contentRepository.lutManager.saveColorRecipeParams(lutId, updated)
}
}
fun setPhotoLut(lutId: String?) {
val normalizedLutId = lutId ?: "none"
val shouldApply = state.value.captureMode != CaptureMode.VIDEO ||
@@ -466,6 +466,7 @@
<string name="recipe_param_flash">閃光燈</string>
<string name="recipe_param_bleach_bypass">留銀沖洗</string>
<string name="recipe_param_clarity">清晰度</string>
<string name="recipe_param_sharpness">銳度</string>
<string name="recipe_param_bloom">泛光</string>
<string name="recipe_param_soft_light">柔光</string>
<string name="recipe_param_hdf">HDF</string>
@@ -514,6 +515,7 @@
<!-- Color Recipe Tabs -->
<string name="recipe_tab_color">色彩</string>
<string name="recipe_color_basic">基礎</string>
<string name="recipe_panel_advanced">進階</string>
<string name="recipe_color_style">風格</string>
<string name="recipe_color_grading">色彩分級</string>
<string name="recipe_grading_midtones">中間調</string>
@@ -485,6 +485,7 @@
<string name="recipe_param_flash">闪光灯</string>
<string name="recipe_param_bleach_bypass">留银冲洗</string>
<string name="recipe_param_clarity">清晰度</string>
<string name="recipe_param_sharpness">锐度</string>
<string name="recipe_param_bloom">泛光</string>
<string name="recipe_param_soft_light">柔光</string>
<string name="recipe_param_hdf">HDF</string>
@@ -533,6 +534,7 @@
<!-- Color Recipe Tabs -->
<string name="recipe_tab_color">颜色</string>
<string name="recipe_color_basic">基础</string>
<string name="recipe_panel_advanced">高级</string>
<string name="recipe_color_style">风格</string>
<string name="recipe_color_grading">色彩分级</string>
<string name="recipe_grading_midtones">中间调</string>
@@ -466,6 +466,7 @@
<string name="recipe_param_flash">閃光燈</string>
<string name="recipe_param_bleach_bypass">留銀沖洗</string>
<string name="recipe_param_clarity">清晰度</string>
<string name="recipe_param_sharpness">銳度</string>
<string name="recipe_param_bloom">泛光</string>
<string name="recipe_param_soft_light">柔光</string>
<string name="recipe_param_hdf">HDF</string>
@@ -514,6 +515,7 @@
<!-- Color Recipe Tabs -->
<string name="recipe_tab_color">色彩</string>
<string name="recipe_color_basic">基礎</string>
<string name="recipe_panel_advanced">進階</string>
<string name="recipe_color_style">風格</string>
<string name="recipe_color_grading">色彩分級</string>
<string name="recipe_grading_midtones">中間調</string>
@@ -466,6 +466,7 @@
<string name="recipe_param_flash">閃光燈</string>
<string name="recipe_param_bleach_bypass">留銀沖洗</string>
<string name="recipe_param_clarity">清晰度</string>
<string name="recipe_param_sharpness">銳度</string>
<string name="recipe_param_bloom">泛光</string>
<string name="recipe_param_soft_light">柔光</string>
<string name="recipe_param_hdf">HDF</string>
@@ -514,6 +515,7 @@
<!-- Color Recipe Tabs -->
<string name="recipe_tab_color">色彩</string>
<string name="recipe_color_basic">基礎</string>
<string name="recipe_panel_advanced">進階</string>
<string name="recipe_color_style">風格</string>
<string name="recipe_color_grading">色彩分級</string>
<string name="recipe_grading_midtones">中間調</string>
+2
View File
@@ -498,6 +498,7 @@
<string name="recipe_param_flash">Flash</string>
<string name="recipe_param_bleach_bypass">Bleach Bypass</string>
<string name="recipe_param_clarity">Clarity</string>
<string name="recipe_param_sharpness">Sharpness</string>
<string name="recipe_param_bloom">Bloom</string>
<string name="recipe_param_soft_light">Soft Light</string>
<string name="recipe_param_hdf">HDF</string>
@@ -546,6 +547,7 @@
<!-- Color Recipe Tabs -->
<string name="recipe_tab_color">Color</string>
<string name="recipe_color_basic">Basic</string>
<string name="recipe_panel_advanced">Advanced</string>
<string name="recipe_color_style">Style</string>
<string name="recipe_color_grading">Grading</string>
<string name="recipe_grading_midtones">Midtones</string>
@@ -42,7 +42,10 @@ class CameraPresetJsonCodecTest {
id = "preset_current_raw_engine",
name = "Current RAW Engine",
lutId = null,
colorRecipe = ColorRecipeParams.DEFAULT.copy(clarity = 0.42f),
colorRecipe = ColorRecipeParams.DEFAULT.copy(
clarity = 0.42f,
sharpness = -0.3f,
),
effects = EffectParams.DEFAULT.copy(clarity = -0.31f),
ultraHdrGainMapEnabled = false,
rawRenderingEngine = RawRenderingEngine.Spektrafilm.name,
@@ -66,6 +69,7 @@ class CameraPresetJsonCodecTest {
assertEquals("DR400", preset.rawDROMode)
assertFalse(preset.ultraHdrGainMapEnabled)
assertEquals(0.42f, preset.colorRecipe.clarity, 0.0001f)
assertEquals(-0.3f, preset.colorRecipe.sharpness, 0.0001f)
assertEquals(-0.31f, preset.effects.clarity, 0.0001f)
}
@@ -39,6 +39,7 @@ class ColorGradingParamsTest {
gradingHighlightLuminance = 0.24f,
gradingBalance = -0.16f,
gradingBlending = 0.81f,
sharpness = -0.35f,
)
val decoded = ColorRecipeParams.fromJson(source.toJson())
@@ -63,5 +64,6 @@ class ColorGradingParamsTest {
assertEquals(0f, decoded.gradingMidtoneLuminance, 0.0001f)
assertEquals(0f, decoded.gradingHighlightLuminance, 0.0001f)
assertEquals(0.5f, decoded.gradingBlending, 0.0001f)
assertEquals(0f, decoded.sharpness, 0.0001f)
}
}