public ValueTask ReadAsync(TiffPoint offset, TiffPixelBufferWriter <TPixel> destination, CancellationToken cancellationToken) { if (_flipLeftRight) { offset = new TiffPoint(offset.X, Height - offset.Y - destination.Height); } if (_flipTopBottom) { offset = new TiffPoint(Width - offset.X - destination.Width, offset.Y); } offset = new TiffPoint(offset.Y, offset.X); destination = new TiffOrientedPixelBufferWriter <TPixel>(destination, _flipTopBottom, _flipLeftRight).AsPixelBufferWriter(); return(_reader.ReadAsync(offset, destination, cancellationToken)); }
public override void Dispose() { if (_innerHandle is null) { return; } Debug.Assert(_parent != null); _innerHandle.GetSpan().Reverse(); _innerHandle.Dispose(); TiffOrientedPixelBufferWriter <TPixel> parent = _parent !; _parent = null; _innerHandle = null; Interlocked.CompareExchange(ref parent._cachedHandle, this, null); }
internal void SetHandle(TiffOrientedPixelBufferWriter <TPixel> parent, TiffPixelSpanHandle <TPixel> handle) { _parent = parent; _innerHandle = handle; _length = handle.Length; }