using OpenCvSharp;

namespace Hawkeye.VisionBuilder.Workflow.ColorStudioClasses.Filters;

public class BlurFilterItem:IFilter
{
    public IFilterParent Parent { get; set; }
    public int Radius { get; set; } = 15;
    public void Transform(ref Mat image, ref Mat res)
    {
        image = image.Blur(new Size(Radius, Radius));
    }

    public void Save(BinaryWriter writer)
    {
        writer.Write(Radius);
    }

    public void Load(BinaryReader reader)
    {
        Radius = reader.ReadInt32();
    }

    public bool IsSelected { get; set; }

    public override string ToString()
    {
        return "Blur "+Radius;
    }
}