using System.Globalization;
using Avalonia.Data.Converters;
using OpenCvSharp;
using VisionBuilder.UI.Avalonia.Services;

namespace VisionBuilder.UI.Avalonia.Converters;

public class MatToBitmapConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value is Mat mat && !mat.Empty())
        {
            return ImageConverter.MatToAvaloniaBitmap(mat);
        }
        return null;
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
