public override Span <TPixel> GetSpan() { if (_innerHandle is null) { throw new ObjectDisposedException(GetType().FullName); } return(_innerHandle.GetSpan()); }
public override Span <TSource> GetSpan() { if (_innerHandle is null) { throw new ObjectDisposedException(GetType().FullName); } return(MemoryMarshal.Cast <TDestination, TSource>(_innerHandle.GetSpan())); }
/// <inheritdoc /> public ValueTask ReadAsync(TiffPoint offset, TiffPixelBufferWriter <TPixel> destination, CancellationToken cancellationToken) { if (offset.X >= (uint)_size.Width || offset.Y >= (uint)_size.Height) { throw new ArgumentOutOfRangeException(nameof(offset)); } int width = Math.Min(_size.Width - offset.X, destination.Width); int height = Math.Min(_size.Height - offset.Y, destination.Height); ReadOnlySpan <TPixel> buffer = _buffer.GetReadOnlySpan(); int bufferWidth = _size.Width; for (int row = 0; row < height; row++) { ReadOnlySpan <TPixel> sourceSpan = buffer.Slice(bufferWidth * (offset.Y + row) + offset.X, width); using TiffPixelSpanHandle <TPixel> destinationHandle = destination.GetRowSpan(row); sourceSpan.CopyTo(destinationHandle.GetSpan()); } return(default);