Esempio n. 1
0
        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)
 {
 }
Esempio n. 3
0
 internal GifBlock(GifBlockType gifBlockType)//, String gifBlockName)
 {
     this.gifBlockType = gifBlockType;
     //this.gifBlockName = gifBlockName;
 }
Esempio n. 4
0
 internal GifApplicationExtensionBlock(GifBlockType gifBlockType)
     : base(gifBlockType)
 {
 }
Esempio n. 5
0
 //, String gifBlockName)
 internal GifBlock(GifBlockType gifBlockType)
 {
     this.gifBlockType = gifBlockType;
     //this.gifBlockName = gifBlockName;
 }
Esempio n. 6
0
        private GifBlockType GetTypeOfNextBlock(List <byte> gifData)
        {
            GifBlockType blockType = (GifBlockType)gifData[0];

            return(blockType);
        }