Ejemplo n.º 1
0
        /// <summary>
        /// Gets a list of the thumbnail image ids.
        /// </summary>
        /// <returns>A list of the thumbnail image ids.</returns>
        /// <exception cref="HeifException">Could not get all of the thumbnail image ids.</exception>
        /// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
        public IReadOnlyList <HeifItemId> GetThumbnailImageIds()
        {
            VerifyNotDisposed();

            int count = LibHeifNative.heif_image_handle_get_number_of_thumbnails(this.imageHandle);

            if (count == 0)
            {
                return(Array.Empty <HeifItemId>());
            }

            var ids = new HeifItemId[count];

            unsafe
            {
                fixed(HeifItemId *ptr = ids)
                {
                    int filledCount = LibHeifNative.heif_image_handle_get_list_of_thumbnail_IDs(this.imageHandle,
                                                                                                ptr,
                                                                                                count);

                    if (filledCount != count)
                    {
                        ExceptionUtil.ThrowHeifException(Resources.CannotGetAllThumbnailIds);
                    }
                }
            }

            return(ids);
        }