Java Code Examples for com.bumptech.glide.gifdecoder.GifDecoder#BitmapProvider

The following examples show how to use com.bumptech.glide.gifdecoder.GifDecoder#BitmapProvider . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GifDrawable.java    From giffun with Apache License 2.0 6 votes vote down vote up
public GifState(GifHeader header, byte[] data, Context context,
        Transformation<Bitmap> frameTransformation, int targetWidth, int targetHeight,
        GifDecoder.BitmapProvider provider, BitmapPool bitmapPool, Bitmap firstFrame) {
    if (firstFrame == null) {
        throw new NullPointerException("The first frame of the GIF must not be null");
    }
    gifHeader = header;
    this.data = data;
    this.bitmapPool = bitmapPool;
    this.firstFrame = firstFrame;
    this.context = context.getApplicationContext();
    this.frameTransformation = frameTransformation;
    this.targetWidth = targetWidth;
    this.targetHeight = targetHeight;
    bitmapProvider = provider;
}
 
Example 2
Source File: DefaultDataSource.java    From GIFCompressor with Apache License 2.0 5 votes vote down vote up
private void ensureGifDecoder() {
    if (mGifDecoder != null) return;
    ensureGifHeader();
    GifDecoder.BitmapProvider provider = new GifBitmapProvider(
            Glide.get(mContext).getBitmapPool(),
            Glide.get(mContext).getArrayPool()
    );
    mGifDecoder = new StandardGifDecoder(provider);
    mGifDecoder.setData(mGifHeader, getInputStreamData());
    mGifFrames = mGifDecoder.getFrameCount() + 1;
}
 
Example 3
Source File: GifResourceEncoder.java    From giffun with Apache License 2.0 4 votes vote down vote up
public GifDecoder buildDecoder(GifDecoder.BitmapProvider bitmapProvider) {
    return new GifDecoder(bitmapProvider);
}
 
Example 4
Source File: GifDrawable.java    From giffun with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor for GifDrawable.
 *
 * @see #setFrameTransformation(Transformation, Bitmap)
 *
 * @param context A context.
 * @param bitmapProvider An {@link GifDecoder.BitmapProvider} that can be used to
 *                       retrieve re-usable {@link Bitmap}s.
 * @param bitmapPool A {@link BitmapPool} that can be used to return
 *                   the first frame when this drawable is recycled.
 * @param frameTransformation An {@link Transformation} that can be applied to each frame.
 * @param targetFrameWidth The desired width of the frames displayed by this drawable (the width of the view or
 *                         {@link com.bumptech.glide.request.target.Target} this drawable is being loaded into).
 * @param targetFrameHeight The desired height of the frames displayed by this drawable (the height of the view or
 *                          {@link com.bumptech.glide.request.target.Target} this drawable 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 GifDrawable(Context context, GifDecoder.BitmapProvider bitmapProvider, BitmapPool bitmapPool,
        Transformation<Bitmap> frameTransformation, int targetFrameWidth, int targetFrameHeight,
        GifHeader gifHeader, byte[] data, Bitmap firstFrame) {
    this(new GifState(gifHeader, data, context, frameTransformation, targetFrameWidth, targetFrameHeight,
            bitmapProvider, bitmapPool, firstFrame));
}