photo-compose icon indicating copy to clipboard operation
photo-compose copied to clipboard

Alternative implementation of PhotoView for Jetpack Compose that supports zooming, by various touch gestures.

PhotoView for Jetpack Compose

This library provides alternative implementation of PhotoView for Jetpack Compose.

Dependency

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        mavenCentral()
    }
}

buildscript {
    repositories {
        mavenCentral()
    }	
}

Then, add the library to your module build.gradle

dependencies {
    implementation 'io.github.fornewid:photo-compose:<version>'
}

Usage

There is a sample provided which shows how to use the library.

Here is a simple example that works:

val painter = painterResource(R.drawable.image)
val photoState = rememberPhotoState()
photoState.setPhotoIntrinsicSize(painter.intrinsicSize)
PhotoBox(state = photoState) {
    Image(
        painter,
        contentDescription = "image",
        modifier = Modifier.fillMaxSize(),
    )
}

License

Licensed under the Apache 2.0 license. See LICENSE for details.