Java Code Examples for com.bumptech.glide.gifdecoder.GifHeaderParser#parseHeader()
The following examples show how to use
com.bumptech.glide.gifdecoder.GifHeaderParser#parseHeader() .
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: GifResourceDecoder.java From giffun with Apache License 2.0 | 6 votes |
private GifDrawableResource decode(byte[] data, int width, int height, GifHeaderParser parser, GifDecoder decoder) { final GifHeader header = parser.parseHeader(); if (header.getNumFrames() <= 0 || header.getStatus() != GifDecoder.STATUS_OK) { // If we couldn't decode the GIF, we will end up with a frame count of 0. return null; } Bitmap firstFrame = decodeFirstFrame(decoder, header, data); if (firstFrame == null) { return null; } Transformation<Bitmap> unitTransformation = UnitTransformation.get(); GifDrawable gifDrawable = new GifDrawable(context, provider, bitmapPool, unitTransformation, width, height, header, data, firstFrame); return new GifDrawableResource(gifDrawable); }
Example 2
Source File: GifResourceEncoder.java From giffun with Apache License 2.0 | 5 votes |
private GifDecoder decodeHeaders(byte[] data) { GifHeaderParser parser = factory.buildParser(); parser.setData(data); GifHeader header = parser.parseHeader(); GifDecoder decoder = factory.buildDecoder(provider); decoder.setData(header, data); decoder.advance(); return decoder; }
Example 3
Source File: DefaultDataSource.java From GIFCompressor with Apache License 2.0 | 5 votes |
private void ensureGifHeader() { if (mGifHeader != null) return; GifHeaderParser parser = new GifHeaderParser(); parser.setData(getInputStreamData()); mGifHeader = parser.parseHeader(); parser.clear(); if (mGifHeader.getStatus() != GifDecoder.STATUS_OK) { throw new RuntimeException("Illegal status: " + mGifHeader.getStatus()); } }