This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Immutable | |
| public data class ZoomablePlugin( | |
| public val state: ZoomableState? = null, | |
| public val enabled: Boolean = true, | |
| public val onTransformChanged: ((ContentTransformation) -> Unit)? = null, | |
| ) : ImagePlugin.ComposablePlugin { | |
| @Composable | |
| override fun compose(content: @Composable () -> Unit) { | |
| val zoomableState = state ?: rememberZoomableState() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| override fun compose( | |
| modifier: Modifier, | |
| imageModel: Any?, | |
| imageOptions: ImageOptions, | |
| imageBitmap: ImageBitmap?, | |
| ): ImagePlugin = | |
| apply { | |
| if (LocalInspectionMode.current) return@apply |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Immutable | |
| public data class PalettePlugin( | |
| private val imageModel: Any? = null, | |
| private val useCache: Boolean = true, | |
| private val interceptor: PaletteBuilderInterceptor? = null, | |
| private val paletteLoadedListener: PaletteLoadedListener? = null, | |
| ) : ImagePlugin.SuccessStatePlugin { | |
| private val bitmapPalette = BitmapPalette( | |
| imageModel = imageModel, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Immutable | |
| public data class BlurTransformationPlugin( | |
| public val radius: Int = 10, | |
| ) : ImagePlugin.PainterPlugin { | |
| @Composable | |
| override fun compose(imageBitmap: ImageBitmap, painter: Painter): Painter { | |
| return painter.rememberBlurPainter( | |
| imageBitmap = imageBitmap, | |
| radius = radius, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Immutable | |
| public data class CircularRevealPlugin( | |
| public val duration: Int = DefaultCircularRevealDuration, | |
| public val onFinishListener: CircularRevealFinishListener? = null, | |
| ) : ImagePlugin.PainterPlugin { | |
| @Composable | |
| override fun compose(imageBitmap: ImageBitmap, painter: Painter): Painter { | |
| return painter.rememberCircularRevealPainter( | |
| imageBitmap = imageBitmap, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Immutable | |
| public data class ShimmerPlugin( | |
| val shimmer: Shimmer = Shimmer.Flash( | |
| baseColor = Color.DarkGray, | |
| highlightColor = Color.LightGray, | |
| ), | |
| ) : ImagePlugin.LoadingStatePlugin { | |
| @Composable | |
| override fun compose( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public data class Failure(val source: Any?) : | |
| PlaceholderPlugin(), | |
| ImagePlugin.FailureStatePlugin { | |
| @Composable | |
| override fun compose( | |
| modifier: Modifier, | |
| imageOptions: ImageOptions, | |
| reason: Throwable?, | |
| ): ImagePlugin = apply { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public data class Loading(val source: Any?) : | |
| PlaceholderPlugin(), | |
| ImagePlugin.LoadingStatePlugin { | |
| @Composable | |
| override fun compose( | |
| modifier: Modifier, | |
| imageOptions: ImageOptions, | |
| executor: @Composable (IntSize) -> Unit, | |
| ): ImagePlugin = apply { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LandscapistImage( | |
| imageModel = { imageUrl }, | |
| component = rememberImageComponent { | |
| +ShimmerPlugin() | |
| +CircularRevealPlugin(duration = 500) | |
| +PalettePlugin(paletteLoadedListener = { palette -> }) | |
| }, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| public fun rememberImageComponent( | |
| block: @Composable ImagePluginComponent.() -> Unit, | |
| ): ImagePluginComponent { | |
| val imageComponent = imageComponent(block) | |
| return remember { imageComponent } | |
| } |