1 package com.bumptech.glide.gifdecoder; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 /** 7 * A header object containing the number of frames in an animated GIF image as well as basic metadata like width and 8 * height that can be used to decode each individual frame of the GIF. Can be shared by one or more 9 * {@link com.bumptech.glide.gifdecoder.GifDecoder}s to play the same animated GIF in multiple views. 10 */ 11 public class GifHeader { 12 13 int[] gct = null; 14 int status = GifDecoder.STATUS_OK; 15 int frameCount = 0; 16 17 GifFrame currentFrame; 18 List<GifFrame> frames = new ArrayList<GifFrame>(); 19 // Logical screen size. 20 // Full image width. 21 int width; 22 // Full image height. 23 int height; 24 25 // 1 : global color table flag. 26 boolean gctFlag; 27 // 2-4 : color resolution. 28 // 5 : gct sort flag. 29 // 6-8 : gct size. 30 int gctSize; 31 // Background color index. 32 int bgIndex; 33 // Pixel aspect ratio. 34 int pixelAspect; 35 //TODO: this is set both during reading the header and while decoding frames... 36 int bgColor; 37 int loopCount; 38 getHeight()39 public int getHeight() { 40 return height; 41 } 42 getWidth()43 public int getWidth() { 44 return width; 45 } 46 getNumFrames()47 public int getNumFrames() { 48 return frameCount; 49 } 50 51 /** 52 * Global status code of GIF data parsing. 53 */ getStatus()54 public int getStatus() { 55 return status; 56 } 57 } 58