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:
Ole-Morten Duesund 2026-03-05 12:51:26 +01:00
commit 12051b2a83
3 changed files with 77 additions and 7 deletions

View file

@ -327,6 +327,15 @@ class ImageCaptureHandler(
return rotated
}
/**
* Applies tilt-shift effect to a bitmap for real-time preview.
* Runs on [Dispatchers.IO]. The caller owns the returned bitmap.
*/
suspend fun applyTiltShiftPreview(source: Bitmap, params: BlurParameters): Bitmap =
withContext(Dispatchers.IO) {
applyTiltShiftEffect(source, params)
}
/**
* Applies tilt-shift blur effect to a bitmap.
* Supports both linear and radial modes.