public ValueTask ReadAsync(TiffPoint offset, TiffPixelBufferWriter <TDestination> destination, CancellationToken cancellationToken) { ITiffPixelBufferWriter <TDestination> destinationWriter = TiffPixelBufferUnsafeMarshal.GetBuffer(destination, out TiffPoint destinationOffset, out TiffSize size); TiffPixelBufferWriter <TSource> newDestination = new TiffPassthroughPixelBufferWriter <TSource, TDestination>(destinationWriter).AsPixelBufferWriter().Crop(destinationOffset, size); return(_source.ReadAsync(offset, newDestination, cancellationToken)); }
public override void Dispose() { _innerHandle?.Dispose(); _innerHandle = null; if (_parent != null) { TiffPassthroughPixelBufferWriter <TSource, TDestination> parent = _parent; _parent = null; Interlocked.CompareExchange(ref parent._cachedHandle, this, null); } }
internal void SetHandle(TiffPassthroughPixelBufferWriter <TSource, TDestination> parent, TiffPixelSpanHandle <TDestination> handle, int length) { _parent = parent; _innerHandle = handle; _length = length; }