com.bumptech.glide.gifdecoder
Class GifHeaderParser

java.lang.Object
  extended by com.bumptech.glide.gifdecoder.GifHeaderParser

public class GifHeaderParser
extends Object

A class responsible for creating GifHeaders from data representing animated gifs.


Field Summary
static String TAG
           
 
Constructor Summary
GifHeaderParser()
           
 
Method Summary
 GifHeader parseHeader()
           
protected  void readBitmap()
          Reads next frame image.
protected  int readBlock()
          Reads next variable length block from input.
protected  int[] readColorTable(int ncolors)
          Reads color table as 256 RGB integer values.
protected  void readContents()
          Main file parser.
protected  void readGraphicControlExt()
          Reads Graphics Control Extension values.
protected  void readLSD()
          Reads Logical Screen Descriptor.
protected  void readNetscapeExt()
          Reads Netscape extension to obtain iteration count.
protected  int readShort()
          Reads next 16-bit value, LSB first.
 GifHeaderParser setData(byte[] data)
           
protected  void skip()
          Skips variable length blocks up to and including next zero length block.
protected  void skipBitmapData()
          Skips LZW image data for a single frame to advance buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG

public static final String TAG
See Also:
Constant Field Values
Constructor Detail

GifHeaderParser

public GifHeaderParser()
Method Detail

setData

public GifHeaderParser setData(byte[] data)

parseHeader

public GifHeader parseHeader()

readContents

protected void readContents()
Main file parser. Reads GIF content blocks.


readGraphicControlExt

protected void readGraphicControlExt()
Reads Graphics Control Extension values.


readBitmap

protected void readBitmap()
Reads next frame image.


readNetscapeExt

protected void readNetscapeExt()
Reads Netscape extension to obtain iteration count.


readLSD

protected void readLSD()
Reads Logical Screen Descriptor.


readColorTable

protected int[] readColorTable(int ncolors)
Reads color table as 256 RGB integer values.

Parameters:
ncolors - int number of colors to read.
Returns:
int array containing 256 colors (packed ARGB with full alpha).

skipBitmapData

protected void skipBitmapData()
Skips LZW image data for a single frame to advance buffer. Adapted from John Cristy's BitmapMagick.


skip

protected void skip()
Skips variable length blocks up to and including next zero length block.


readBlock

protected int readBlock()
Reads next variable length block from input.

Returns:
number of bytes stored in "buffer"

readShort

protected int readShort()
Reads next 16-bit value, LSB first.