fornewid / photo-compose

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

Home Page:https://fornewid.github.io/photo-compose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

https://fornewid.github.io/photo-compose/

License:Apache License 2.0


Languages

Language:Kotlin 83.9%Language:Shell 16.1%