Skip to content

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

License

Notifications You must be signed in to change notification settings

fornewid/photo-compose

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks