using ImageMagick;
using Ocr.Tesseract.Extensions;

namespace Ocr.Tesseract.Screenshots.Threshold;

public class ThresholdAdaptiveProcessor : SingleImageProcessor
{
  private readonly int _width;
  private readonly int _height;

  public ThresholdAdaptiveProcessor(int size) : this(size, size)
  {
  }

  public ThresholdAdaptiveProcessor(int width, int height)
  {
    _width = width;
    _height = height;
  }

  /// <inheritdoc />
  protected override MagickImage Process(MagickImage image) => image
    .ThresholdAdaptive(_width, _height);

  #region Overrides of Object

  /// <inheritdoc />
  public override string ToString() => $"{nameof(ThresholdAdaptiveProcessor)}({_width:D2}_{_height:D2})";

  #endregion
}
