Пример #1
0
        internal static GifApplicationExtensionBlock Create(GifReader reader)
        {
            GifApplicationExtensionBlock gifApplicationExtensionBlock = new GifApplicationExtensionBlock(reader);

            if (gifApplicationExtensionBlock.ApplicationIdentifier.Equals("NETSCAPE") && gifApplicationExtensionBlock.ApplicationAuthenticationCode.Equals("2.0"))
            {
                if ((null != gifApplicationExtensionBlock.Bytes))
                {
                    if ((3 == gifApplicationExtensionBlock.Bytes.Length) && (1 == gifApplicationExtensionBlock.Bytes[0]))
                    {
                        gifApplicationExtensionBlock = new GifNetscapeLoopingApplicationExtensionBlock(gifApplicationExtensionBlock);
                    }
                    else if ((5 == gifApplicationExtensionBlock.Bytes.Length) && (2 == gifApplicationExtensionBlock.Bytes[0]))
                    {
                        gifApplicationExtensionBlock = new GifNetscapeBufferingApplicationExtensionBlock(gifApplicationExtensionBlock);
                    }
                }
            }
            else if (gifApplicationExtensionBlock.ApplicationIdentifier.Equals("ANIMEXTS") && gifApplicationExtensionBlock.ApplicationAuthenticationCode.Equals("1.0"))
            {
                if ((null != gifApplicationExtensionBlock.Bytes) && (3 == gifApplicationExtensionBlock.Bytes.Length) && (1 == gifApplicationExtensionBlock.Bytes[0]))
                {
                    gifApplicationExtensionBlock = new GifAnimextsLoopingApplicationExtensionBlock(gifApplicationExtensionBlock);
                }
            }

            return(gifApplicationExtensionBlock);
        }
        internal static GifApplicationExtensionBlock Create(GifReader reader)
        {
            GifApplicationExtensionBlock gifApplicationExtensionBlock = new GifApplicationExtensionBlock(reader);

            if (gifApplicationExtensionBlock.ApplicationIdentifier.Equals("NETSCAPE") && gifApplicationExtensionBlock.ApplicationAuthenticationCode.Equals("2.0"))
            {
                if ((null != gifApplicationExtensionBlock.Bytes))
                {
                    if ((3 == gifApplicationExtensionBlock.Bytes.Length) && (1 == gifApplicationExtensionBlock.Bytes[0]))
                    {
                        gifApplicationExtensionBlock = new GifNetscapeLoopingApplicationExtensionBlock(gifApplicationExtensionBlock);
                    }
                    else if ((5 == gifApplicationExtensionBlock.Bytes.Length) && (2 == gifApplicationExtensionBlock.Bytes[0]))
                    {
                        gifApplicationExtensionBlock = new GifNetscapeBufferingApplicationExtensionBlock(gifApplicationExtensionBlock);
                    }

                }
            }
            else if (gifApplicationExtensionBlock.ApplicationIdentifier.Equals("ANIMEXTS") && gifApplicationExtensionBlock.ApplicationAuthenticationCode.Equals("1.0"))
            {
                if ((null != gifApplicationExtensionBlock.Bytes) && (3 == gifApplicationExtensionBlock.Bytes.Length) && (1 == gifApplicationExtensionBlock.Bytes[0]))
                {
                    gifApplicationExtensionBlock = new GifAnimextsLoopingApplicationExtensionBlock(gifApplicationExtensionBlock);
                }
            }

            return gifApplicationExtensionBlock;
        }
Пример #3
0
        static private void DumpBlock(GifBlock gifBlock)
        {
            GifExtensionBlock gifUnknownBlock = gifBlock as GifExtensionBlock;

            if (gifUnknownBlock != null)
            {
                Console.WriteLine("\tLength:\t\t\t\t" + gifUnknownBlock.Bytes.Length);
            }

            GifHeaderBlock gifHeaderBlock = gifBlock as GifHeaderBlock;

            if (gifHeaderBlock != null)
            {
                Console.WriteLine("\tVersion:\t\t\t" + gifHeaderBlock.Version);
            }

            GifLogicalScreenDescriptorBlock gifLogicalScreenDescriptorBlock = gifBlock as GifLogicalScreenDescriptorBlock;

            if (gifLogicalScreenDescriptorBlock != null)
            {
                Console.WriteLine("\tWidth:\t\t\t\t" + gifLogicalScreenDescriptorBlock.Width);
                Console.WriteLine("\tHeight:\t\t\t\t" + gifLogicalScreenDescriptorBlock.Height);

                Console.WriteLine("\tGlobalColorTableFlag:\t\t" + gifLogicalScreenDescriptorBlock.GlobalColorTableFlag);
                Console.WriteLine("\tColorResolution:\t\t" + gifLogicalScreenDescriptorBlock.ColorResolution);
                Console.WriteLine("\tGlobalColorTableSorted:\t\t" + gifLogicalScreenDescriptorBlock.GlobalColorTableSorted);
                Console.WriteLine("\tGlobalColorTableSize:\t\t" + gifLogicalScreenDescriptorBlock.GlobalColorTableSize);

                Console.WriteLine("\tBackgroundColorIndex:\t\t" + gifLogicalScreenDescriptorBlock.BackgroundColorIndex);
                Console.WriteLine("\tPixelAspectRatio:\t\t" + gifLogicalScreenDescriptorBlock.PixelAspectRatio);
            }

            GifGlobalColorTableBlock gifGlobalColorTableBlock = gifBlock as GifGlobalColorTableBlock;

            if (gifGlobalColorTableBlock != null)
            {
                Console.WriteLine("\tLength:\t\t\t\t" + gifGlobalColorTableBlock.Bytes.Length);
            }

            GifImageDescriptorBlock gifImageDescriptorBlock = gifBlock as GifImageDescriptorBlock;

            if (gifImageDescriptorBlock != null)
            {
                Console.WriteLine("\tLeft:\t\t\t\t" + gifImageDescriptorBlock.Left);
                Console.WriteLine("\tTop:\t\t\t\t" + gifImageDescriptorBlock.Top);
                Console.WriteLine("\tWidth:\t\t\t\t" + gifImageDescriptorBlock.Width);
                Console.WriteLine("\tHeight:\t\t\t\t" + gifImageDescriptorBlock.Height);
                Console.WriteLine("\tInterlaced:\t\t\t" + gifImageDescriptorBlock.Interlaced);
                Console.WriteLine("\tLocalColorTableFlag:\t\t" + gifImageDescriptorBlock.LocalColorTableFlag);
                Console.WriteLine("\tLocalColorTableSorted:\t\t" + gifImageDescriptorBlock.LocalColorTableSorted);
                Console.WriteLine("\tLocalColorTableSize:\t\t" + gifImageDescriptorBlock.LocalColorTableSize);
            }

            GifLocalColorTableBlock gifLocalColorTableBlock = gifBlock as GifLocalColorTableBlock;

            if (gifLocalColorTableBlock != null)
            {
                Console.WriteLine("\tLength:\t\t\t\t" + gifLocalColorTableBlock.Bytes.Length);
            }

            GifTableBasedImageDataBlock gifTableBasedImageDataBlock = gifBlock as GifTableBasedImageDataBlock;

            if (gifTableBasedImageDataBlock != null)
            {
                Console.WriteLine("\tLzwMinimumCodeSize:\t\t" + gifTableBasedImageDataBlock.LzwMinimumCodeSize);
                Console.WriteLine("\tLength:\t\t\t\t" + gifTableBasedImageDataBlock.ImageData.Length);
            }

            GifGraphicControExtensionBlock gifGraphicControExtensionBlock = gifBlock as GifGraphicControExtensionBlock;

            if (gifGraphicControExtensionBlock != null)
            {
                Console.WriteLine("\tDisposalMethod:\t\t\t" + gifGraphicControExtensionBlock.DisposalMethod + " (" + (int)gifGraphicControExtensionBlock.DisposalMethod + ")");
                Console.WriteLine("\tUserInputExpected:\t\t" + gifGraphicControExtensionBlock.UserInputExpected);
                Console.WriteLine("\tTransparency:\t\t\t" + gifGraphicControExtensionBlock.Transparency);
                Console.WriteLine("\tDelay:\t\t\t\t" + gifGraphicControExtensionBlock.Delay);
                Console.WriteLine("\tTransparencyIndex:\t\t" + gifGraphicControExtensionBlock.TransparencyIndex);
            }

            GifCommentExtensionBlock gifCommentExtensionBlock = gifBlock as GifCommentExtensionBlock;

            if (gifCommentExtensionBlock != null)
            {
                Console.WriteLine("\tComment:\t\t\t" + gifCommentExtensionBlock.Comment);
            }

            GifPlainTextExtensionBlock gifPlainTextExtensionBlock = gifBlock as GifPlainTextExtensionBlock;

            if (gifPlainTextExtensionBlock != null)
            {
                Console.WriteLine("\tLeft:\t\t\t\t" + gifPlainTextExtensionBlock.Left);
                Console.WriteLine("\tTop:\t\t\t\t" + gifPlainTextExtensionBlock.Top);
                Console.WriteLine("\tWidth:\t\t\t\t" + gifPlainTextExtensionBlock.Width);
                Console.WriteLine("\tHeight:\t\t\t\t" + gifPlainTextExtensionBlock.Height);
                Console.WriteLine("\tCellWidth:\t\t\t" + gifPlainTextExtensionBlock.CellWidth);
                Console.WriteLine("\tCellHeight:\t\t\t" + gifPlainTextExtensionBlock.CellHeight);
                Console.WriteLine("\tForegroundColor:\t\t" + gifPlainTextExtensionBlock.ForegroundColor);
                Console.WriteLine("\tBackgroundColor:\t\t" + gifPlainTextExtensionBlock.BackgroundColor);
                Console.WriteLine("\tText:\t\t\t" + gifPlainTextExtensionBlock.Text);
            }

            GifApplicationExtensionBlock gifApplicationExtensionBlock = gifBlock as GifApplicationExtensionBlock;

            if (gifApplicationExtensionBlock != null)
            {
                Console.WriteLine("\tApplicationIdentifier:\t\t" + gifApplicationExtensionBlock.ApplicationIdentifier);
                Console.WriteLine("\tApplicationAuthenticationCode:\t" + gifApplicationExtensionBlock.ApplicationAuthenticationCode);
            }
            GifNetscapeLoopingApplicationExtensionBlock gifNetscapeExtensionBlock = gifBlock as GifNetscapeLoopingApplicationExtensionBlock;

            if (gifNetscapeExtensionBlock != null)
            {
                Console.WriteLine("\tLoopCount:\t\t\t" + gifNetscapeExtensionBlock.LoopCount);
            }
            GifNetscapeBufferingApplicationExtensionBlock gifNetscapeBufferingExtensionBlock = gifBlock as GifNetscapeBufferingApplicationExtensionBlock;

            if (gifNetscapeBufferingExtensionBlock != null)
            {
                Console.WriteLine("\tBufferSize:\t\t\t" + gifNetscapeBufferingExtensionBlock.BufferSize);
            }
            GifAnimextsLoopingApplicationExtensionBlock gifAnimextsLoopingExtensionBlock = gifBlock as GifAnimextsLoopingApplicationExtensionBlock;

            if (gifAnimextsLoopingExtensionBlock != null)
            {
                Console.WriteLine("\tLoopCount:\t\t\t" + gifAnimextsLoopingExtensionBlock.LoopCount);
            }
        }