コード例 #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);
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the thumbnail image handle.
        /// </summary>
        /// <param name="id">The thumbnail image id.</param>
        /// <returns>The thumbnail image handle.</returns>
        /// <exception cref="HeifException">A LibHeif error occurred.</exception>
        /// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
        public HeifImageHandle GetThumbnailImage(HeifItemId id)
        {
            VerifyNotDisposed();

            HeifImageHandle     thumbnail           = null;
            SafeHeifImageHandle thumbnailSafeHandle = null;

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

                thumbnail           = new HeifImageHandle(thumbnailSafeHandle, this.decodeErrorHandler);
                thumbnailSafeHandle = null;
            }
            finally
            {
                thumbnailSafeHandle?.Dispose();
            }

            return(thumbnail);
        }
コード例 #3
0
        /// <summary>
        /// Gets the depth images.
        /// </summary>
        /// <param name="id">The depth image id.</param>
        /// <returns>The meta-data bytes.</returns>
        /// <exception cref="HeifException">A LibHeif error occurred.</exception>
        /// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
        public HeifImageHandle GetDepthImage(HeifItemId id)
        {
            VerifyNotDisposed();

            HeifImageHandle     depth           = null;
            SafeHeifImageHandle depthSafeHandle = null;

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

                depth           = new HeifImageHandle(depthSafeHandle, this.decodeErrorHandler);
                depthSafeHandle = null;
            }
            finally
            {
                depthSafeHandle?.Dispose();
            }

            return(depth);
        }