UtilColorIsColorSimilar(Color, Color, Byte) Method
Determines whether two colors are similar.
It compares the RGB channel difference to match inside the range of the specified tolerance threshold value.
Namespace: DevCase.Core.Media.GraphicsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static bool IsColorSimilar(
Color color1,
Color color2,
byte threshold
)
Public Shared Function IsColorSimilar (
color1 As Color,
color2 As Color,
threshold As Byte
) As Boolean
Dim color1 As Color
Dim color2 As Color
Dim threshold As Byte
Dim returnValue As Boolean
returnValue = UtilColor.IsColorSimilar(color1,
color2, threshold)
public:
static bool IsColorSimilar(
Color color1,
Color color2,
unsigned char threshold
)
static member IsColorSimilar :
color1 : Color *
color2 : Color *
threshold : byte -> bool
No code example is currently available or this language may not be supported.
- color1 Color
-
The first color to compare.
- color2 Color
-
The second color to compare.
- threshold Byte
-
The global tolerance threshold of the RGB color channels.
From 0 to 255.
Boolean if the colors are similar,
this means the RGB differences matches inside the range of the specified tolerance threshold value,
otherwise.
This is a code example.
No code example is currently available or this language may not be supported.
Dim result1 As Boolean = IsColorSimilar(Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 1), threshold:=1)
' Result: True
' Logic: Blue channel difference = 1, which is equal than the specified tolerance threshold value.
Dim result2 As Boolean = IsColorSimilar(Color.FromArgb(0, 0, 0), Color.FromArgb(0, 1, 1), threshold:=1)
' Result: False
' Logic: Red channel + Blue channel differences = 2, which is a bigger value than the specified tolerance threshold value.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.