saket / telephoto

Building blocks for designing media experiences in Compose UI
https://saket.github.io/telephoto/
Apache License 2.0
869 stars 28 forks source link

FR: Expose APIs to apply elevation and shape to the internal `AsyncImage` in `ZoomableAsyncImage` #42

Open ZacSweers opened 10 months ago

ZacSweers commented 10 months ago

Currently it's not possible to apply shape clips or elevation to the internal AsyncImage as the modifier on ZoomableAsyncImage() applies them to the whole layout

ZacSweers commented 10 months ago

another thing I'd like to do is use the blur() modifier, but that needs to apply on the image itself as well

saket commented 5 months ago

I'm going to partially address this using 0347c53. It's a low level API for observing content bounds that can be used for drawing decorations around the content. Here's an example test that draws a border around the content (screenshot). I haven't tried it out, but you should also be able to apply clipping and draw drop shadows. I'll probably add a Modifier.clipToZoomableBounds(zoomableState) to make this easier.

another thing I'd like to do is use the blur() modifier, but that needs to apply on the image itself as well

This should already be possible! Does it not work for you?

ZoomableAsyncImage(
  modifier = Modifier
    .fillMaxSize()
    .blur(20.dp),
  …
)

Screenshot_1706076894