feat: camera ui

This commit is contained in:
zhoubinjia committed 2026-07-27 15:11:26 +08:00
1 parent c77c98606d
commit b3a3b7aa95
13 files changed
+800 -135

No files matched your search

@@ -1,17 +1,25 @@
package com.hinnka.mycamera.ui.camera package com.hinnka.mycamera.ui.camera
import android.hardware.camera2.CameraMetadata import android.hardware.camera2.CameraMetadata
import androidx.compose.foundation.clickable import androidx.compose.foundation.background
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.hinnka.mycamera.camera.CameraState import com.hinnka.mycamera.camera.CameraState
import com.hinnka.mycamera.camera.CameraUtils
import com.hinnka.mycamera.ui.components.PhysicalButton
internal val CameraParameterValuesOverlayHeight = 24.dp
@Composable @Composable
fun CameraParameterBar( fun CameraParameterBar(
@@ -20,8 +28,6 @@ fun CameraParameterBar(
onParameterClick: (CameraParameter) -> Unit, onParameterClick: (CameraParameter) -> Unit,
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
val yellow = Color(0xFFFFD700) // Design uses a yellow/gold color for labels
Row( Row(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
@@ -31,44 +37,30 @@ fun CameraParameterBar(
) { ) {
ParameterItem( ParameterItem(
label = "AE", label = "AE",
value = String.format("%.1f", state.exposureCompensation * state.getExposureCompensationStep()),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.EXPOSURE_COMPENSATION, isSelected = selectedParameter == CameraParameter.EXPOSURE_COMPENSATION,
isEnabled = state.isAutoExposure, // Only available in auto exposure mode isEnabled = state.isAutoExposure, // Only available in auto exposure mode
onClick = { onParameterClick(CameraParameter.EXPOSURE_COMPENSATION) } onClick = { onParameterClick(CameraParameter.EXPOSURE_COMPENSATION) }
) )
val tvValue = if (state.shutterSpeed <= 0) "0"
else if (state.shutterSpeed >= 1_000_000_000.0) (state.shutterSpeed / 1_000_000_000.0).toInt().toString()
else "1/${(1_000_000_000.0 / state.shutterSpeed).toInt()}"
ParameterItem( ParameterItem(
label = "Tv", label = "Tv",
value = tvValue,
labelColor = yellow,
valueColor = if (state.isPreviewExposureLimited()) Color.Red else null,
isSelected = selectedParameter == CameraParameter.SHUTTER_SPEED, isSelected = selectedParameter == CameraParameter.SHUTTER_SPEED,
isEnabled = true, isEnabled = true,
onClick = { onParameterClick(CameraParameter.SHUTTER_SPEED) } onClick = { onParameterClick(CameraParameter.SHUTTER_SPEED) }
) )
ParameterItem( ParameterItem(
label = "ISO", label = "ISO",
value = state.iso.toString(),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.ISO, isSelected = selectedParameter == CameraParameter.ISO,
isEnabled = true, isEnabled = true,
onClick = { onParameterClick(CameraParameter.ISO) } onClick = { onParameterClick(CameraParameter.ISO) }
) )
ParameterItem( ParameterItem(
label = "AF", label = "AF",
value = formatFocusDistance(state.focusDistance),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.FOCUS, isSelected = selectedParameter == CameraParameter.FOCUS,
isEnabled = true, isEnabled = true,
onClick = { onParameterClick(CameraParameter.FOCUS) } onClick = { onParameterClick(CameraParameter.FOCUS) }
) )
ParameterItem( ParameterItem(
label = "AWB", label = "AWB",
value = formatWhiteBalanceValue(state),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.WHITE_BALANCE, isSelected = selectedParameter == CameraParameter.WHITE_BALANCE,
isEnabled = state.canAdjustWhiteBalance || state.actualAwbTemperature != null, isEnabled = state.canAdjustWhiteBalance || state.actualAwbTemperature != null,
onClick = { onParameterClick(CameraParameter.WHITE_BALANCE) } onClick = { onParameterClick(CameraParameter.WHITE_BALANCE) }
@@ -79,44 +71,118 @@ fun CameraParameterBar(
@Composable @Composable
fun ParameterItem( fun ParameterItem(
label: String, label: String,
value: String,
labelColor: Color,
valueColor: Color? = null,
isSelected: Boolean, isSelected: Boolean,
isEnabled: Boolean, isEnabled: Boolean,
onClick: () -> Unit, onClick: () -> Unit,
vertical: Boolean = false,
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
Column( PhysicalButton(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = modifier modifier = modifier
.width(60.dp) .width(if (vertical) 40.dp else 60.dp)
.heightIn(min = 48.dp) .height(if (vertical) 60.dp else 40.dp),
.autoRotate() onClick = onClick,
.then( enabled = isEnabled,
if (isEnabled) { shape = RoundedCornerShape(18.dp)
Modifier.clickable { onClick() }
} else {
Modifier
}
)
) { ) {
Text( Box(
text = label, modifier = Modifier.fillMaxSize(),
color = if (isSelected) Color(0xFFFFD700) else labelColor.copy(alpha = if (isEnabled) 1f else 0.5f), contentAlignment = Alignment.Center
fontSize = 10.sp, ) {
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Normal Text(
) text = label,
Text( modifier = if (vertical) Modifier.rotate(90f) else Modifier,
text = value, color = if (isSelected) {
color = valueColor ?: if (isSelected) Color(0xFFFFD700) else Color.White.copy(alpha = if (isEnabled) 1f else 0.5f), Color(0xFFFFD700)
fontSize = 11.sp, } else {
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Bold Color.White.copy(alpha = if (isEnabled) 1f else 0.5f)
) },
fontSize = 11.sp,
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Normal
)
}
} }
} }
@Composable
fun CameraParameterValuesOverlay(
state: CameraState,
modifier: Modifier = Modifier
) {
BoxWithConstraints(
modifier = modifier
.fillMaxWidth()
.height(CameraParameterValuesOverlayHeight)
.background(Color.Black.copy(alpha = 0.48f))
.padding(horizontal = 6.dp),
contentAlignment = Alignment.Center
) {
val showLabels = maxWidth >= 300.dp
val valueFontSize = if (showLabels) 10.sp else 9.sp
val values = listOf(
CameraParameterValue(
label = "AE",
value = CameraUtils.formatExposureCompensation(
state.exposureCompensation,
state.getExposureCompensationStep()
)
),
CameraParameterValue(
label = "Tv",
value = formatShutterSpeedValue(state.shutterSpeed),
valueColor = if (state.isPreviewExposureLimited()) Color.Red else Color.White
),
CameraParameterValue(label = "ISO", value = state.iso.toString()),
CameraParameterValue(label = "AF", value = formatFocusDistance(state.focusDistance)),
CameraParameterValue(label = "AWB", value = formatWhiteBalanceValue(state))
)
Row(
modifier = Modifier.fillMaxSize(),
verticalAlignment = Alignment.CenterVertically
) {
values.forEach { item ->
Row(
modifier = Modifier.weight(1f),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
if (showLabels) {
Text(
text = item.label,
color = Color(0xFFFFD700).copy(alpha = 0.82f),
fontSize = 8.sp,
fontWeight = FontWeight.Medium,
maxLines = 1
)
Spacer(modifier = Modifier.width(3.dp))
}
Text(
text = item.value,
color = item.valueColor,
fontSize = valueFontSize,
fontWeight = FontWeight.Medium,
textAlign = TextAlign.Center,
maxLines = 1,
softWrap = false,
overflow = TextOverflow.Clip
)
}
}
}
}
}
private data class CameraParameterValue(
val label: String,
val value: String,
val valueColor: Color = Color.White
)
internal fun formatShutterSpeedValue(value: Long): String {
return if (value <= 0L) "0" else CameraUtils.formatShutterSpeed(value)
}
internal fun formatFocusDistance(value: Float): String { internal fun formatFocusDistance(value: Float): String {
return if (value <= 0.01f) "∞" return if (value <= 0.01f) "∞"
else { else {
@@ -1,17 +1,12 @@
package com.hinnka.mycamera.ui.camera package com.hinnka.mycamera.ui.camera
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.hinnka.mycamera.camera.CameraState import com.hinnka.mycamera.camera.CameraState
@Composable @Composable
@@ -21,8 +16,6 @@ fun CameraParameterBarVerticel(
onParameterClick: (CameraParameter) -> Unit, onParameterClick: (CameraParameter) -> Unit,
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
val yellow = Color(0xFFFFD700) // Design uses a yellow/gold color for labels
Column( Column(
modifier = modifier modifier = modifier
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
@@ -32,47 +25,38 @@ fun CameraParameterBarVerticel(
) { ) {
ParameterItem( ParameterItem(
label = "AE", label = "AE",
value = String.format("%.1f", state.exposureCompensation * state.getExposureCompensationStep()),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.EXPOSURE_COMPENSATION, isSelected = selectedParameter == CameraParameter.EXPOSURE_COMPENSATION,
isEnabled = state.isAutoExposure, // Only available in auto exposure mode isEnabled = state.isAutoExposure, // Only available in auto exposure mode
onClick = { onParameterClick(CameraParameter.EXPOSURE_COMPENSATION) } onClick = { onParameterClick(CameraParameter.EXPOSURE_COMPENSATION) },
vertical = true
) )
val tvValue = if (state.shutterSpeed <= 0) "0"
else if (state.shutterSpeed >= 1_000_000_000.0) (state.shutterSpeed / 1_000_000_000.0).toInt().toString()
else "1/${(1_000_000_000.0 / state.shutterSpeed).toInt()}"
ParameterItem( ParameterItem(
label = "Tv", label = "Tv",
value = tvValue,
labelColor = yellow,
valueColor = if (state.isPreviewExposureLimited()) Color.Red else null,
isSelected = selectedParameter == CameraParameter.SHUTTER_SPEED, isSelected = selectedParameter == CameraParameter.SHUTTER_SPEED,
isEnabled = true, isEnabled = true,
onClick = { onParameterClick(CameraParameter.SHUTTER_SPEED) } onClick = { onParameterClick(CameraParameter.SHUTTER_SPEED) },
vertical = true
) )
ParameterItem( ParameterItem(
label = "ISO", label = "ISO",
value = state.iso.toString(),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.ISO, isSelected = selectedParameter == CameraParameter.ISO,
isEnabled = true, isEnabled = true,
onClick = { onParameterClick(CameraParameter.ISO) } onClick = { onParameterClick(CameraParameter.ISO) },
vertical = true
) )
ParameterItem( ParameterItem(
label = "AF", label = "AF",
value = formatFocusDistance(state.focusDistance),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.FOCUS, isSelected = selectedParameter == CameraParameter.FOCUS,
isEnabled = true, isEnabled = true,
onClick = { onParameterClick(CameraParameter.FOCUS) } onClick = { onParameterClick(CameraParameter.FOCUS) },
vertical = true
) )
ParameterItem( ParameterItem(
label = "AWB", label = "AWB",
value = formatWhiteBalanceValue(state),
labelColor = yellow,
isSelected = selectedParameter == CameraParameter.WHITE_BALANCE, isSelected = selectedParameter == CameraParameter.WHITE_BALANCE,
isEnabled = state.canAdjustWhiteBalance || state.actualAwbTemperature != null, isEnabled = state.canAdjustWhiteBalance || state.actualAwbTemperature != null,
onClick = { onParameterClick(CameraParameter.WHITE_BALANCE) } onClick = { onParameterClick(CameraParameter.WHITE_BALANCE) },
vertical = true
) )
} }
} }
@@ -274,6 +274,7 @@ fun CameraScreen(
var previewBounds by remember { mutableStateOf<Rect?>(null) } var previewBounds by remember { mutableStateOf<Rect?>(null) }
var viewfinderAreaBounds by remember { mutableStateOf<Rect?>(null) } var viewfinderAreaBounds by remember { mutableStateOf<Rect?>(null) }
var zoomBarBounds by remember { mutableStateOf<Rect?>(null) } var zoomBarBounds by remember { mutableStateOf<Rect?>(null) }
var parameterRulerBounds by remember { mutableStateOf<Rect?>(null) }
var galleryThumbnailBounds by remember { mutableStateOf<Rect?>(null) } var galleryThumbnailBounds by remember { mutableStateOf<Rect?>(null) }
var captureAnimationSnapshot by remember { mutableStateOf<CaptureAnimationSnapshot?>(null) } var captureAnimationSnapshot by remember { mutableStateOf<CaptureAnimationSnapshot?>(null) }
var previewTransitionActive by remember { mutableStateOf(true) } var previewTransitionActive by remember { mutableStateOf(true) }
@@ -730,6 +731,11 @@ fun CameraScreen(
val isVideoMode = state.captureMode == CaptureMode.VIDEO val isVideoMode = state.captureMode == CaptureMode.VIDEO
val isPhotoStyleMode = state.captureMode != CaptureMode.VIDEO val isPhotoStyleMode = state.captureMode != CaptureMode.VIDEO
LaunchedEffect(isPhotoStyleMode) {
if (!isPhotoStyleMode) {
parameterRulerBounds = null
}
}
val videoAspectRatio = val videoAspectRatio =
state.videoConfig.aspectRatio.getPortraitAspectRatio(state.videoCapabilities.openGatePortraitAspectRatio) state.videoConfig.aspectRatio.getPortraitAspectRatio(state.videoCapabilities.openGatePortraitAspectRatio)
@@ -744,12 +750,12 @@ fun CameraScreen(
width width
} }
val cardHeight = if (isXpan) { val cardHeight = if (isXpan) {
height - topSafePadding - 224.dp height - topSafePadding - 272.dp
} else if (isVideoMode) { } else if (isVideoMode) {
width / videoAspectRatio width / videoAspectRatio
} else { } else {
val standardHeight = (width - 24.dp) * 4 / 3 + 50.dp val standardHeight = width * 4 / 3
val bottomMinHeight = 196.dp // Precise height for parameterBar (52.dp) + controls (136.dp min + 8.dp buffer) val bottomMinHeight = 188.dp // parameterBar (44.dp) + controls (136.dp min) + 8.dp buffer
val navigationBarHeight = with(density) { val navigationBarHeight = with(density) {
WindowInsets.navigationBars.getBottom(this).toDp() WindowInsets.navigationBars.getBottom(this).toDp()
} }
@@ -823,7 +829,7 @@ fun CameraScreen(
} }
} }
val parameterRuler = @Composable { val parameterRuler = @Composable { rulerModifier: Modifier ->
val whiteBalanceCurrentValue = if ( val whiteBalanceCurrentValue = if (
state.awbMode == android.hardware.camera2.CameraMetadata.CONTROL_AWB_MODE_AUTO state.awbMode == android.hardware.camera2.CameraMetadata.CONTROL_AWB_MODE_AUTO
) { ) {
@@ -905,6 +911,7 @@ fun CameraScreen(
else -> {} else -> {}
} }
}, },
modifier = rulerModifier,
) )
} }
@@ -921,17 +928,16 @@ fun CameraScreen(
modifier = Modifier modifier = Modifier
.animateContentSize(alignment = Alignment.Center) .animateContentSize(alignment = Alignment.Center)
.width(cardWidth) .width(cardWidth)
.height(cardHeight) .height(cardHeight),
.padding(horizontal = if (isXpan || isVideoMode) 0.dp else 8.dp), shape = RoundedCornerShape(if (isXpan) 4.dp else 0.dp),
shape = RoundedCornerShape(if (isVideoMode) 0.dp else 4.dp),
colors = CardDefaults.cardColors( colors = CardDefaults.cardColors(
containerColor = Color.Black containerColor = Color.Black
) )
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
.padding(if (isVideoMode) 0.dp else 4.dp) .padding(if (isXpan) 4.dp else 0.dp)
.weight(1f) .fillMaxSize()
.background(Color.Black) .background(Color.Black)
.onGloballyPositioned { coordinates -> .onGloballyPositioned { coordinates ->
previewBounds = coordinates.boundsInRoot() previewBounds = coordinates.boundsInRoot()
@@ -939,23 +945,24 @@ fun CameraScreen(
.pointerInput(state.availableCameras) { .pointerInput(state.availableCameras) {
var totalDrag = 0f var totalDrag = 0f
awaitEachGesture { awaitEachGesture {
var gestureStartedInZoomBar: Boolean? = null var gestureStartedInPreviewControl: Boolean? = null
while (true) { while (true) {
val event = awaitPointerEvent() val event = awaitPointerEvent()
if (gestureStartedInZoomBar == null) { if (gestureStartedInPreviewControl == null) {
val firstPressedChange = val firstPressedChange =
event.changes.firstOrNull { it.pressed } event.changes.firstOrNull { it.pressed }
val currentPreviewBounds = previewBounds val currentPreviewBounds = previewBounds
gestureStartedInZoomBar = gestureStartedInPreviewControl =
if (firstPressedChange != null && currentPreviewBounds != null) { if (firstPressedChange != null && currentPreviewBounds != null) {
val positionInRoot = val positionInRoot =
currentPreviewBounds.topLeft + firstPressedChange.position currentPreviewBounds.topLeft + firstPressedChange.position
zoomBarBounds?.contains(positionInRoot) == true zoomBarBounds?.contains(positionInRoot) == true ||
parameterRulerBounds?.contains(positionInRoot) == true
} else { } else {
false false
} }
} }
if (gestureStartedInZoomBar == true) { if (gestureStartedInPreviewControl == true) {
if (event.changes.all { !it.pressed }) { if (event.changes.all { !it.pressed }) {
viewModel.isZooming = false viewModel.isZooming = false
totalDrag = 0f totalDrag = 0f
@@ -1120,7 +1127,10 @@ fun CameraScreen(
if (state.captureMode == CaptureMode.PHOTO && useLivePhoto) { if (state.captureMode == CaptureMode.PHOTO && useLivePhoto) {
Surface( Surface(
modifier = Modifier modifier = Modifier
.padding(12.dp) .padding(
top = CameraParameterValuesOverlayHeight + 8.dp,
end = 12.dp
)
.align(Alignment.TopEnd), .align(Alignment.TopEnd),
color = Color.Black.copy(alpha = 0.8f), color = Color.Black.copy(alpha = 0.8f),
shape = CircleShape shape = CircleShape
@@ -1158,7 +1168,10 @@ fun CameraScreen(
HistogramView( HistogramView(
histogram = state.histogram, histogram = state.histogram,
modifier = Modifier modifier = Modifier
.padding(8.dp) .padding(
start = 8.dp,
top = CameraParameterValuesOverlayHeight + 8.dp
)
.size(80.dp, 40.dp) .size(80.dp, 40.dp)
.align(Alignment.TopStart) .align(Alignment.TopStart)
.autoRotate(dx = -20.dp, dy = 20.dp) .autoRotate(dx = -20.dp, dy = 20.dp)
@@ -1192,7 +1205,9 @@ fun CameraScreen(
if (state.burstCapturing && burstCapturingCount > 0) { if (state.burstCapturing && burstCapturingCount > 0) {
BurstCaptureOverlay( BurstCaptureOverlay(
count = burstCapturingCount, count = burstCapturingCount,
modifier = Modifier.fillMaxSize() modifier = Modifier
.fillMaxSize()
.padding(top = CameraParameterValuesOverlayHeight)
) )
} }
@@ -1202,7 +1217,27 @@ fun CameraScreen(
onFinish = { viewModel.finishMultipleExposureSession() }, onFinish = { viewModel.finishMultipleExposureSession() },
onUndo = { viewModel.undoLastMultipleExposureFrame() }, onUndo = { viewModel.undoLastMultipleExposureFrame() },
onCancel = { viewModel.cancelMultipleExposureSession() }, onCancel = { viewModel.cancelMultipleExposureSession() },
modifier = Modifier.fillMaxSize() modifier = Modifier
.fillMaxSize()
.padding(top = CameraParameterValuesOverlayHeight)
)
}
if (isPhotoStyleMode) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(CameraParameterRulerHeight + 64.dp)
.align(Alignment.BottomCenter)
.background(
Brush.verticalGradient(
colors = listOf(
Color.Transparent,
Color.Black.copy(alpha = 0.2f),
Color.Black.copy(alpha = 0.6f)
)
)
)
) )
} }
@@ -1211,7 +1246,7 @@ fun CameraScreen(
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(bottom = 8.dp), .padding(bottom = CameraParameterRulerHeight),
contentAlignment = Alignment.BottomCenter contentAlignment = Alignment.BottomCenter
) { ) {
zoomBar() zoomBar()
@@ -1221,18 +1256,30 @@ fun CameraScreen(
CornerOverlay( CornerOverlay(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
radius = if (isVideoMode) 0.dp else 4.dp, radius = if (isXpan) 4.dp else 0.dp,
color = Color.Black color = Color.Black
) )
CameraParameterValuesOverlay(
state = state,
modifier = Modifier.align(Alignment.TopCenter)
)
if (isPhotoStyleMode) {
parameterRuler(
Modifier
.align(Alignment.BottomCenter)
.onGloballyPositioned { coordinates ->
parameterRulerBounds = coordinates.boundsInRoot()
}
)
}
LutNameOverlay( LutNameOverlay(
state = lutNameOverlayState, state = lutNameOverlayState,
modifier = Modifier.align(Alignment.Center), modifier = Modifier.align(Alignment.Center),
) )
} }
if (isPhotoStyleMode) {
parameterRuler()
}
} }
if (isXpan) { if (isXpan) {
@@ -1353,7 +1400,7 @@ fun CameraScreen(
Column(horizontalAlignment = Alignment.CenterHorizontally) { Column(horizontalAlignment = Alignment.CenterHorizontally) {
zoomBar() zoomBar()
AnimatedVisibility(visible = showVideoParameterRuler) { AnimatedVisibility(visible = showVideoParameterRuler) {
parameterRuler() parameterRuler(Modifier)
} }
parameterBar { param -> parameterBar { param ->
val wasSelected = selectedParameter == param val wasSelected = selectedParameter == param
@@ -1933,19 +1980,20 @@ fun Controls(
) )
} }
} else { } else {
IconButton( PhysicalButton(
onClick = onSwitchCameraClick, onClick = onSwitchCameraClick,
modifier = Modifier modifier = Modifier
.align(Alignment.CenterEnd) .align(Alignment.CenterEnd)
.padding(end = 40.dp) .padding(end = 40.dp)
.size(48.dp) .size(48.dp)
.autoRotate() .autoRotate(),
shape = CircleShape
) { ) {
Icon( Icon(
imageVector = AppIcons.Cameraswitch, imageVector = AppIcons.Cameraswitch,
contentDescription = stringResource(R.string.switch_camera), contentDescription = stringResource(R.string.switch_camera),
tint = Color.White, tint = Color.White,
modifier = Modifier.size(32.dp) modifier = Modifier.size(24.dp)
) )
} }
} }
@@ -1981,9 +2029,10 @@ fun CaptureButton(
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
val infiniteTransition = rememberInfiniteTransition(label = "infinite transition") val infiniteTransition = rememberInfiniteTransition(label = "infinite transition")
var isPressed by remember { mutableStateOf(false) }
val scale by animateFloatAsState( val scale by animateFloatAsState(
targetValue = if (isCapturing || isVideoRecording) 0.95f else 1f, targetValue = if (isPressed || isCapturing || isVideoRecording) 0.95f else 1f,
animationSpec = spring(dampingRatio = 0.5f), animationSpec = spring(dampingRatio = 0.5f),
label = "captureScale" label = "captureScale"
) )
@@ -2007,7 +2056,7 @@ fun CaptureButton(
val currentDisabled by rememberUpdatedState(isCapturing || (captureMode == CaptureMode.VIDEO && isVideoRecording)) val currentDisabled by rememberUpdatedState(isCapturing || (captureMode == CaptureMode.VIDEO && isVideoRecording))
Box( PhysicalButton(
modifier = modifier modifier = modifier
.size(72.dp) .size(72.dp)
.scale(scale) .scale(scale)
@@ -2028,10 +2077,12 @@ fun CaptureButton(
} }
} else null, } else null,
onPress = { onPress = {
isPressed = true
isLongPressStarted = false isLongPressStarted = false
try { try {
tryAwaitRelease() tryAwaitRelease()
} finally { } finally {
isPressed = false
if (isLongPressStarted) { if (isLongPressStarted) {
onLongPressEnd() onLongPressEnd()
} }
@@ -2039,6 +2090,8 @@ fun CaptureButton(
} }
) )
}, },
shape = CircleShape,
outerBorderWidth = 3.dp,
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
if (multipleExposureEnabled) { if (multipleExposureEnabled) {
@@ -2063,18 +2116,15 @@ fun CaptureButton(
if (isPaused) Color.White.copy(alpha = 0.8f) if (isPaused) Color.White.copy(alpha = 0.8f)
else Color.Red.copy(alpha = pulseAlpha) else Color.Red.copy(alpha = pulseAlpha)
} }
captureMode == CaptureMode.VIDEO -> Color.White.copy(alpha = 0.8f) captureMode == CaptureMode.VIDEO -> Color.White.copy(alpha = 0.32f)
multipleExposureEnabled -> Color.White.copy(alpha = 0.55f) else -> Color.Transparent
else -> Color(0xFFFFD700)
} }
val ringWidth = if (multipleExposureEnabled) 1.dp else 2.dp
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.border( .border(
width = ringWidth, width = 1.dp,
color = ringColor, color = ringColor,
shape = CircleShape shape = CircleShape
) )
@@ -2096,9 +2146,9 @@ fun CaptureButton(
} }
} }
// Center Solid Button // Center shutter surface
val centerPadding by animateDpAsState( val centerPadding by animateDpAsState(
targetValue = if (captureMode == CaptureMode.VIDEO && isVideoRecording) 24.dp else 6.dp, targetValue = if (captureMode == CaptureMode.VIDEO && isVideoRecording) 19.dp else 2.dp,
animationSpec = spring(dampingRatio = 0.7f, stiffness = Spring.StiffnessLow), animationSpec = spring(dampingRatio = 0.7f, stiffness = Spring.StiffnessLow),
label = "centerPadding" label = "centerPadding"
) )
@@ -2106,14 +2156,28 @@ fun CaptureButton(
targetValue = if (captureMode == CaptureMode.VIDEO && isVideoRecording) 8.dp else 36.dp, targetValue = if (captureMode == CaptureMode.VIDEO && isVideoRecording) 8.dp else 36.dp,
label = "centerCorner" label = "centerCorner"
) )
val centerColor = if (captureMode == CaptureMode.VIDEO) Color(0xFFFF4D4F) else Color.White val centerBrush = if (captureMode == CaptureMode.VIDEO) {
Brush.verticalGradient(
colors = listOf(
Color(0xFFFF6668),
Color(0xFFE4383C)
)
)
} else {
Brush.verticalGradient(
colors = listOf(
Color.White,
Color(0xFFD7D7D7)
)
)
}
Box( Box(
modifier = Modifier modifier = Modifier
.padding(centerPadding) .padding(centerPadding)
.fillMaxSize() .fillMaxSize()
.clip(RoundedCornerShape(centerCorner)) .clip(RoundedCornerShape(centerCorner))
.background(centerColor) .background(centerBrush)
) )
} }
} }
@@ -43,6 +43,8 @@ enum class CameraParameter {
WHITE_BALANCE // AWB WHITE_BALANCE // AWB
} }
internal val CameraParameterRulerHeight = 40.dp
/** /**
* Parameter ruler component for adjusting camera parameters * Parameter ruler component for adjusting camera parameters
*/ */
@@ -81,7 +83,7 @@ fun ParameterRuler(
Box( Box(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.height(48.dp) .height(CameraParameterRulerHeight)
.padding(horizontal = 8.dp) .padding(horizontal = 8.dp)
) { ) {
Row( Row(
@@ -249,7 +251,7 @@ private fun RulerScale(
val yellow = Color(0xFFFFD700) val yellow = Color(0xFFFFD700)
val textMeasurer = rememberTextMeasurer() val textMeasurer = rememberTextMeasurer()
Canvas(modifier = Modifier.fillMaxSize().padding(vertical = 8.dp)) { Canvas(modifier = Modifier.fillMaxSize().padding(vertical = 4.dp)) {
val width = size.width val width = size.width
val height = size.height val height = size.height
val stepCount = scaleValues.size val stepCount = scaleValues.size
@@ -7,8 +7,6 @@ import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.gestures.detectHorizontalDragGestures import androidx.compose.foundation.gestures.detectHorizontalDragGestures
import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@@ -236,8 +234,8 @@ fun ZoomControlBar(
Icon( Icon(
imageVector = AppIcons.SwapHoriz, imageVector = AppIcons.SwapHoriz,
contentDescription = stringResource(R.string.toggle_display_mode), contentDescription = stringResource(R.string.toggle_display_mode),
modifier = Modifier.size(32.dp) modifier = Modifier
.background(Color.Black.copy(alpha = 0.3f), CircleShape) .size(32.dp)
.padding(8.dp), .padding(8.dp),
tint = Color.White tint = Color.White
) )
@@ -258,8 +256,8 @@ fun ZoomControlBar(
Icon( Icon(
imageVector = AppIcons.AutoAwesome, imageVector = AppIcons.AutoAwesome,
contentDescription = stringResource(R.string.filters_panel), contentDescription = stringResource(R.string.filters_panel),
modifier = Modifier.size(32.dp) modifier = Modifier
.background(Color.Black.copy(alpha = 0.3f), CircleShape) .size(32.dp)
.padding(8.dp), .padding(8.dp),
tint = Color.Yellow tint = Color.Yellow
) )
@@ -373,8 +371,7 @@ private fun ZoomRuler(
Row( Row(
modifier = Modifier modifier = Modifier
.width(adaptiveMetrics.rulerLength) .width(adaptiveMetrics.rulerLength)
.fillMaxHeight() .fillMaxHeight(),
.background(Color.Black.copy(alpha = 0.3f), RoundedCornerShape(16.dp)),
horizontalArrangement = Arrangement.spacedBy(adaptiveMetrics.spacing, Alignment.CenterHorizontally), horizontalArrangement = Arrangement.spacedBy(adaptiveMetrics.spacing, Alignment.CenterHorizontally),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
@@ -504,10 +501,7 @@ fun ZoomContinuousRuler(
val yellow = Color(0xFFFFD700) val yellow = Color(0xFFFFD700)
val textMeasurer = rememberTextMeasurer() val textMeasurer = rememberTextMeasurer()
Box( Box(modifier = modifier) {
modifier = modifier
.background(Color.Black.copy(alpha = 0.3f), RoundedCornerShape(16.dp))
) {
Canvas(modifier = Modifier.fillMaxSize().padding(horizontal = 24.dp, vertical = 4.dp)) { Canvas(modifier = Modifier.fillMaxSize().padding(horizontal = 24.dp, vertical = 4.dp)) {
val width = size.width val width = size.width
val height = size.height val height = size.height
@@ -1,8 +1,6 @@
package com.hinnka.mycamera.ui.components package com.hinnka.mycamera.ui.components
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
@@ -11,9 +9,8 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.PlayArrow import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier 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.Color
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
@@ -38,14 +35,11 @@ fun GalleryThumbnail(
val context = LocalContext.current val context = LocalContext.current
val refreshKey = latestPhoto?.id?.let { viewModel.getPreparedPhotoThumbnailRefreshKey(it) } ?: 0L val refreshKey = latestPhoto?.id?.let { viewModel.getPreparedPhotoThumbnailRefreshKey(it) } ?: 0L
Box( PhysicalButton(
modifier = modifier modifier = modifier
.size(48.dp) .size(48.dp),
.clip(RoundedCornerShape(8.dp)) onClick = onClick,
.background(Color.Black.copy(alpha = 0.5f)) shape = RoundedCornerShape(10.dp)
.border(2.dp, Color.White.copy(alpha = 0.3f), RoundedCornerShape(8.dp))
.clickable { onClick() },
contentAlignment = Alignment.Center
) { ) {
if (latestPhoto != null) { if (latestPhoto != null) {
AsyncImage( AsyncImage(
@@ -68,6 +62,19 @@ fun GalleryThumbnail(
modifier = Modifier.size(20.dp) modifier = Modifier.size(20.dp)
) )
} }
Box(
modifier = Modifier
.fillMaxSize()
.background(
Brush.verticalGradient(
colors = listOf(
Color.White.copy(alpha = 0.08f),
Color.Transparent,
Color.Black.copy(alpha = 0.14f)
)
)
)
)
} else { } else {
// 没有照片时显示图标 // 没有照片时显示图标
Icon( Icon(
@@ -0,0 +1,185 @@
package com.hinnka.mycamera.ui.components
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
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.LinearGradientShader
import androidx.compose.ui.graphics.Shader
import androidx.compose.ui.graphics.ShaderBrush
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.hinnka.mycamera.utils.OrientationObserver
import kotlin.math.abs
import kotlin.math.cos
import kotlin.math.sin
internal fun physicalTopDirection(orientationDegrees: Float): Offset {
val radians = Math.toRadians(orientationDegrees.toDouble())
return Offset(
x = -sin(radians).toFloat(),
y = -cos(radians).toFloat()
)
}
private class PhysicalButtonHighlightBrush(
enabled: Boolean,
private val orientationDegrees: Float
) : ShaderBrush() {
private val strength = if (enabled) 1f else 0.45f
private val colors = listOf(
Color.White.copy(alpha = 0.52f * strength),
Color.White.copy(alpha = 0.18f * strength),
Color.Black.copy(alpha = 0.24f * strength),
Color.Black.copy(alpha = 0.48f * strength)
)
private val colorStops = listOf(0f, 0.28f, 0.68f, 1f)
override fun createShader(size: Size): Shader {
val brightDirection = physicalTopDirection(orientationDegrees)
val halfGradientLength = (
abs(brightDirection.x) * size.width +
abs(brightDirection.y) * size.height
) * 0.5f
val center = Offset(size.width * 0.5f, size.height * 0.5f)
val extent = halfGradientLength.coerceAtLeast(1f)
val start = Offset(
x = center.x + brightDirection.x * extent,
y = center.y + brightDirection.y * extent
)
val end = Offset(
x = center.x - brightDirection.x * extent,
y = center.y - brightDirection.y * extent
)
return LinearGradientShader(
from = start,
to = end,
colors = colors,
colorStops = colorStops
)
}
}
object PhysicalButtonDefaults {
val OuterBorderColor = Color(0xFF030303)
fun highlightBrush(
enabled: Boolean = true,
orientationDegrees: Float = 0f
): Brush {
return PhysicalButtonHighlightBrush(enabled, orientationDegrees)
}
fun backgroundBrush(enabled: Boolean = true): Brush {
return if (enabled) {
Brush.verticalGradient(
colors = listOf(
Color(0xFF17181A),
Color(0xFF202124),
Color(0xFF2B2C2F),
)
)
} else {
Brush.verticalGradient(
colors = listOf(
Color(0xFF141517),
Color(0xFF191A1C),
Color(0xFF202124),
)
)
}
}
}
/**
* 模拟实体相机按键的通用表面。
*
* 从外向内依次绘制黑色间隙、跟随设备姿态的渐变高光细边和轻微纵向渐变的按键面。
*/
@Composable
fun PhysicalButton(
modifier: Modifier = Modifier,
onClick: (() -> Unit)? = null,
enabled: Boolean = true,
shape: Shape = CircleShape,
outerBorderWidth: Dp = 2.dp,
highlightBorderWidth: Dp = 1.dp,
backgroundBrush: Brush = PhysicalButtonDefaults.backgroundBrush(enabled),
contentAlignment: Alignment = Alignment.Center,
content: @Composable BoxScope.() -> Unit
) {
val orientationDegrees = OrientationObserver.continuousOrientationDegrees
val highlightBrush = remember(enabled, orientationDegrees) {
PhysicalButtonDefaults.highlightBrush(enabled, orientationDegrees)
}
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
val pressScale by animateFloatAsState(
targetValue = if (isPressed) 0.97f else 1f,
animationSpec = spring(dampingRatio = 0.72f, stiffness = 700f),
label = "physicalButtonPress"
)
val clickModifier = if (onClick != null) {
Modifier.clickable(
interactionSource = interactionSource,
indication = null,
enabled = enabled,
role = Role.Button,
onClick = onClick
)
} else {
Modifier
}
Box(
modifier = modifier
.graphicsLayer {
scaleX = pressScale
scaleY = pressScale
}
.clip(shape)
.background(backgroundBrush)
.border(
width = outerBorderWidth,
color = PhysicalButtonDefaults.OuterBorderColor,
shape = shape
)
.border(
width = outerBorderWidth + highlightBorderWidth,
brush = highlightBrush,
shape = shape
)
.then(clickModifier),
contentAlignment = Alignment.Center
) {
Box(
modifier = Modifier
.fillMaxSize()
.padding(outerBorderWidth + highlightBorderWidth)
.clip(shape),
contentAlignment = contentAlignment,
content = content
)
}
}
@@ -7,6 +7,7 @@ import android.hardware.SensorEventListener
import android.hardware.SensorManager import android.hardware.SensorManager
import android.view.OrientationEventListener import android.view.OrientationEventListener
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import kotlin.math.abs import kotlin.math.abs
@@ -28,6 +29,11 @@ object OrientationObserver {
var rotationDegrees by mutableStateOf(0f) var rotationDegrees by mutableStateOf(0f)
private set private set
// 连续的设备姿态传感器角,用于材质高光等不应按横竖屏档位跳变的视觉效果。
// 消费方负责将传感器的顺时针角度转换到自己的屏幕坐标系。
var continuousOrientationDegrees by mutableFloatStateOf(0f)
private set
// 存储拍摄方向,包含反向竖屏,用于照片保存/处理 // 存储拍摄方向,包含反向竖屏,用于照片保存/处理
var captureRotationDegrees by mutableStateOf(0f) var captureRotationDegrees by mutableStateOf(0f)
private set private set
@@ -42,6 +48,8 @@ object OrientationObserver {
return return
} }
continuousOrientationDegrees = orientation.toFloat()
// 右侧朝上(手机顺时针旋转90°) // 右侧朝上(手机顺时针旋转90°)
when (orientation) { when (orientation) {
in 45..135 -> { in 45..135 -> {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 KiB

After

Width:  |  Height:  |  Size: 460 KiB

@@ -0,0 +1,30 @@
package com.hinnka.mycamera.ui.components
import org.junit.Assert.assertEquals
import org.junit.Test
class PhysicalButtonHighlightDirectionTest {
@Test
fun `physical top follows continuous device orientation`() {
assertDirection(orientationDegrees = 0f, expectedX = 0f, expectedY = -1f)
assertDirection(orientationDegrees = 90f, expectedX = -1f, expectedY = 0f)
assertDirection(orientationDegrees = 180f, expectedX = 0f, expectedY = 1f)
assertDirection(orientationDegrees = 270f, expectedX = 1f, expectedY = 0f)
assertDirection(
orientationDegrees = 45f,
expectedX = -0.70710677f,
expectedY = -0.70710677f
)
}
private fun assertDirection(
orientationDegrees: Float,
expectedX: Float,
expectedY: Float
) {
val direction = physicalTopDirection(orientationDegrees)
assertEquals(expectedX, direction.x, 0.000001f)
assertEquals(expectedY, direction.y, 0.000001f)
}
}
+260
View File
@@ -0,0 +1,260 @@
#!/usr/bin/env python3
"""Generate the camera UI's matte graphite background texture."""
from __future__ import annotations
import argparse
import math
from dataclasses import dataclass
from pathlib import Path
import numpy as np
from PIL import Image, ImageFilter
PROJECT_ROOT = Path(__file__).resolve().parents[1]
DEFAULT_OUTPUT = (
PROJECT_ROOT / "app/src/main/res/drawable-nodpi/camera_bg.jpg"
)
REFERENCE_TEXTURE_SPACING_PX = 6.0
@dataclass(frozen=True)
class CameraBackgroundStyle:
"""Parameters expressed in output-image pixel and RGB-value units."""
base_color: tuple[int, int, int] = (44, 45, 47)
vertical_shading: float = 1.4
macro_strength: float = 0.7
macro_scale: float = 190.0
texture_strength: float = 0.85
texture_density: float = 0.42
texture_softness: float = 1.8
vignette_strength: float = 1.1
DEFAULT_STYLE = CameraBackgroundStyle()
def parse_hex_color(value: str) -> tuple[int, int, int]:
value = value.removeprefix("#")
if len(value) != 6:
raise argparse.ArgumentTypeError("颜色必须使用 #RRGGBB 格式")
try:
return tuple(int(value[index : index + 2], 16) for index in (0, 2, 4))
except ValueError as error:
raise argparse.ArgumentTypeError("颜色必须使用 #RRGGBB 格式") from error
def normalized(array: np.ndarray) -> np.ndarray:
array = array.astype(np.float32, copy=False)
array -= float(array.mean())
rms = float(np.sqrt(np.mean(np.square(array))))
if rms > 1e-6:
array /= rms
return array
def resized_noise(
width: int,
height: int,
*,
spacing: float,
rng: np.random.Generator,
) -> Image.Image:
"""Create smoothly interpolated noise with a controllable feature spacing."""
grid_width = max(3, math.ceil(width / spacing) + 2)
grid_height = max(3, math.ceil(height / spacing) + 2)
samples = rng.normal(127.5, 34.0, (grid_height, grid_width))
samples = np.clip(samples, 0.0, 255.0).astype(np.uint8)
return Image.fromarray(samples, mode="L").resize(
(width, height),
resample=Image.Resampling.BICUBIC,
)
def generate_background(
width: int,
height: int,
*,
seed: int,
style: CameraBackgroundStyle,
) -> Image.Image:
rng = np.random.default_rng(seed)
macro_image = resized_noise(
width,
height,
spacing=style.macro_scale,
rng=rng,
).filter(ImageFilter.GaussianBlur(radius=style.macro_scale * 0.12))
macro = normalized(np.asarray(macro_image, dtype=np.float32))
texture_spacing = REFERENCE_TEXTURE_SPACING_PX / style.texture_density
texture_image = resized_noise(
width,
height,
spacing=texture_spacing,
rng=rng,
)
texture_soft = texture_image.filter(
ImageFilter.GaussianBlur(radius=style.texture_softness)
)
texture = normalized(
np.asarray(texture_image, dtype=np.float32)
- np.asarray(texture_soft, dtype=np.float32)
)
vertical = np.linspace(
style.vertical_shading * 0.5,
-style.vertical_shading * 0.5,
height,
dtype=np.float32,
)[:, None]
x = np.linspace(-1.0, 1.0, width, dtype=np.float32)[None, :]
y = np.linspace(-1.0, 1.0, height, dtype=np.float32)[:, None]
distance = np.clip((np.square(x) + np.square(y)) * 0.5, 0.0, 1.0)
vignette = -style.vignette_strength * np.power(distance, 1.6)
luminance_offset = (
vertical
+ vignette
+ macro * style.macro_strength
+ texture * style.texture_strength
)
base = np.asarray(style.base_color, dtype=np.float32)
pixels = base[None, None, :] + luminance_offset[:, :, None]
pixels = np.clip(np.rint(pixels), 0.0, 255.0).astype(np.uint8)
return Image.fromarray(pixels, mode="RGB")
def positive_float(value: str) -> float:
parsed = float(value)
if parsed <= 0.0:
raise argparse.ArgumentTypeError("数值必须大于 0")
return parsed
def non_negative_float(value: str) -> float:
parsed = float(value)
if parsed < 0.0:
raise argparse.ArgumentTypeError("数值不能小于 0")
return parsed
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description="生成可调参数的相机机身深色纹理背景。",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
epilog=(
"示例:uv run --project scripts "
"scripts/generate_camera_background.py "
"--texture-strength 0.65 --texture-density 0.35"
),
)
parser.add_argument("--output", type=Path, default=DEFAULT_OUTPUT)
parser.add_argument("--width", type=int, default=1170)
parser.add_argument("--height", type=int, default=2532)
parser.add_argument("--seed", type=int, default=20260727)
parser.add_argument(
"--base-color",
type=parse_hex_color,
default=DEFAULT_STYLE.base_color,
metavar="#RRGGBB",
)
parser.add_argument(
"--vertical-shading",
type=non_negative_float,
default=DEFAULT_STYLE.vertical_shading,
help="顶部至底部的明暗差,数值越大底部越暗",
)
parser.add_argument(
"--macro-strength",
type=non_negative_float,
default=DEFAULT_STYLE.macro_strength,
help="大范围材质明暗变化强度",
)
parser.add_argument(
"--macro-scale",
type=positive_float,
default=DEFAULT_STYLE.macro_scale,
help="大范围材质变化尺度(像素)",
)
parser.add_argument(
"--texture-strength",
type=non_negative_float,
default=DEFAULT_STYLE.texture_strength,
help="细纹理对比度;降低可让纹理更隐约",
)
parser.add_argument(
"--texture-density",
type=positive_float,
default=DEFAULT_STYLE.texture_density,
help="细纹理相对密度;降低可让纹理更疏",
)
parser.add_argument(
"--texture-softness",
type=positive_float,
default=DEFAULT_STYLE.texture_softness,
help="细纹理柔化半径(像素);提高可减少锐利颗粒",
)
parser.add_argument(
"--vignette-strength",
type=non_negative_float,
default=DEFAULT_STYLE.vignette_strength,
help="边缘暗角强度",
)
parser.add_argument("--quality", type=int, default=90, help="JPEG 质量")
return parser
def main() -> None:
parser = build_parser()
args = parser.parse_args()
if args.width <= 0 or args.height <= 0:
parser.error("宽度和高度必须大于 0")
if not 1 <= args.quality <= 100:
parser.error("JPEG 质量必须在 1 到 100 之间")
style = CameraBackgroundStyle(
base_color=args.base_color,
vertical_shading=args.vertical_shading,
macro_strength=args.macro_strength,
macro_scale=args.macro_scale,
texture_strength=args.texture_strength,
texture_density=args.texture_density,
texture_softness=args.texture_softness,
vignette_strength=args.vignette_strength,
)
image = generate_background(
args.width,
args.height,
seed=args.seed,
style=style,
)
output = args.output.expanduser().resolve()
output.parent.mkdir(parents=True, exist_ok=True)
image.save(
output,
format="JPEG",
quality=args.quality,
subsampling=0,
optimize=True,
)
print(f"Generated {output} ({args.width}x{args.height}, seed={args.seed})")
print(
"Style: "
f"base=#{args.base_color[0]:02X}{args.base_color[1]:02X}"
f"{args.base_color[2]:02X}, "
f"texture_strength={args.texture_strength}, "
f"texture_density={args.texture_density}, "
f"texture_softness={args.texture_softness}, "
f"macro_strength={args.macro_strength}"
)
if __name__ == "__main__":
main()
+1
View File
@@ -8,6 +8,7 @@ dependencies = [
"beautifulsoup4>=4.14.3", "beautifulsoup4>=4.14.3",
"colour-science>=0.4.7", "colour-science>=0.4.7",
"numpy>=2.4.2", "numpy>=2.4.2",
"pillow>=11.0.0",
"rawpy>=0.27.0", "rawpy>=0.27.0",
"requests>=2.34.2", "requests>=2.34.2",
] ]
+64
View File
@@ -152,6 +152,68 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/32/0a/2ec5deea6dcd158f254a7b372fb09cfba5719419c8d66343bab35237b3fb/numpy-2.4.2-cp314-cp314t-win_arm64.whl", hash = "sha256:1f92f53998a17265194018d1cc321b2e96e900ca52d54c7c77837b71b9465181", size = 10565379, upload-time = "2026-01-31T23:12:51.345Z" }, { url = "https://files.pythonhosted.org/packages/32/0a/2ec5deea6dcd158f254a7b372fb09cfba5719419c8d66343bab35237b3fb/numpy-2.4.2-cp314-cp314t-win_arm64.whl", hash = "sha256:1f92f53998a17265194018d1cc321b2e96e900ca52d54c7c77837b71b9465181", size = 10565379, upload-time = "2026-01-31T23:12:51.345Z" },
] ]
[[package]]
name = "pillow"
version = "12.3.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/1c/3d/bb7fca845737cf9d7dbde16ed1843984665ff2e0a518f5db43e77ec540b9/pillow-12.3.0.tar.gz", hash = "sha256:3b8182a766685eaa002637e28b4ec8d6b18819a0c71f579bf0dbaa5830297cce", size = 47025035, upload-time = "2026-07-01T11:56:38.965Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/9d/ac/31fb64e1e7efb5a4b50cd3d92049ba89ac6e4d8d3bb6a74e15048ca3353e/pillow-12.3.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:21900ce7ba264168cd50defae43cd75d25c833ad4ad6e73ffc5596d12e25ac89", size = 4161684, upload-time = "2026-07-01T11:54:25.934Z" },
{ url = "https://files.pythonhosted.org/packages/87/b4/9805e23d2b4d77842b468513841fda254ee42f0289d25088340e4ff46e2d/pillow-12.3.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4e8c2a84d977f50b9daed6eeaf3baef67d00d5d74d932288f02cb94518ee3ace", size = 4255487, upload-time = "2026-07-01T11:54:27.935Z" },
{ url = "https://files.pythonhosted.org/packages/df/39/ecf519435a200c693fe053a6ee4d835b41cf963a4dfc2551c4e637cb2a71/pillow-12.3.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:ae26d61dfa7a47befdc7572b521024e8745f3d809bd95ca9505a7bba9ef849ec", size = 3696433, upload-time = "2026-07-01T11:54:29.813Z" },
{ url = "https://files.pythonhosted.org/packages/42/92/2fc3ffad878ae8dd5469ec1bc8eb83b71f48e13efdf68f02709003982a32/pillow-12.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:7a743ff716f746fc19a9557f60dab1600d4613255f8a7aeb3cdde4db7eb15a66", size = 5345889, upload-time = "2026-07-01T11:54:31.97Z" },
{ url = "https://files.pythonhosted.org/packages/10/76/8803c13605b763d33d156c4678fc77f8443389c0c51c8aef707bb02015f4/pillow-12.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:d69141514cc30b774ceea5e3ed3a6635c8d8a96edf664689b890f4089111fb35", size = 4780109, upload-time = "2026-07-01T11:54:34.026Z" },
{ url = "https://files.pythonhosted.org/packages/1f/01/e18aff37cb0b4aac47ac90f016d347a49aca667ef97f190b06ac2aabc928/pillow-12.3.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f7401aebd7f581d7f83a439d87d474999317ee099218e5ad25d125290990ba65", size = 6263736, upload-time = "2026-07-01T11:54:36.131Z" },
{ url = "https://files.pythonhosted.org/packages/f7/62/de5bdd77d935331f4f802edc11e4d82950f642caad6cb2f949837b8560e2/pillow-12.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0847a763afefb695bc912d7c131e7e0632d4edc1d8698f58ddabec8e46b8b6d3", size = 6937129, upload-time = "2026-07-01T11:54:38.216Z" },
{ url = "https://files.pythonhosted.org/packages/70/4d/105627a13300c5e0df1d174230b32fd1273062c96f7745fd552b945d1e1d/pillow-12.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:571b9fcb07b97ef3a492028fb3d2dc0993ca23a06138b0315286566d29ef718a", size = 6339562, upload-time = "2026-07-01T11:54:40.354Z" },
{ url = "https://files.pythonhosted.org/packages/6b/1d/f13de01a553988ab895ba1c722e06cf3144d4f57656fd5b81b6d881f1179/pillow-12.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:756c768d0c9c2955feb7a56c37ea24aea2e369f8d36a88da270b6a9f19e62b5e", size = 7049439, upload-time = "2026-07-01T11:54:42.489Z" },
{ url = "https://files.pythonhosted.org/packages/c9/f9/066794cca041b969964f779ee5fa66a9498bbf34248ac39c5d7954e4198f/pillow-12.3.0-cp313-cp313-win32.whl", hash = "sha256:a876864214e136f0eb367788dbd7df045f4806801518e2cfe9e13229cfe06d8f", size = 6473287, upload-time = "2026-07-01T11:54:44.9Z" },
{ url = "https://files.pythonhosted.org/packages/a6/9b/7a58e61d62be561da3a356fe2384d4059a6345fc130e23ef1c36a5b81d24/pillow-12.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:1cca606cd25738df4ed873d5ad46bbdb3d83b5cbca291f6b4ff13a4df6b0bbe8", size = 7239691, upload-time = "2026-07-01T11:54:47.141Z" },
{ url = "https://files.pythonhosted.org/packages/aa/b0/c4ed4f0ef8f8fa5ee8351537db6650bb8189f7e118842978dd6589065692/pillow-12.3.0-cp313-cp313-win_arm64.whl", hash = "sha256:b629de27fda84b42cde7edef0d85f13b958b47f6e9bbcbba9b673c562a89bd8b", size = 2568185, upload-time = "2026-07-01T11:54:49.137Z" },
{ url = "https://files.pythonhosted.org/packages/dc/01/001f65b68192f0228cc1dbbc8d2530ab5d58b61037ba0587f946fea607cd/pillow-12.3.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:9cf95fe4d0f84c82d282745d9bb08ad9f926efa00be4697e767b814ce40d4330", size = 4161736, upload-time = "2026-07-01T11:54:51.156Z" },
{ url = "https://files.pythonhosted.org/packages/1a/d2/0219746d0fd16fc8a84498e79452375be3797d3ce4044596ce565164b84f/pillow-12.3.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:8728f216dcdb6e6d555cf971cb34076139ad74b31fc2c14da4fafc741c5f6217", size = 4255435, upload-time = "2026-07-01T11:54:53.414Z" },
{ url = "https://files.pythonhosted.org/packages/c8/02/8d0bc62ef0302318c46ff2a512822d2610e81c7aa46c9b3abe6cbaca5ad0/pillow-12.3.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:a45650e8ce7fafffd731db8550230db6b0d306d181a90b67d3e6bca2f1990930", size = 3696262, upload-time = "2026-07-01T11:54:55.739Z" },
{ url = "https://files.pythonhosted.org/packages/85/e2/73c77d218410b14f5f2d565e8a998d5317b7b9c75368d29985139f7a46f0/pillow-12.3.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:ba54cfebe86920a559a7c4d6b9050791c20513650a1952ebe3368c7dc70306f8", size = 5350344, upload-time = "2026-07-01T11:54:57.657Z" },
{ url = "https://files.pythonhosted.org/packages/c7/da/32c752228ae345f489e3a42499d817b6c3996da7e8a3bc7a04fc806b243b/pillow-12.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:e158cb00350dc278f3b91551101aa7d12415a66ebf2c91d8d5ac14e56ddd3ad0", size = 4780131, upload-time = "2026-07-01T11:54:59.713Z" },
{ url = "https://files.pythonhosted.org/packages/b1/9d/8b2c807dbef61a5197c047afe99823787eb66f63daf9fb2432f91d6f0462/pillow-12.3.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e9aeb04d6aef139de265b29683e119b638208f88cf73cdd1658aa07221165321", size = 6263757, upload-time = "2026-07-01T11:55:01.778Z" },
{ url = "https://files.pythonhosted.org/packages/5c/44/c85361f65dbe00eea8576ee467c768d25129989efb76e94f205e9ca9bb46/pillow-12.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:251bf95b67017e27b13d82f5b326234ca62d70f9cf4c2b9032de2358a3b12c7b", size = 6936962, upload-time = "2026-07-01T11:55:03.93Z" },
{ url = "https://files.pythonhosted.org/packages/18/7e/e483414b35800b86b6f08dbbc7803fb5cd52c4d6f897f47d53ea2c7e6f65/pillow-12.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:fe3cca2e4e8a592be0f269a1ca4835c25199d9f3ce815c8491048f785b0a0198", size = 6339171, upload-time = "2026-07-01T11:55:05.989Z" },
{ url = "https://files.pythonhosted.org/packages/f0/f4/68c491844841ede6bed70189546b3ee9731cf9f2cbad396faff5e1ccba45/pillow-12.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:23aceaa007d6172b02c277f0cd359c79492bbb14f7072b4ede9fbcaf20648130", size = 7048116, upload-time = "2026-07-01T11:55:08.131Z" },
{ url = "https://files.pythonhosted.org/packages/a3/34/77f3f793fed8efc7d243f21b33c5a3f0d1c97ee70346d3db855587e155ff/pillow-12.3.0-cp314-cp314-win32.whl", hash = "sha256:af8d94b0db561cf68b88a267c5c44b49e134f525d0dc2cb7ed413a66bc23559a", size = 6467209, upload-time = "2026-07-01T11:55:10.408Z" },
{ url = "https://files.pythonhosted.org/packages/f1/e0/492879f69d94f91f60fc8cd05ba03650e9520afebb2fb7aa12777d7c7f38/pillow-12.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:fdafc9cce40277e0f7a0feabce0ee50dd2fa1800f3b38015e51296b5e814048d", size = 7237707, upload-time = "2026-07-01T11:55:12.745Z" },
{ url = "https://files.pythonhosted.org/packages/c9/ac/6b11f2875f1c2ac040d84e1bbf9cf22a88038f901ca1037898b280b38365/pillow-12.3.0-cp314-cp314-win_arm64.whl", hash = "sha256:e91206ee562682b51b98ef4b26a6ef48fd84e15fd4c4bc5ec768eb641d206838", size = 2565995, upload-time = "2026-07-01T11:55:14.736Z" },
{ url = "https://files.pythonhosted.org/packages/52/69/c2208e56af9bfc1913afb24020297a691eb1d4ef688474c8a04913f65e04/pillow-12.3.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:164b31cd1a0490ab6efae01aa5df49da7061be0af1b30e035b6e9a1bfe34ee6e", size = 5352503, upload-time = "2026-07-01T11:55:17.076Z" },
{ url = "https://files.pythonhosted.org/packages/07/70/e5686d753e898a45d778ff1718dba8516ead6ab6b95d85fc8c4b70650cf2/pillow-12.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5afb51d599ea772b8365ae807ae557f18bccfe46ab261fd1c2a9ed700fc6eb17", size = 4782956, upload-time = "2026-07-01T11:55:19.448Z" },
{ url = "https://files.pythonhosted.org/packages/d5/37/25c6692f06927ee973ff18c8d9ee98ad0b4d84ee67a09610c2dd1447958e/pillow-12.3.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3edce1d53195db527e0191f84b71d02022de0540bf43a16ed734ed7537b07385", size = 6322855, upload-time = "2026-07-01T11:55:21.613Z" },
{ url = "https://files.pythonhosted.org/packages/cc/91/420637fcb8f1bc11029e403b4538e6694744428d8246118e45719f944556/pillow-12.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bf16ba1b4d0b6b7c8e534936632270cf70eb00dbe09005bc345b2677b726855c", size = 6989642, upload-time = "2026-07-01T11:55:24.006Z" },
{ url = "https://files.pythonhosted.org/packages/10/08/b94d7811281ccf0d143a1cf768d1c49e1e54af63e7b708ab2ee3eb87face/pillow-12.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:24870b09b224f7ae3c39ed07d10e819d06f8720bc551847b1d623832b5b0e28d", size = 6391281, upload-time = "2026-07-01T11:55:26.252Z" },
{ url = "https://files.pythonhosted.org/packages/d2/87/24233f785f55474dc02ce3e739c5528a77e3a862e9333d1dd7a25cc31f70/pillow-12.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:30f2aa603c41533cc25c05acd0da21636e84a315768feb631c937177db558931", size = 7096716, upload-time = "2026-07-01T11:55:28.318Z" },
{ url = "https://files.pythonhosted.org/packages/23/26/fcb2f6e37175b04f53570b59937867e2b80ee1685e744023153028fc14f9/pillow-12.3.0-cp314-cp314t-win32.whl", hash = "sha256:4b0a7fe987b14c31ebda6083f74f22b561fd3739bc0ac51e019622e3d72668c7", size = 6474125, upload-time = "2026-07-01T11:55:30.956Z" },
{ url = "https://files.pythonhosted.org/packages/90/de/3634abee5f1c9e13c56787b7d5517b0ba8d6de51700b95578cf338349c9f/pillow-12.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:962864dc93511324d51ddbb5b9f8731bf71675b93ca612a07441896f4688fb8c", size = 7242939, upload-time = "2026-07-01T11:55:34.044Z" },
{ url = "https://files.pythonhosted.org/packages/ce/2a/fd13f8eb24de5714a6eb444a3d67e2842c6c576e159a43793adf23051351/pillow-12.3.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0740a512dc522224c77d9aa5a8d70d8b7d73fb91f2c21125d8d025d3b8990e45", size = 2567506, upload-time = "2026-07-01T11:55:35.988Z" },
{ url = "https://files.pythonhosted.org/packages/5d/dc/8fdce34ec725a33c81c6ba122b904d6b9024e50ea9ac7bede62fab54506c/pillow-12.3.0-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:0feb2e9d6ad6c9e3c06effe9d00f3f1e618a6643273576b016f591e9315a7139", size = 4162063, upload-time = "2026-07-01T11:55:37.941Z" },
{ url = "https://files.pythonhosted.org/packages/76/66/2044b9a63d3b84ff048228dfcb7cd9bf0df983e8470971bf7d4c57b693de/pillow-12.3.0-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:9e881fca225083806662a5c43d627d215f258ff43c890f831966c7d7ba9c7402", size = 4255549, upload-time = "2026-07-01T11:55:40.022Z" },
{ url = "https://files.pythonhosted.org/packages/52/7e/1f67e6f4ece6b582ee4b539decbcc9f848dc245a93ed8cd7338bafef72f1/pillow-12.3.0-cp315-cp315-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:4998562bf62a445225f22e07c896bb04b35b1b1f2eb6d760584c9c51d7a5f78c", size = 3696331, upload-time = "2026-07-01T11:55:41.98Z" },
{ url = "https://files.pythonhosted.org/packages/12/40/d306fc2c8e4d45d7f175c77edca7063be7b86fe7fe6e68f4353bf71d808c/pillow-12.3.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:dc624f6bc473dacdf7ef7eb8678d0d08edf15cd94fad6ae5c7d6cc67a4e4902f", size = 5350370, upload-time = "2026-07-01T11:55:44.028Z" },
{ url = "https://files.pythonhosted.org/packages/dd/44/668fb1437e8ce420f62d6106eb66e44a5971602a4d794615bdf79315d82d/pillow-12.3.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:71d6097b330eea8fd15097780c8e89cb1a8ce7838669f48c5bacd6f663dd4701", size = 4780147, upload-time = "2026-07-01T11:55:46.073Z" },
{ url = "https://files.pythonhosted.org/packages/0c/08/93fa2e70e30a2d81547e481b6ee2bb9522117221fb1e0ce4b5df70967677/pillow-12.3.0-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:28ce87c5ab450a9dd970b52e5aca5fe63ed432d18a2eaddd1979a00a1ba24ace", size = 6273659, upload-time = "2026-07-01T11:55:48.264Z" },
{ url = "https://files.pythonhosted.org/packages/f8/6d/043e96ff814fc31a33077e4cba86082167db520c93632afdf2042febbb0c/pillow-12.3.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6b02afb9b97f65fbca5f31db6a2a3ba21aa93030225f150fa3f249717e938fb4", size = 6947439, upload-time = "2026-07-01T11:55:50.503Z" },
{ url = "https://files.pythonhosted.org/packages/af/92/ba71d2ee2ac0edf3fa33bd9d5ee9ee080da70b1766f3ca3934f9938ddac9/pillow-12.3.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:1182d52bc2d5e5d7d0949503aa7e36d12f42205dc287e4883f407b1988820d39", size = 6353577, upload-time = "2026-07-01T11:55:52.697Z" },
{ url = "https://files.pythonhosted.org/packages/0f/ce/e63064e2122923ff687c8ad792d0d736a7b3920a56a46982e81a7fdd25d6/pillow-12.3.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:e795b7eb908249c4e43c7c99fac7c2c75dab0c43566e37db472a355f63693d71", size = 7060394, upload-time = "2026-07-01T11:55:55.149Z" },
{ url = "https://files.pythonhosted.org/packages/54/76/a09cc3ccc8d773a7283d34c38bec1708f9e3cc932093cbc4c5e71ac4060b/pillow-12.3.0-cp315-cp315-win32.whl", hash = "sha256:57b3d78c95ba9059768b10e28b813002261d3f3dfc55cc48b0c988f625175827", size = 6467375, upload-time = "2026-07-01T11:55:57.769Z" },
{ url = "https://files.pythonhosted.org/packages/3e/03/1846c49ba3b1d5550392a4bbd06d6fb4578e1cd91a803198b5c90f5f7d53/pillow-12.3.0-cp315-cp315-win_amd64.whl", hash = "sha256:fa4ecea169a355be7a3ade2c783e2ed12f0e40d2c5621cda8b3297faf7fbb9f5", size = 7237048, upload-time = "2026-07-01T11:55:59.975Z" },
{ url = "https://files.pythonhosted.org/packages/fb/bb/89f35dcc79610423f9f195504d7def7f0d1416a711541b42867e25fe3412/pillow-12.3.0-cp315-cp315-win_arm64.whl", hash = "sha256:877c3f311ff35410f690861c4409e7ccbf0cd2f878e50628a28e5a0bb689e658", size = 2566006, upload-time = "2026-07-01T11:56:02.143Z" },
{ url = "https://files.pythonhosted.org/packages/30/88/707027ba09942dfa2c28759b5c222d769290a41c6d20ea60ec250801941f/pillow-12.3.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:e9871b1ffbfa9656b60aeee92ed5136a5742696006fa322b29ea3d8da0ecc9cf", size = 5352509, upload-time = "2026-07-01T11:56:04.2Z" },
{ url = "https://files.pythonhosted.org/packages/b0/6d/00352fa25332c2569cd387851f568cc5a4b75a9adbfb37ac4fbce4c02eec/pillow-12.3.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:53aa02d20d10c3d814d536aa4e5ac9b84ca0ff5a88377963b085ad6822f93e64", size = 4783167, upload-time = "2026-07-01T11:56:06.631Z" },
{ url = "https://files.pythonhosted.org/packages/13/4f/9e049dfa21af7c22427275720e2490267ba8138120add5c4c574deb69782/pillow-12.3.0-cp315-cp315t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:446c34dcc4324b084a53b705127dc15717b22c5e140ae0a3c38349d4efec071e", size = 6329237, upload-time = "2026-07-01T11:56:08.868Z" },
{ url = "https://files.pythonhosted.org/packages/36/16/cf6eeaae8d0fce8dd390a33437cf68c5d5bd73834a2bc6e2f14efda0ab45/pillow-12.3.0-cp315-cp315t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cf1845d02ad822a369a49f2bb9345b1614744267682e7a03527dc3bf6eea1777", size = 6997047, upload-time = "2026-07-01T11:56:11.379Z" },
{ url = "https://files.pythonhosted.org/packages/1e/69/dbf769bdd55f48bf5733cac28edc6364ffaa072ec9ba336266e4fe66be55/pillow-12.3.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:186941b6aef820ad110fb01fb06eb925374dc3a21b17e37ec9a53b250c6fe2d1", size = 6400440, upload-time = "2026-07-01T11:56:13.908Z" },
{ url = "https://files.pythonhosted.org/packages/a0/e1/ffc9cfc2eea0d178da8018e18e959301ad9d6bc9f3edb7181e748a474b97/pillow-12.3.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:f13c32a3abd6079a66d9526e18dad9b6d280384d49d7c54040cd57b6424041d9", size = 7105895, upload-time = "2026-07-01T11:56:16.575Z" },
{ url = "https://files.pythonhosted.org/packages/18/f0/a5595c1e8c3ae44b9828cb2f0fa8155e5095ef04d6327b8f61cf44a3df85/pillow-12.3.0-cp315-cp315t-win32.whl", hash = "sha256:1657923d2d45afb66526e5b933e5b3052e6bdea196c90d3abb2424e18c77dae8", size = 6474384, upload-time = "2026-07-01T11:56:18.855Z" },
{ url = "https://files.pythonhosted.org/packages/e4/04/62bcd9f844984c5938d3b05264a61d797a29d3e0812341a8204af70bbdee/pillow-12.3.0-cp315-cp315t-win_amd64.whl", hash = "sha256:8cd2f7bdda092d99c9fc2fb7391354f306d01443d22785d0cbfafa2e2c8bb418", size = 7243537, upload-time = "2026-07-01T11:56:21.214Z" },
{ url = "https://files.pythonhosted.org/packages/3d/68/1f3066acedf37673694a7141381d8f811ae97f30d34413d236abe7d489f1/pillow-12.3.0-cp315-cp315t-win_arm64.whl", hash = "sha256:06ff022112bc9cbf83b60f8e028d94ad87b60621706487e65f673de61610ab59", size = 2567491, upload-time = "2026-07-01T11:56:23.506Z" },
]
[[package]] [[package]]
name = "rawpy" name = "rawpy"
version = "0.27.0" version = "0.27.0"
@@ -194,6 +256,7 @@ dependencies = [
{ name = "beautifulsoup4" }, { name = "beautifulsoup4" },
{ name = "colour-science" }, { name = "colour-science" },
{ name = "numpy" }, { name = "numpy" },
{ name = "pillow" },
{ name = "rawpy" }, { name = "rawpy" },
{ name = "requests" }, { name = "requests" },
] ]
@@ -203,6 +266,7 @@ requires-dist = [
{ name = "beautifulsoup4", specifier = ">=4.14.3" }, { name = "beautifulsoup4", specifier = ">=4.14.3" },
{ name = "colour-science", specifier = ">=0.4.7" }, { name = "colour-science", specifier = ">=0.4.7" },
{ name = "numpy", specifier = ">=2.4.2" }, { name = "numpy", specifier = ">=2.4.2" },
{ name = "pillow", specifier = ">=11.0.0" },
{ name = "rawpy", specifier = ">=0.27.0" }, { name = "rawpy", specifier = ">=0.27.0" },
{ name = "requests", specifier = ">=2.34.2" }, { name = "requests", specifier = ">=2.34.2" },
] ]