public void LoadGifPicture(Image img, GifQuality quality) { List <byte> dataList; using (MemoryStream ms = new MemoryStream()) { img.SaveGif(ms, quality); dataList = new List <byte>(ms.ToArray()); } if (!AnalyzeGifSignature(dataList)) { throw new Exception("File is not a gif!"); } AnalyzeScreenDescriptor(dataList); GifBlockType blockType = GetTypeOfNextBlock(dataList); while (blockType != GifBlockType.Trailer) { switch (blockType) { case GifBlockType.ImageDescriptor: AnalyzeImageDescriptor(dataList); break; case GifBlockType.Extension: ThrowAwayExtensionBlock(dataList); break; } blockType = GetTypeOfNextBlock(dataList); } }
internal GifApplicationExtensionBlock(GifBlockType gifBlockType) : base(gifBlockType) { }
internal GifBlock(GifBlockType gifBlockType)//, String gifBlockName) { this.gifBlockType = gifBlockType; //this.gifBlockName = gifBlockName; }
//, String gifBlockName) internal GifBlock(GifBlockType gifBlockType) { this.gifBlockType = gifBlockType; //this.gifBlockName = gifBlockName; }
private GifBlockType GetTypeOfNextBlock(List <byte> gifData) { GifBlockType blockType = (GifBlockType)gifData[0]; return(blockType); }