gifdecoder.java_Java GifDecoder.BitmapProvider方法代碼示例

本文档提供了一个使用GifDecoder.BitmapProvider的Java代码示例,该示例涉及Glide库中创建GifDrawable的过程。GifDecoder.BitmapProvider用于获取可重用的Bitmap,与BitmapPool和Transformation一起工作,以适应目标视图的帧尺寸并处理gif的帧数据。
摘要由CSDN通过智能技术生成

import com.bumptech.glide.gifdecoder.GifDecoder; //導入方法依賴的package包/類

/**

* Constructor for GifDrawable.

*

* @see #setFrameTransformation(com.bumptech.glide.load.Transformation, android.graphics.Bitmap)

*

* @param context A context.

* @param bitmapProvider An {@link com.bumptech.glide.gifdecoder.GifDecoder.BitmapProvider} that can be used to

* retrieve re-usable {@link android.graphics.Bitmap}s.

* @param bitmapPool A {@link com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} that can be used to return

* the first frame when this gifTexture is recycled.

* @param frameTransformation An {@link com.bumptech.glide.load.Transformation} that can be applied to each frame.

* @param targetFrameWidth The desired width of the frames displayed by this gifTexture (the width of the view or

* {@link com.bumptech.glide.request.target.Target} this gifTexture is being loaded into).

* @param targetFrameHeight The desired height of the frames displayed by this gifTexture (the height of the view or

* {@link com.bumptech.glide.request.target.Target} this gifTexture is being loaded into).

* @param gifHeader The header data for this gif.

* @param data The full bytes of the gif.

* @param firstFrame The decoded and transformed first frame of this gif.

*/

public GifTexture(Context context, GifDecoder.BitmapProvider bitmapProvider, BitmapPool bitmapPool,

Transformation frameTransformation, int targetFrameWidth, int targetFrameHeight,

GifHeader gifHeader, byte[] data, Bitmap firstFrame) {

this(new GifState(gifHeader, data, context, frameTransformation, targetFrameWidth, targetFrameHeight,

bitmapProvider, bitmapPool, firstFrame));

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值