implementation 'com.github.bumptech.glide:glide:version'
CloudInfinite cloudInfinite = new CloudInfinite();CITransformation transform = new CITransformation();transform.thumbnailByScale(50).iradius(60);CIImageLoadRequest request = cloudInfinite.requestWithBaseUrlSync(url, transform);
Glide.with(activity).load(request.getUrl().toString()).into(imageview);
implementation 'com.qcloud.cos:cloud-infinite-glide:1.2.1'annotationProcessor 'com.github.bumptech.glide:compiler:version'
// 注册自定义 GlideModule// 开发者应该创建此类注册 CIImageRequestModelLoader 和 ImageAveDecoder<br>// 类库开发者可以继承 LibraryGlideModule 创建类似的注册类@GlideModulepublic class MyAppGlideModule extends AppGlideModule {@Overridepublic void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {//注册支持 CIImageLoadRequest 的 loaderregistry.prepend(CIImageLoadRequest.class, InputStream.class, new CIImageRequestModelLoader.Factory());//注册主色解码器registry.prepend(InputStream.class, Bitmap.class, new ImageAveDecoder(glide.getBitmapPool()));}}
//先在 AppGlideModule 中注册主色解码器registry.prepend(InputStream.class, Bitmap.class, new ImageAveDecoder(glide.getBitmapPool()));//使用 glide 的 thumbnail 进行主色预加载Glide.with(context).load(imageUrl).thumbnail(CloudInfiniteGlide.getImageAveThumbnail(context, imageUrl)).into(imageview);
registry.prepend(CIImageLoadRequest.class, InputStream.class, new CIImageRequestModelLoader.Factory());
implementation 'com.qcloud.cos:tpg:1.3.2'annotationProcessor 'com.github.bumptech.glide:compiler:version'
// 注册自定义 GlideModule// 开发者应该创建此类注册TpgDecoder、ByteBufferTpgGifDecoder<br>// 类库开发者可以继承 LibraryGlideModule 创建类似的注册类@GlideModulepublic class MyAppGlideModule extends AppGlideModule {@Overridepublic void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {/*------------------解码器 开始-------------------------*///注册 TPG 静态图片解码器registry.prepend(InputStream.class, Bitmap.class, new TpgDecoder(glide.getBitmapPool()));//注册 TPG 动图解码器ByteBufferTpgGifDecoder byteBufferTpgGifDecoder = new ByteBufferTpgGifDecoder(context, glide.getBitmapPool(), glide.getArrayPool());registry.prepend(InputStream.class, GifDrawable.class, new StreamTpgGifDecoder(byteBufferTpgGifDecoder));registry.prepend(ByteBuffer.class, GifDrawable.class, byteBufferTpgGifDecoder);/*------------------解码器 结束-------------------------*/}}
registry.prepend(InputStream.class, Bitmap.class, new TpgDecoder(glide.getBitmapPool()));
ByteBufferTpgGifDecoder byteBufferTpgGifDecoder = new ByteBufferTpgGifDecoder(context, glide.getBitmapPool(), glide.getArrayPool());registry.prepend(InputStream.class, GifDrawable.class, new StreamTpgGifDecoder(byteBufferTpgGifDecoder));registry.prepend(ByteBuffer.class, GifDrawable.class, byteBufferTpgGifDecoder);
implementation 'com.qcloud.cos:avif:1.0.0'annotationProcessor 'com.github.bumptech.glide:compiler:version'
// 注册自定义 GlideModule// 开发者应该创建此类注册相关解码器<br>// 类库开发者可以继承 LibraryGlideModule 创建类似的注册类@GlideModulepublic class MyAppGlideModule extends AppGlideModule {@Overridepublic void registerComponents(@NonNull Context context, @NonNull Glide glide, Registry registry) {/*------------------解码器 开始-------------------------*///注册 AVIF 静态图片解码器registry.prepend(Registry.BUCKET_BITMAP, InputStream.class, Bitmap.class, new StreamAvifDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(Registry.BUCKET_BITMAP, ByteBuffer.class, Bitmap.class, new ByteBufferAvifDecoder(glide.getBitmapPool()));//注册 AVIF 动图解码器registry.prepend(InputStream.class, AvifSequenceDrawable.class, new StreamAvifSequenceDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(ByteBuffer.class, AvifSequenceDrawable.class, new ByteBufferAvifSequenceDecoder(glide.getBitmapPool()));/*------------------解码器 结束-------------------------*/}}
registry.prepend(Registry.BUCKET_BITMAP, InputStream.class, Bitmap.class, new StreamAvifDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(Registry.BUCKET_BITMAP, ByteBuffer.class, Bitmap.class, new ByteBufferAvifDecoder(glide.getBitmapPool()));
registry.prepend(InputStream.class, AvifSequenceDrawable.class, new StreamAvifSequenceDecoder(glide.getBitmapPool(), glide.getArrayPool()));registry.prepend(ByteBuffer.class, AvifSequenceDrawable.class, new ByteBufferAvifSequenceDecoder(glide.getBitmapPool()));
本页内容是否解决了您的问题?