Coder Social home page Coder Social logo

onexuan / glidewebpdecoder-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zjupure/glidewebpdecoder

0.0 2.0 0.0 6.81 MB

A Glide WebpDecoder Intergration Library for decoding and displaying webp images

License: Apache License 2.0

Java 3.33% Makefile 1.07% C++ 1.73% C 93.83% Shell 0.04%

glidewebpdecoder-1's Introduction

GlideWebpDecoder

license Release Version PRs Welcome

GlideWebpDecoder is a Glide integration library for decoding and displaying webp images on Android platforms. It is based on libwebp project and takes some implementation from Fresco and GlideWebpSupport as references.

Features

  • play animated webp images on all Android versions
  • show transparent or lossless webp images on Android devices lower than 4.2.1 (BitmapFactory support webp decode on 4.2+ android system so we have no need to handle)

Dependency Integration

Library is available in jcenter. If you build with Gradle, just add the following dependencies to your build.gradle file. Different Glide version is corresponding to different GlideWebpDecoder due to the annotation processor compatibility. The version rule of GlideWebpDecoder is "{major_version}.{glide_version}". For example, if you use glide 4.7.1, the corresponding version of GlideWebpDecoder should be 1.0.4.7.1

Library will only follow the latest three version of Glide. If you use a lower version glide, please clone the project and modify it yourself.

Glide 4.7.0 is not available in maven, see issue 3015

Glide 4.6.0 is broken, see issue 2863

def GLIDE_VERSION = "4.7.1"
// webpdecoder
compile "com.zlc.glide:webpdecoder:1.0.${GLIDE_VERSION}"
// glide 4.5.0~4.7.1 (exclude broken version 4.6.0, 4.7.0)
compile "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"

Then you are free to use GlideWebpDecoder just like using other Glide integration library.

Usage

Basic usage see Glide API documents

If you want to use BitmapTransformation or library glide-transformations, please use WebpDrawableTransformation to wrap your original BitmapTransformation when loading image with Glide request.

Code Snippet as follow. Run sample project to see other Glide built-in transformation effect.

Transformation<Bitmap> circleCrop = new CircleCrop();
GlideApp.with(mContext)
        .load(url)
        .optionalTransform(circleCrop)
        .optionalTransform(WebpDrawable.class, new WebpDrawableTransformation(circleCrop))
        .into(imageView);

Proguard

The library use native code to decode webp, so you should put the following lines to your proguard.cfg and keep the jni interface.

-keep public class com.bumptech.glide.integration.webp.WebpImage { *; }
-keep public class com.bumptech.glide.integration.webp.WebpFrame { *; }
-keep public class com.bumptech.glide.integration.webp.WebpBitmapFactory { *; }

Acknowledgement

License

The Library is Apache-2.0-licensed, part code is MIT-licensed see Fresco for detail.

glidewebpdecoder-1's People

Contributors

alvingao avatar zjupure avatar

Watchers

 avatar  avatar

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.