8000 GitHub - evant/android-apngrs: Android bindings to image-rs for APNG support.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

evant/android-apngrs

Repository files navigation

CircleCIMaven Central Sonatype Snapshot

android-apngrs

Bindings to image-rs for APNG support on Android.

Usage

You can include the decoder with

implementation("me.tatarka.android:apngrs:0.4")

Then you can create a source and decode a drawable. The api is mirrored after ImageDecoder.

val source = ApngDecoder.source(resources, R.drawable.my_animated_png)
val drawable = ApngDecoder.decodeDrawable(source)
drawable.start() // to start the animation.

Coil Integration

For easy coil integration, include

implementation("me.tatarka.android:apngrs-coil:0.4")

and then add the decoder

val imageLoader = ImageLoader.Builder(context)
    .components {
        add(ApngDecoderDecoder.Factory())
    }
    .build()

Current Limitations/Possible Future Directions

  • All animations are currently rendered as looping infinitely instead of respecting the num_plays value.
  • Image data is loaded first into a byte array in memory before decoding, could do some sort of streaming support here if I could figure out the jni bits for that.
  • image-rs actually supports a wide range of image formats but only APNGs are currently supported. May be expanded in the future if there's value.
  • Source inputs are limited to byte arrays and resources, this could be expanded pretty easily.

About

Android bindings to image-rs for APNG support.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
< 30A3 div class="BorderGrid-cell">

Languages

0