feat: integrate RAW baseline color correction into edit panel and top sheet
This commit is contained in:
1 parent
96ffc725fb
commit
d7ef3c10d7
10 files changed
+429
-70
No files matched your search
@@ -128,6 +128,13 @@ fun CameraScreen(
|
||||
val videoCodec by viewModel.videoCodec.collectAsState()
|
||||
val videoAudioInputOptions by viewModel.videoAudioInputOptions.collectAsState()
|
||||
val phantomPipPreview by viewModel.phantomPipPreview.collectAsState()
|
||||
val rawDcpId by viewModel.rawDcpId.collectAsState()
|
||||
val rawBaselineLutId by viewModel.rawBaselineLutId.collectAsState()
|
||||
val rawNlmNoiseFactor by viewModel.rawNlmNoiseFactor.collectAsState()
|
||||
val rawExposureCompensation by viewModel.rawExposureCompensation.collectAsState()
|
||||
val rawAutoExposure by viewModel.rawAutoExposure.collectAsState()
|
||||
val rawBlackPointCorrection by viewModel.rawBlackPointCorrection.collectAsState()
|
||||
val rawWhitePointCorrection by viewModel.rawWhitePointCorrection.collectAsState()
|
||||
val multipleExposureState = viewModel.multipleExposureState
|
||||
var previewRecipeParamsOverride by remember(currentLutId) { mutableStateOf<ColorRecipeParams?>(null) }
|
||||
var pendingCaptureAnimationBitmap by remember { mutableStateOf<Bitmap?>(null) }
|
||||
@@ -164,6 +171,15 @@ fun CameraScreen(
|
||||
}
|
||||
)
|
||||
|
||||
val dcpImportLauncher = rememberLauncherForActivityResult(
|
||||
contract = ActivityResultContracts.OpenMultipleDocuments(),
|
||||
onResult = { uris ->
|
||||
if (uris.isNotEmpty()) {
|
||||
viewModel.importRawDcps(uris) { _, _ -> }
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// 当打开滤镜面板时,生成预览图
|
||||
LaunchedEffect(activePanel) {
|
||||
if (activePanel == ActivePanel.FILTERS) {
|
||||
@@ -1123,7 +1139,37 @@ fun CameraScreen(
|
||||
useMFSR = useMFSR,
|
||||
onMFSRToggle = {
|
||||
viewModel.setUseMFSR(it)
|
||||
}
|
||||
},
|
||||
selectedDcpId = rawDcpId,
|
||||
availableDcps = viewModel.availableDcps,
|
||||
selectedBaselineLutId = rawBaselineLutId,
|
||||
onSelectBaselineLut = { viewModel.setRawBaselineLutId(it) },
|
||||
onEditBaselineRecipe = { lutId ->
|
||||
// Switch to filters panel and then edit recipe
|
||||
activePanel = ActivePanel.FILTERS
|
||||
scope.launch {
|
||||
delay(100)
|
||||
viewModel.setLut(lutId)
|
||||
activePanel = ActivePanel.LUT_EDIT
|
||||
}
|
||||
},
|
||||
availableLuts = viewModel.availableLutList,
|
||||
thumbnail = viewModel.previewThumbnail,
|
||||
rawNlmNoiseFactor = rawNlmNoiseFactor,
|
||||
rawExposureCompensation = rawExposureCompensation,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawBlackPointCorrection = rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = rawWhitePointCorrection,
|
||||
onSelectDcp = { viewModel.setRawDcpId(it) },
|
||||
onImportDcp = { dcpImportLauncher.launch(arrayOf("application/octet-stream")) },
|
||||
onDeleteDcp = { viewModel.deleteRawDcp(it.id) { _ -> } },
|
||||
onRawNlmNoiseFactorChange = { viewModel.setRawNlmNoiseFactor(it) },
|
||||
onRawExposureCompensationChange = { viewModel.setRawExposureCompensation(it) },
|
||||
onRawAutoExposureChange = { viewModel.setRawAutoExposure(it) },
|
||||
onRawBlackPointCorrectionChange = { viewModel.setRawBlackPointCorrection(it) },
|
||||
onRawWhitePointCorrectionChange = { viewModel.setRawWhitePointCorrection(it) },
|
||||
onAdjustmentStart = { },
|
||||
onAdjustmentEnd = { }
|
||||
)
|
||||
|
||||
AnimatedVisibility(
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.hinnka.mycamera.camera.MeteringMode
|
||||
import com.hinnka.mycamera.utils.DeviceUtil
|
||||
import com.hinnka.mycamera.video.*
|
||||
import com.hinnka.mycamera.video.VideoCodec
|
||||
import com.hinnka.mycamera.raw.DcpInfo
|
||||
import com.hinnka.mycamera.lut.LutInfo
|
||||
|
||||
private enum class VideoSettingPanel {
|
||||
ASPECT_RATIO,
|
||||
@@ -39,7 +41,7 @@ private enum class VideoSettingPanel {
|
||||
MICROPHONE
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@OptIn(ExperimentalLayoutApi::class, ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun CameraTopSheet(
|
||||
visible: Boolean,
|
||||
@@ -73,9 +75,33 @@ fun CameraTopSheet(
|
||||
onMultipleExposureToggle: (Boolean) -> Unit,
|
||||
useMFSR: Boolean,
|
||||
onMFSRToggle: (Boolean) -> Unit,
|
||||
// RAW Edit Panel parameters
|
||||
selectedDcpId: String?,
|
||||
availableDcps: List<DcpInfo>,
|
||||
selectedBaselineLutId: String?,
|
||||
onSelectBaselineLut: (String?) -> Unit,
|
||||
onEditBaselineRecipe: (String) -> Unit,
|
||||
availableLuts: List<LutInfo>,
|
||||
thumbnail: android.graphics.Bitmap?,
|
||||
rawNlmNoiseFactor: Float,
|
||||
rawExposureCompensation: Float,
|
||||
rawAutoExposure: Boolean,
|
||||
rawBlackPointCorrection: Float,
|
||||
rawWhitePointCorrection: Float,
|
||||
onSelectDcp: (String?) -> Unit,
|
||||
onImportDcp: () -> Unit,
|
||||
onDeleteDcp: (DcpInfo) -> Unit,
|
||||
onRawNlmNoiseFactorChange: (Float) -> Unit,
|
||||
onRawExposureCompensationChange: (Float) -> Unit,
|
||||
onRawAutoExposureChange: (Boolean) -> Unit,
|
||||
onRawBlackPointCorrectionChange: (Float) -> Unit,
|
||||
onRawWhitePointCorrectionChange: (Float) -> Unit,
|
||||
onAdjustmentStart: () -> Unit,
|
||||
onAdjustmentEnd: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
var expandedVideoPanel by rememberSaveable { mutableStateOf<VideoSettingPanel?>(null) }
|
||||
var showRawSheet by rememberSaveable { mutableStateOf(false) }
|
||||
AnimatedVisibility(
|
||||
visible = visible,
|
||||
enter = slideInVertically(initialOffsetY = { -it }) + fadeIn(),
|
||||
@@ -144,14 +170,12 @@ fun CameraTopSheet(
|
||||
)
|
||||
|
||||
if (isRawSupported) {
|
||||
QuickSettingToggle(
|
||||
title = stringResource(R.string.settings_use_raw),
|
||||
QuickSettingButton2(
|
||||
title = "RAW",
|
||||
checked = useRaw,
|
||||
onCheckedChange = onRawToggle,
|
||||
onClick = { showRawSheet = true },
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
} else {
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,6 +458,76 @@ fun CameraTopSheet(
|
||||
Spacer(Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
|
||||
if (showRawSheet) {
|
||||
ModalBottomSheet(
|
||||
onDismissRequest = { showRawSheet = false },
|
||||
containerColor = Color(0xFF1E1E1E),
|
||||
dragHandle = { BottomSheetDefaults.DragHandle(color = Color.White.copy(alpha = 0.2f)) }
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(bottom = 32.dp)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.settings_use_raw),
|
||||
color = Color.White,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
Switch(
|
||||
checked = useRaw,
|
||||
onCheckedChange = onRawToggle,
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = Color.White,
|
||||
checkedTrackColor = Color(0xFFFF6B35),
|
||||
uncheckedThumbColor = Color.Gray,
|
||||
uncheckedTrackColor = Color.White.copy(alpha = 0.2f),
|
||||
uncheckedBorderColor = Color.Transparent
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
com.hinnka.mycamera.ui.components.RawEditPanel(
|
||||
selectedDcpId = selectedDcpId,
|
||||
availableDcps = availableDcps,
|
||||
selectedBaselineLutId = selectedBaselineLutId,
|
||||
onSelectBaselineLut = onSelectBaselineLut,
|
||||
onEditBaselineRecipe = {
|
||||
showRawSheet = false
|
||||
onEditBaselineRecipe(it)
|
||||
},
|
||||
availableLuts = availableLuts,
|
||||
thumbnail = thumbnail,
|
||||
rawNlmNoiseFactor = rawNlmNoiseFactor,
|
||||
rawExposureCompensation = rawExposureCompensation,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawBlackPointCorrection = rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = rawWhitePointCorrection,
|
||||
onSelectDcp = onSelectDcp,
|
||||
onImportDcp = onImportDcp,
|
||||
onDeleteDcp = onDeleteDcp,
|
||||
onRawNlmNoiseFactorChange = onRawNlmNoiseFactorChange,
|
||||
onRawExposureCompensationChange = onRawExposureCompensationChange,
|
||||
onRawAutoExposureChange = onRawAutoExposureChange,
|
||||
onRawBlackPointCorrectionChange = onRawBlackPointCorrectionChange,
|
||||
onRawWhitePointCorrectionChange = onRawWhitePointCorrectionChange,
|
||||
onAdjustmentStart = onAdjustmentStart,
|
||||
onAdjustmentEnd = onAdjustmentEnd
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -659,6 +753,49 @@ fun QuickSettingButton(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Composable
|
||||
fun QuickSettingButton2(
|
||||
title: String,
|
||||
checked: Boolean,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.height(40.dp)
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.background(
|
||||
if (checked) Color(0xFFFF6B35).copy(alpha = 0.15f) else Color.White.copy(
|
||||
alpha = 0.15f
|
||||
)
|
||||
)
|
||||
.clickable { onClick() }
|
||||
.padding(horizontal = 16.dp),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
color = if (checked) Color(0xFFFF6B35) else Color.White.copy(alpha = 0.9f),
|
||||
fontSize = 10.sp,
|
||||
fontWeight = if (checked) FontWeight.Bold else FontWeight.Normal,
|
||||
)
|
||||
Icon(
|
||||
imageVector = Icons.Default.ChevronRight,
|
||||
contentDescription = null,
|
||||
tint = if (checked) Color(0xFFFF6B35) else Color.White.copy(alpha = 0.9f),
|
||||
modifier = Modifier.size(18.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun QuickSettingToggle(
|
||||
title: String,
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.ChevronRight
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -20,13 +21,21 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import android.graphics.Bitmap
|
||||
import com.hinnka.mycamera.R
|
||||
import com.hinnka.mycamera.lut.LutInfo
|
||||
import com.hinnka.mycamera.ui.components.LutSelector
|
||||
import com.hinnka.mycamera.raw.DcpInfo
|
||||
|
||||
@Composable
|
||||
fun RawEditPanel(
|
||||
selectedDcpId: String?,
|
||||
availableDcps: List<DcpInfo>,
|
||||
selectedBaselineLutId: String?,
|
||||
onSelectBaselineLut: (String?) -> Unit,
|
||||
onEditBaselineRecipe: (String) -> Unit,
|
||||
availableLuts: List<LutInfo>,
|
||||
thumbnail: Bitmap?,
|
||||
rawNlmNoiseFactor: Float,
|
||||
rawExposureCompensation: Float,
|
||||
rawAutoExposure: Boolean,
|
||||
@@ -58,6 +67,14 @@ fun RawEditPanel(
|
||||
onDeleteDcp = onDeleteDcp
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
RawBaselineColorCorrectionSelector(
|
||||
selectedLutId = selectedBaselineLutId,
|
||||
availableLuts = availableLuts,
|
||||
thumbnail = thumbnail,
|
||||
onSelectLut = onSelectBaselineLut,
|
||||
onEditRecipe = onEditBaselineRecipe
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
RawSwitchSettingItem(
|
||||
title = stringResource(R.string.settings_raw_auto_exposure),
|
||||
description = stringResource(R.string.settings_raw_auto_exposure_description),
|
||||
@@ -341,3 +358,122 @@ private fun DcpItem(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun RawBaselineColorCorrectionSelector(
|
||||
selectedLutId: String?,
|
||||
availableLuts: List<LutInfo>,
|
||||
thumbnail: Bitmap?,
|
||||
onSelectLut: (String?) -> Unit,
|
||||
onEditRecipe: (String) -> Unit
|
||||
) {
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
val selectedLut = availableLuts.find { it.id == selectedLutId }
|
||||
val selectedName = selectedLut?.getName() ?: stringResource(R.string.none)
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.clickable { showDialog = true }
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.settings_baseline_raw_title),
|
||||
color = Color.White,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text(
|
||||
text = selectedName,
|
||||
color = Color.White.copy(alpha = 0.6f),
|
||||
fontSize = 13.sp,
|
||||
lineHeight = 18.sp,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
if (selectedLutId != null) {
|
||||
IconButton(onClick = { onEditRecipe(selectedLutId) }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = stringResource(R.string.settings_baseline_edit_recipe),
|
||||
tint = Color.White.copy(alpha = 0.6f)
|
||||
)
|
||||
}
|
||||
}
|
||||
Icon(
|
||||
imageVector = Icons.Default.ChevronRight,
|
||||
contentDescription = null,
|
||||
tint = Color.White.copy(alpha = 0.6f),
|
||||
modifier = Modifier.clickable { showDialog = true }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (showDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showDialog = false },
|
||||
title = {
|
||||
Text(text = stringResource(R.string.settings_baseline_raw_title))
|
||||
},
|
||||
text = {
|
||||
Column {
|
||||
Text(
|
||||
text = stringResource(R.string.settings_baseline_dialog_description),
|
||||
color = Color.White.copy(alpha = 0.7f),
|
||||
fontSize = 13.sp,
|
||||
modifier = Modifier.padding(bottom = 12.dp)
|
||||
)
|
||||
LutSelector(
|
||||
availableLuts = availableLuts,
|
||||
currentLutId = selectedLutId,
|
||||
thumbnail = thumbnail,
|
||||
onLutSelected = { selected ->
|
||||
onSelectLut(selected)
|
||||
showDialog = false
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
showDialog = false
|
||||
if (selectedLutId != null) {
|
||||
onEditRecipe(selectedLutId)
|
||||
}
|
||||
},
|
||||
enabled = selectedLutId != null
|
||||
) {
|
||||
Text(stringResource(R.string.settings_baseline_edit_recipe))
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
Row {
|
||||
TextButton(
|
||||
onClick = {
|
||||
onSelectLut(null)
|
||||
showDialog = false
|
||||
}
|
||||
) {
|
||||
Text(stringResource(R.string.settings_baseline_clear))
|
||||
}
|
||||
TextButton(onClick = { showDialog = false }) {
|
||||
Text(stringResource(R.string.cancel))
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@ import com.hinnka.mycamera.frame.TextType
|
||||
import com.hinnka.mycamera.gallery.MediaData
|
||||
import com.hinnka.mycamera.model.ColorRecipeParams
|
||||
import com.hinnka.mycamera.ui.camera.LutEditBottomSheet
|
||||
import com.hinnka.mycamera.ui.camera.LutEditorTarget
|
||||
import com.hinnka.mycamera.ui.camera.RecipeScope
|
||||
import com.hinnka.mycamera.ui.components.*
|
||||
import com.hinnka.mycamera.ui.components.RawEditPanel
|
||||
@@ -91,6 +92,7 @@ private data class PreviewRenderSignature(
|
||||
val editRawBlackPointCorrection: Float,
|
||||
val editRawWhitePointCorrection: Float,
|
||||
val editRawDcpId: String?,
|
||||
val editRawBaselineLutId: String?,
|
||||
val editComputationalAperture: Float?,
|
||||
val editFocusX: Float?,
|
||||
val editFocusY: Float?,
|
||||
@@ -128,6 +130,8 @@ fun PhotoEditScreen(
|
||||
val lutScrollState = rememberLazyListState()
|
||||
val frameScrollState = rememberLazyListState()
|
||||
var showLutEditDialog by remember { mutableStateOf(false) }
|
||||
var showBaselineLutEditDialog by remember { mutableStateOf(false) }
|
||||
var baselineLutEditId by remember { mutableStateOf<String?>(null) }
|
||||
var previewRecipeParamsOverride by remember(editLutId) { mutableStateOf<ColorRecipeParams?>(null) }
|
||||
|
||||
BackHandler {
|
||||
@@ -153,6 +157,7 @@ fun PhotoEditScreen(
|
||||
val editRawBlackPointCorrection by viewModel.editRawBlackPointCorrection.collectAsState()
|
||||
val editRawWhitePointCorrection by viewModel.editRawWhitePointCorrection.collectAsState()
|
||||
val editRawDcpId by viewModel.editRawDcpId.collectAsState()
|
||||
val editRawBaselineLutId by viewModel.editRawBaselineLutId.collectAsState()
|
||||
val availableDcps = viewModel.availableDcps
|
||||
|
||||
val editComputationalAperture by viewModel.editComputationalAperture.collectAsState()
|
||||
@@ -201,6 +206,7 @@ fun PhotoEditScreen(
|
||||
editRawBlackPointCorrection = editRawBlackPointCorrection,
|
||||
editRawWhitePointCorrection = editRawWhitePointCorrection,
|
||||
editRawDcpId = editRawDcpId,
|
||||
editRawBaselineLutId = editRawBaselineLutId,
|
||||
editComputationalAperture = editComputationalAperture,
|
||||
editFocusX = editFocusX,
|
||||
editFocusY = editFocusY,
|
||||
@@ -575,7 +581,7 @@ fun PhotoEditScreen(
|
||||
|
||||
// 编辑控制区域
|
||||
AnimatedVisibility(
|
||||
visible = showControls && !showLutEditDialog,
|
||||
visible = showControls && !showLutEditDialog && !showBaselineLutEditDialog,
|
||||
enter = slideInVertically(initialOffsetY = { it }) + expandVertically(expandFrom = Alignment.Bottom) + fadeIn(),
|
||||
exit = slideOutVertically(targetOffsetY = { it }) + shrinkVertically(shrinkTowards = Alignment.Bottom) + fadeOut(),
|
||||
modifier = Modifier.align(Alignment.BottomCenter)
|
||||
@@ -850,7 +856,7 @@ fun PhotoEditScreen(
|
||||
value = editChromaNoiseReduction,
|
||||
valueRange = 0f..1f,
|
||||
resetValue = 0f,
|
||||
onValueChange = { viewModel.setChromaNoiseReduction(it) },
|
||||
onValueChange = { viewModel.setChromaNoiseReduction(it) },
|
||||
onValueChangeFinished = { }
|
||||
)
|
||||
}
|
||||
@@ -858,6 +864,16 @@ fun PhotoEditScreen(
|
||||
RawEditPanel(
|
||||
selectedDcpId = editRawDcpId,
|
||||
availableDcps = availableDcps,
|
||||
selectedBaselineLutId = editRawBaselineLutId,
|
||||
onSelectBaselineLut = { lutId ->
|
||||
viewModel.saveRawBaselineLutSelection(currentPhoto, lutId)
|
||||
},
|
||||
onEditBaselineRecipe = { lutId ->
|
||||
baselineLutEditId = lutId
|
||||
showBaselineLutEditDialog = true
|
||||
},
|
||||
availableLuts = availableLuts,
|
||||
thumbnail = previewBitmap,
|
||||
rawNlmNoiseFactor = editRawNlmNoiseFactor,
|
||||
rawExposureCompensation = editRawExposureCompensation,
|
||||
rawAutoExposure = editRawAutoExposure,
|
||||
@@ -933,6 +949,18 @@ fun PhotoEditScreen(
|
||||
)
|
||||
}
|
||||
|
||||
if (showBaselineLutEditDialog && baselineLutEditId != null) {
|
||||
LutEditBottomSheet(
|
||||
lutId = baselineLutEditId!!,
|
||||
editorTarget = LutEditorTarget.BASELINE_RAW,
|
||||
onDismiss = {
|
||||
showBaselineLutEditDialog = false
|
||||
baselineLutEditId = null
|
||||
},
|
||||
containerColor = Color(0x151A1A1A)
|
||||
)
|
||||
}
|
||||
|
||||
if (showPaymentDialog) {
|
||||
val activity = context.findActivity()
|
||||
PaymentDialog(
|
||||
|
||||
@@ -1189,11 +1189,37 @@ fun SettingsScreen(
|
||||
}
|
||||
|
||||
SettingsTab.RAW -> {
|
||||
BaselineColorCorrectionSettingItem(
|
||||
title = stringResource(R.string.settings_baseline_raw_title),
|
||||
description = stringResource(R.string.settings_baseline_raw_description),
|
||||
selectedLut = availableLuts.find { it.id == rawBaselineLutId },
|
||||
onClick = { baselinePickerTarget = BaselineColorCorrectionTarget.RAW }
|
||||
RawEditPanel(
|
||||
selectedDcpId = rawDcpId,
|
||||
availableDcps = availableDcps,
|
||||
selectedBaselineLutId = rawBaselineLutId,
|
||||
onSelectBaselineLut = { viewModel.setBaselineLut(BaselineColorCorrectionTarget.RAW, it) },
|
||||
onEditBaselineRecipe = { baselineRecipeEditorTarget = BaselineColorCorrectionTarget.RAW },
|
||||
availableLuts = availableLuts,
|
||||
thumbnail = previewThumbnail,
|
||||
rawNlmNoiseFactor = rawNlmNoiseFactorUi,
|
||||
rawExposureCompensation = rawExposureCompensationUi,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawBlackPointCorrection = rawBlackPointCorrectionUi,
|
||||
rawWhitePointCorrection = rawWhitePointCorrectionUi,
|
||||
onSelectDcp = { viewModel.setRawDcpId(it) },
|
||||
onImportDcp = { importDcpLauncher.launch(arrayOf("*/*")) },
|
||||
onDeleteDcp = { dcp ->
|
||||
viewModel.deleteRawDcp(dcp.id) { success ->
|
||||
android.widget.Toast.makeText(
|
||||
context,
|
||||
if (success) R.string.raw_dcp_delete_success else R.string.raw_dcp_delete_failed,
|
||||
android.widget.Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
},
|
||||
onRawNlmNoiseFactorChange = { rawNlmNoiseFactorUi = it },
|
||||
onRawExposureCompensationChange = { rawExposureCompensationUi = it },
|
||||
onRawAutoExposureChange = { viewModel.setRawAutoExposure(it) },
|
||||
onRawBlackPointCorrectionChange = { rawBlackPointCorrectionUi = it },
|
||||
onRawWhitePointCorrectionChange = { rawWhitePointCorrectionUi = it },
|
||||
onAdjustmentStart = { isRawSliderAdjusting = true },
|
||||
onAdjustmentEnd = { commitRawSliderValues() }
|
||||
)
|
||||
|
||||
HorizontalDivider(
|
||||
@@ -1208,7 +1234,7 @@ fun SettingsScreen(
|
||||
onCheckedChange = { viewModel.setExportDngWithRawExport(it) }
|
||||
)
|
||||
|
||||
HorizontalDivider(
|
||||
/*HorizontalDivider(
|
||||
modifier = Modifier.padding(vertical = 8.dp),
|
||||
color = Color.White.copy(alpha = 0.1f)
|
||||
)
|
||||
@@ -1218,7 +1244,7 @@ fun SettingsScreen(
|
||||
description = stringResource(R.string.settings_raw_auto_white_balance_estimate_description),
|
||||
checked = rawAutoWhiteBalanceEstimate,
|
||||
onCheckedChange = { viewModel.setRawAutoWhiteBalanceEstimate(it) }
|
||||
)
|
||||
)*/
|
||||
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(vertical = 8.dp),
|
||||
@@ -1260,43 +1286,6 @@ fun SettingsScreen(
|
||||
}
|
||||
)
|
||||
}
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(vertical = 8.dp),
|
||||
color = Color.White.copy(alpha = 0.1f)
|
||||
)
|
||||
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(vertical = 8.dp),
|
||||
color = Color.White.copy(alpha = 0.1f)
|
||||
)
|
||||
|
||||
RawEditPanel(
|
||||
selectedDcpId = rawDcpId,
|
||||
availableDcps = availableDcps,
|
||||
rawNlmNoiseFactor = rawNlmNoiseFactorUi,
|
||||
rawExposureCompensation = rawExposureCompensationUi,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawBlackPointCorrection = rawBlackPointCorrectionUi,
|
||||
rawWhitePointCorrection = rawWhitePointCorrectionUi,
|
||||
onSelectDcp = { viewModel.setRawDcpId(it) },
|
||||
onImportDcp = { importDcpLauncher.launch(arrayOf("*/*")) },
|
||||
onDeleteDcp = { dcp ->
|
||||
viewModel.deleteRawDcp(dcp.id) { success ->
|
||||
android.widget.Toast.makeText(
|
||||
context,
|
||||
if (success) R.string.raw_dcp_delete_success else R.string.raw_dcp_delete_failed,
|
||||
android.widget.Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
},
|
||||
onRawNlmNoiseFactorChange = { rawNlmNoiseFactorUi = it },
|
||||
onRawExposureCompensationChange = { rawExposureCompensationUi = it },
|
||||
onRawAutoExposureChange = { viewModel.setRawAutoExposure(it) },
|
||||
onRawBlackPointCorrectionChange = { rawBlackPointCorrectionUi = it },
|
||||
onRawWhitePointCorrectionChange = { rawWhitePointCorrectionUi = it },
|
||||
onAdjustmentStart = { isRawSliderAdjusting = true },
|
||||
onAdjustmentEnd = { commitRawSliderValues() }
|
||||
)
|
||||
}
|
||||
|
||||
SettingsTab.PHANTOM -> {
|
||||
|
||||
@@ -484,6 +484,11 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
userPreferencesRepository.userPreferences.collect {
|
||||
if (!firstPreferencesLogged) {
|
||||
firstPreferencesLogged = true
|
||||
|
||||
if (it.rawAutoWhiteBalanceEstimate) {
|
||||
setRawAutoWhiteBalanceEstimate(false)
|
||||
}
|
||||
|
||||
StartupTrace.mark(
|
||||
"CameraViewModel.userPreferences first collect",
|
||||
"costMs=${SystemClock.elapsedRealtime() - preferenceCollectStart}"
|
||||
@@ -710,6 +715,11 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
fun setRawDcpId(dcpId: String?) {
|
||||
viewModelScope.launch { userPreferencesRepository.saveRawDcpId(dcpId) }
|
||||
}
|
||||
fun setRawBaselineLutId(lutId: String?) {
|
||||
viewModelScope.launch {
|
||||
userPreferencesRepository.saveBaselineLutConfig(com.hinnka.mycamera.lut.BaselineColorCorrectionTarget.RAW, lutId)
|
||||
}
|
||||
}
|
||||
fun setRawNlmNoiseFactor(value: Float) {
|
||||
viewModelScope.launch { userPreferencesRepository.saveRawNlmNoiseFactor(value) }
|
||||
}
|
||||
|
||||
@@ -298,6 +298,8 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
private set
|
||||
var editRawDcpId = MutableStateFlow<String?>(null)
|
||||
private set
|
||||
var editRawBaselineLutId = MutableStateFlow<String?>(null)
|
||||
private set
|
||||
|
||||
// Computational Bokeh editing state
|
||||
var editComputationalAperture = MutableStateFlow<Float?>(null)
|
||||
@@ -1579,6 +1581,9 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
currentMediaMetadata?.let { metadata ->
|
||||
editLutId.value = metadata.lutId
|
||||
editFrameId.value = metadata.frameId
|
||||
editRawDcpId.value = metadata.rawDcpId
|
||||
editRawBaselineLutId.value = metadata.baselineLutId
|
||||
restoreCropEditState(targetPhoto, metadata)
|
||||
editPhotoRecipeParams.value = metadata.colorRecipeParams
|
||||
// 智能初始化:导入的照片默认值为 0,App 拍摄的则回退到当前全局配置
|
||||
editSharpening.value =
|
||||
@@ -1593,12 +1598,10 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawAutoExposure.value = metadata.rawAutoExposure ?: true
|
||||
editRawBlackPointCorrection.value = metadata.rawBlackPointCorrection ?: 0f
|
||||
editRawWhitePointCorrection.value = metadata.rawWhitePointCorrection ?: 0f
|
||||
editRawDcpId.value = metadata.rawDcpId
|
||||
|
||||
editComputationalAperture.value = metadata.computationalAperture
|
||||
editFocusPointX.value = metadata.focusPointX
|
||||
editFocusPointY.value = metadata.focusPointY
|
||||
restoreCropEditState(targetPhoto, metadata)
|
||||
} ?: run {
|
||||
editLutId.value = null
|
||||
editFrameId.value = null
|
||||
@@ -1612,6 +1615,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawBlackPointCorrection.value = 0f
|
||||
editRawWhitePointCorrection.value = 0f
|
||||
editRawDcpId.value = null
|
||||
editRawBaselineLutId.value = null
|
||||
editComputationalAperture.value = null
|
||||
editFocusPointX.value = null
|
||||
editFocusPointY.value = null
|
||||
@@ -1645,6 +1649,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawBlackPointCorrection.value = 0f
|
||||
editRawWhitePointCorrection.value = 0f
|
||||
editRawDcpId.value = null
|
||||
editRawBaselineLutId.value = null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1748,6 +1753,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection.value,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection.value,
|
||||
rawDcpId = editRawDcpId.value,
|
||||
baselineLutId = editRawBaselineLutId.value
|
||||
)
|
||||
if (metadata != null) {
|
||||
currentMediaMetadata = metadata
|
||||
@@ -1790,6 +1796,11 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
persistRawEditMetadata(mediaData)
|
||||
}
|
||||
|
||||
fun saveRawBaselineLutSelection(mediaData: MediaData, lutId: String?) {
|
||||
editRawBaselineLutId.value = lutId
|
||||
persistRawEditMetadata(mediaData)
|
||||
}
|
||||
|
||||
suspend fun importRawDcp(uri: Uri): DcpInfo? {
|
||||
val importedId = withContext(Dispatchers.IO) {
|
||||
contentRepository.getCustomImportManager().importDcp(uri)
|
||||
@@ -2014,6 +2025,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection.value,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection.value,
|
||||
rawDcpId = editRawDcpId.value,
|
||||
baselineLutId = editRawBaselineLutId.value,
|
||||
computationalAperture = editComputationalAperture.value,
|
||||
focusPointX = editFocusPointX.value,
|
||||
focusPointY = editFocusPointY.value,
|
||||
@@ -2298,6 +2310,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection.value,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection.value,
|
||||
rawDcpId = editRawDcpId.value,
|
||||
baselineLutId = editRawBaselineLutId.value,
|
||||
computationalAperture = editComputationalAperture.value,
|
||||
focusPointX = editFocusPointX.value,
|
||||
focusPointY = editFocusPointY.value,
|
||||
|
||||
@@ -205,9 +205,9 @@
|
||||
<string name="settings_section_software_processing">细节微调</string>
|
||||
<string name="settings_baseline_jpg_title">JPG 基准色彩校正</string>
|
||||
<string name="settings_baseline_jpg_description">选择普通 JPG 创意 LUT 之前先应用的基准 LUT 与基准配方。</string>
|
||||
<string name="settings_baseline_raw_title">RAW 基准色彩校正</string>
|
||||
<string name="settings_baseline_raw_title">基准色彩校正</string>
|
||||
<string name="settings_baseline_raw_description">选择用于 RAW 渲染、导出和重处理链路的基准 LUT 与基准配方。</string>
|
||||
<string name="raw_dcp_title">RAW DCP</string>
|
||||
<string name="raw_dcp_title">DCP</string>
|
||||
<string name="raw_dcp_import">导入 DCP</string>
|
||||
<string name="raw_dcp_import_success">已导入 DCP:%1$s</string>
|
||||
<string name="raw_dcp_import_success_count">已导入 %1$d 个 DCP 配置</string>
|
||||
@@ -657,14 +657,14 @@
|
||||
<string name="settings_log_curve">RAW 伽马</string>
|
||||
<string name="settings_raw_nlm_base_h">RAW NLM 基础强度</string>
|
||||
<string name="settings_raw_nlm_gain_factor">RAW NLM 增益响应</string>
|
||||
<string name="settings_raw_nlm_noise_factor">RAW 降噪</string>
|
||||
<string name="settings_raw_exposure_compensation">RAW 曝光补偿</string>
|
||||
<string name="settings_raw_auto_exposure">RAW 自动曝光</string>
|
||||
<string name="settings_raw_nlm_noise_factor">降噪</string>
|
||||
<string name="settings_raw_exposure_compensation">曝光补偿</string>
|
||||
<string name="settings_raw_auto_exposure">自动曝光</string>
|
||||
<string name="settings_raw_auto_exposure_description">显影时对 RAW 线性数据自动测光并应用曝光补偿。</string>
|
||||
<string name="settings_raw_metering_center_weight">RAW 测光中心权重</string>
|
||||
<string name="settings_raw_metering_center_weight_description">数值越低越接近评价测光,越高越接近中央重点测光。</string>
|
||||
<string name="settings_raw_black_point_correction">RAW 黑点校正</string>
|
||||
<string name="settings_raw_white_point_correction">RAW 白点校正</string>
|
||||
<string name="settings_raw_black_point_correction">黑点校正</string>
|
||||
<string name="settings_raw_white_point_correction">白点校正</string>
|
||||
<string name="settings_export_dng_with_raw_export">导出 RAW 时同时导出 DNG</string>
|
||||
<string name="settings_export_dng_with_raw_export_description">导出 RAW 照片时,同时将对应的原始 DNG 文件导出到系统相册。</string>
|
||||
<string name="settings_raw_auto_white_balance_estimate">RAW 自动白平衡</string>
|
||||
|
||||
@@ -431,7 +431,7 @@
|
||||
<string name="raw_profile_arri_master">ARRI 大師</string>
|
||||
<string name="raw_profile_fuji_provia">富士 PROVIA</string>
|
||||
<string name="raw_profile_standard_srgb">標準 sRGB</string>
|
||||
<string name="settings_raw_nlm_noise_factor">RAW 降噪</string>
|
||||
<string name="settings_raw_nlm_noise_factor">降噪</string>
|
||||
<string name="settings_use_p010">P010 (10 位 YUV)</string>
|
||||
<string name="settings_use_p010_description">啟用 10 位 YUV 輸出以獲得更好的影像資料精度。僅在支援的裝置上且 RAW 關閉時生效。</string>
|
||||
<string name="settings_use_hlg10">HLG10 HDR</string>
|
||||
|
||||
@@ -207,9 +207,9 @@
|
||||
<string name="settings_section_software_processing">Fine Tuning</string>
|
||||
<string name="settings_baseline_jpg_title">JPG Baseline Color Correction</string>
|
||||
<string name="settings_baseline_jpg_description">Choose the baseline LUT and recipe applied before the regular JPG creative LUT.</string>
|
||||
<string name="settings_baseline_raw_title">RAW Baseline Color Correction</string>
|
||||
<string name="settings_baseline_raw_title">Baseline Color Correction</string>
|
||||
<string name="settings_baseline_raw_description">Choose the baseline LUT and recipe used for RAW rendering, export, and reprocessing.</string>
|
||||
<string name="raw_dcp_title">RAW DCP</string>
|
||||
<string name="raw_dcp_title">DCP</string>
|
||||
<string name="raw_dcp_import">Import DCP</string>
|
||||
<string name="raw_dcp_import_success">Imported DCP: %1$s</string>
|
||||
<string name="raw_dcp_import_success_count">Imported %1$d DCP profiles</string>
|
||||
@@ -641,14 +641,14 @@
|
||||
<string name="raw_profile_standard_srgb">Standard sRGB</string>
|
||||
<string name="settings_raw_nlm_base_h">RAW NLM Base Strength</string>
|
||||
<string name="settings_raw_nlm_gain_factor">RAW NLM Gain Response</string>
|
||||
<string name="settings_raw_nlm_noise_factor">RAW Denoise</string>
|
||||
<string name="settings_raw_exposure_compensation">RAW Exposure Compensation</string>
|
||||
<string name="settings_raw_auto_exposure">RAW Auto Exposure</string>
|
||||
<string name="settings_raw_nlm_noise_factor">Denoise</string>
|
||||
<string name="settings_raw_exposure_compensation">Exposure Compensation</string>
|
||||
<string name="settings_raw_auto_exposure">Auto Exposure</string>
|
||||
<string name="settings_raw_auto_exposure_description">Automatically meters RAW linear data during development and applies exposure compensation.</string>
|
||||
<string name="settings_raw_metering_center_weight">RAW Metering Center Weight</string>
|
||||
<string name="settings_raw_metering_center_weight_description">Lower values are closer to evaluative metering; higher values tighten and emphasize the center area.</string>
|
||||
<string name="settings_raw_black_point_correction">RAW Black Point Correction</string>
|
||||
<string name="settings_raw_white_point_correction">RAW White Point Correction</string>
|
||||
<string name="settings_raw_black_point_correction">Black Point Correction</string>
|
||||
<string name="settings_raw_white_point_correction">White Point Correction</string>
|
||||
<string name="settings_export_dng_with_raw_export">Export DNG with RAW photos</string>
|
||||
<string name="settings_export_dng_with_raw_export_description">When exporting a RAW photo, also export its original DNG file to the system gallery.</string>
|
||||
<string name="settings_raw_auto_white_balance_estimate">RAW auto white balance</string>
|
||||
|
||||
Reference in new issue
Block a user