Example #1
0
        private async Task ReadInternalAsync(Stream stream, IEnumerable <GifExtension> controlExtensions)
        {
            this.Descriptor = await GifImageDescriptor.ReadAsync(stream).ConfigureAwait(false);

            if (this.Descriptor.HasLocalColorTable)
            {
                this.LocalColorTable = await GifHelpers.ReadColorTableAsync(stream, this.Descriptor.LocalColorTableSize).ConfigureAwait(false);
            }
            this.ImageData = await GifImageData.ReadAsync(stream).ConfigureAwait(false);

            this.Extensions     = (IList <GifExtension>)controlExtensions.ToList <GifExtension>().AsReadOnly();
            this.GraphicControl = this.Extensions.OfType <GifGraphicControlExtension>().FirstOrDefault <GifGraphicControlExtension>();
        }
Example #2
0
        private async Task ReadInternalAsync(Stream stream, IEnumerable <GifExtension> controlExtensions)
        {
            // Note: at this point, the Image Separator (0x2C) has already been read

            Descriptor = await GifImageDescriptor.ReadAsync(stream).ConfigureAwait(false);

            if (Descriptor.HasLocalColorTable)
            {
                LocalColorTable = await GifHelpers.ReadColorTableAsync(stream, Descriptor.LocalColorTableSize).ConfigureAwait(false);
            }
            ImageData = await GifImageData.ReadAsync(stream).ConfigureAwait(false);

            Extensions     = controlExtensions.ToList().AsReadOnly();
            GraphicControl = Extensions.OfType <GifGraphicControlExtension>().FirstOrDefault();
        }