/// <summary> /// Accepts a <see cref="IImageVisitor"/>. /// Implemented by <see cref="Image{TPixel}"/> invoking <see cref="IImageVisitor.Visit{TPixel}"/> /// with the pixel type of the image. /// </summary> /// <param name="visitor">The visitor.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> internal abstract Task AcceptAsync(IImageVisitorAsync visitor, CancellationToken cancellationToken);
/// <inheritdoc /> internal override Task AcceptAsync(IImageVisitorAsync visitor, CancellationToken cancellationToken) { this.EnsureNotDisposed(); return(visitor.VisitAsync(this, cancellationToken)); }
/// <summary> /// Accepts a <see cref="IImageVisitor"/>. /// Implemented by <see cref="Image{TPixel}"/> invoking <see cref="IImageVisitor.Visit{TPixel}"/> /// with the pixel type of the image. /// </summary> /// <param name="visitor">The visitor.</param> internal abstract Task AcceptAsync(IImageVisitorAsync visitor);
/// <inheritdoc /> internal override Task AcceptAsync(IImageVisitorAsync visitor) { this.EnsureNotDisposed(); return(visitor.VisitAsync(this)); }
/// <summary> /// Accepts a <see cref="IImageVisitor"/> to implement a double-dispatch pattern in order to /// apply pixel-specific operations on non-generic <see cref="Image"/> instances /// </summary> /// <param name="source">The source image.</param> /// <param name="visitor">The image visitor.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public static Task AcceptVisitorAsync(this Image source, IImageVisitorAsync visitor) => source.AcceptAsync(visitor);
/// <summary> /// Accepts a <see cref="IImageVisitor"/> to implement a double-dispatch pattern in order to /// apply pixel-specific operations on non-generic <see cref="Image"/> instances /// </summary> /// <param name="source">The source image.</param> /// <param name="visitor">The image visitor.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public static Task AcceptVisitorAsync(this Image source, IImageVisitorAsync visitor, CancellationToken cancellationToken = default) => source.AcceptAsync(visitor, cancellationToken);