Namespace Nexamas.UI.Verification

    ''' <summary>
    ''' Pixel comparison tolerance for screenshot diffs.
    ''' ChannelTolerance absorbs tiny antialiasing differences while MaxDifferentPixelRatio controls whole-image drift.
    ''' </summary>
    Friend NotInheritable Class MASRenderDiffSettings

        Friend Sub New(Optional channelTolerance As Integer = 2, Optional maxDifferentPixelRatio As Double = 0.0R)
            Me.ChannelTolerance = Math.Max(0, Math.Min(255, channelTolerance))
            Me.MaxDifferentPixelRatio = Math.Max(0.0R, maxDifferentPixelRatio)
        End Sub

        Friend ReadOnly Property ChannelTolerance As Integer
        Friend ReadOnly Property MaxDifferentPixelRatio As Double

        Friend Shared ReadOnly Property Strict As MASRenderDiffSettings
            Get
                Return New MASRenderDiffSettings(0, 0.0R)
            End Get
        End Property

        Friend Shared ReadOnly Property DefaultTolerance As MASRenderDiffSettings
            Get
                Return New MASRenderDiffSettings(2, 0.0R)
            End Get
        End Property

    End Class

End Namespace
