/// <summary>Initialize a new empty <see cref="WebPDecBuffer"/> structure.</summary>
        /// <exception cref="BadImageFormatException">Version mismatch</exception>
        /// <remarks>
        /// Must be called before any other use in case the decoder doesn't initialize one internally.
        /// </remarks>
        public WebPDecBuffer CreateDecodeBuffer()
        {
            this.ThrowIfDisposed();
            var output_buffer = new WebPDecBuffer();

            // Unnecessary but welp, check for version anyway.
            if (!this.library.WebPInitDecBuffer(ref output_buffer))
            {
                throw new BadImageFormatException("Version mismatch.");
            }

            return(output_buffer);
        }
 /// <summary>
 /// Creates a new incremental decoder with the supplied buffer parameter
 /// </summary>
 /// <param name="output_buffer">The data of <see cref="WebPDecBuffer"/> to create decoder</param>
 /// <remarks>
 /// The supplied 'output_buffer' content MUST NOT be changed between calls to
 /// WebPIAppend() or WebPIUpdate() unless 'output_buffer.is_external_memory' is
 /// not set to 0. In such a case, it is allowed to modify the pointers, size and
 /// stride of output_buffer.u.RGBA or output_buffer.u.YUVA, provided they remain
 /// within valid bounds.
 /// All other fields of WebPDecBuffer MUST remain constant between calls.
 /// </remarks>
 public WebpImageDecoder CreateDecoder(ref WebPDecBuffer output_buffer)
 {
     this.ThrowIfDisposed();
     return(new WebpImageDecoder(this.library, ref output_buffer));
 }
 /// <summary>Free any memory associated with the buffer. Must always be called last. Doesn't free the 'buffer' structure itself.</summary>
 /// <param name="output_buffer">The <seealso cref="WebPDecBuffer"/> to free the associated memory.</param>
 /// <remarks>External memory will not be touched.</remarks>
 public void Free(ref WebPDecBuffer output_buffer)
 {
     this.ThrowIfDisposed();
     this.library.WebPFreeDecBuffer(ref output_buffer);
 }