Exemplo n.º 1
0
        /// <summary>
        /// Copy the 2-dimensional pixel data into <paramref name="destination"/>, after skipping some rows and columns specified in <paramref name="offset"/>.
        /// </summary>
        /// <param name="offset">The number rows and columns to skip. X represents the number of columns to skip; Y represents the number of rows to skip.</param>
        /// <param name="destination">The destination writer. It also limits the number of rows and columns to copy.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> that fires if the user want to stop the current task.</param>
        /// <returns>A <see cref="ValueTask"/> that completes when all the requested pixels are copied.</returns>
        public ValueTask ReadAsync(TiffPoint offset, TiffPixelBufferWriter <TPixel> destination, CancellationToken cancellationToken)
        {
            offset = new TiffPoint(offset.X + _offset.X, offset.Y + _offset.Y);
            var readSize = new TiffSize(Math.Min(_size.Width, destination.Width), Math.Min(_size.Height, destination.Height));

            if (readSize.IsAreaEmpty)
            {
                return(default);