Add real-time tilt-shift preview for gallery images
Gallery imports now show the effect live as you adjust parameters, matching the camera preview experience. Uses a downscaled (1024px) source bitmap for fast recomputation via collectLatest, which cancels stale frames when params change mid-computation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dedf445cf6
commit
12051b2a83
3 changed files with 77 additions and 7 deletions
|
|
@ -106,8 +106,8 @@ fun CameraScreen(
|
|||
val showControls by viewModel.showControls.collectAsState()
|
||||
val lastSavedUri by viewModel.lastSavedUri.collectAsState()
|
||||
val lastThumbnailBitmap by viewModel.lastThumbnailBitmap.collectAsState()
|
||||
val galleryBitmap by viewModel.galleryBitmap.collectAsState()
|
||||
val isGalleryPreview = galleryBitmap != null
|
||||
val galleryPreviewBitmap by viewModel.galleryPreviewBitmap.collectAsState()
|
||||
val isGalleryPreview = galleryPreviewBitmap != null
|
||||
|
||||
val zoomRatio by viewModel.cameraManager.zoomRatio.collectAsState()
|
||||
val minZoom by viewModel.cameraManager.minZoomRatio.collectAsState()
|
||||
|
|
@ -179,10 +179,10 @@ fun CameraScreen(
|
|||
) {
|
||||
// Main view: gallery preview image or camera GL surface
|
||||
if (isGalleryPreview) {
|
||||
galleryBitmap?.let { bmp ->
|
||||
galleryPreviewBitmap?.let { bmp ->
|
||||
Image(
|
||||
bitmap = bmp.asImageBitmap(),
|
||||
contentDescription = "Gallery image preview. Adjust tilt-shift parameters then tap Apply.",
|
||||
contentDescription = "Gallery image preview with tilt-shift effect. Adjust parameters then tap Apply.",
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue