Giter Club home page Giter Club logo

android-apngrs's Introduction

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.2")

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.2")

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.
  • All pixel data for all frames is loaded into memory, no scaling is done on this buffer. This library was designed with a focus on small images so this is fine but may be worth optimizing in the future for better memory usage on large images.
  • 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.