protected unsafe virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_gif != null)
                {
                    if (_gif._out_ != null)
                    {
                        CRuntime.free(_gif._out_);
                        _gif._out_ = null;
                    }

                    if (_gif.history != null)
                    {
                        CRuntime.free(_gif.history);
                        _gif.history = null;
                    }

                    if (_gif.background != null)
                    {
                        CRuntime.free(_gif.background);
                        _gif.background = null;
                    }

                    _gif = null;
                }
            }
        }
        public AnimatedGifEnumerator(Stream input, ColorComponents colorComponents)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            _context = new StbImage.stbi__context(input);

            if (StbImage.stbi__gif_test(_context) == 0)
            {
                throw new Exception("Input stream is not GIF file.");
            }

            _gif            = new StbImage.stbi__gif();
            ColorComponents = colorComponents;
        }