Пример #1
0
        /// <summary>
        /// Gets the auxiliary image handle.
        /// </summary>
        /// <param name="id">The auxiliary image id.</param>
        /// <returns>The auxiliary image handle.</returns>
        /// <exception cref="HeifException">A LibHeif error occurred.</exception>
        /// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
        /// <seealso cref="GetAuxiliaryImageIds"/>
        public HeifImageHandle GetAuxiliaryImage(HeifItemId id)
        {
            VerifyNotDisposed();

            if (LibHeifVersion.Is1Point11OrLater)
            {
                HeifImageHandle     aux           = null;
                SafeHeifImageHandle auxSafeHandle = null;

                try
                {
                    var error = LibHeifNative.heif_image_handle_get_auxiliary_image_handle(this.imageHandle, id, out auxSafeHandle);
                    error.ThrowIfError();

                    aux           = new HeifImageHandle(auxSafeHandle, this.decodeErrorHandler, AuxiliaryImageType.VendorSpecific);
                    auxSafeHandle = null;
                }
                finally
                {
                    auxSafeHandle?.Dispose();
                }

                return(aux);
            }
            else
            {
                throw new HeifException(Resources.AuxiliaryImageAPINotSupported);
            }
        }