zjupure/GlideWebpDecoder
소개
WebP 이미지를 디코딩하고 표시하기 위한 Glide WebP 디코더 통합 라이브러리
디자인 및 미디어What you can do
- 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)
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalGlideWebpDecoder
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 MavenCentral. 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.16.0, the corresponding version of GlideWebpDecoder should be 2.8.5.0.9
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.
Notice
Since Glide 4.10.0 has migrate to AndroidX, so your project must use AndroidX with Glide 4.10.0+.
WebpDecoder with AndroidX support starts from version 1.6.{GLIDE_VERSION} and won't support glide version below 4.10.0 anymore.
Glide 5.x has deprecated annotionProcessor and use ksp as instead. GlideApp will not generated anymore.
Attention
Since JCenter is being taken down on May 1 2021 and then close their service, so the library has migrate artifacts to Maven Central. See issue #76 for more detail.
Changes:
- library group id has changed from
com.zlc.glidetocom.github.zjupure - add
mavenCentral()in yourbuild.gradleto fetch this library - only 2.0 version with glide 4.10~4.16 has been migrated and older version not support anymore
If your project use old library version below 2.0, you should upgrade the library to the latest 2.0 version.
def GLIDE_VERSION = "5.0.9"
// webpdecoder
implementation "com.github.zjupure:webpdecoder:2.8.${GLIDE_VERSION}"
// glide 4.10+ and 5.x
implementation "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.
관련 프로젝트 살펴보기
불러오는 중…