ColorExtensionsTolerantEquals(Color32, Color32, Byte, Byte) Method

Gets whether two Color32 instances are equal using a specified tolerance.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.2.0
C#
public static bool TolerantEquals(
	this Color32 c1,
	Color32 c2,
	byte tolerance,
	byte alphaThreshold = 0
)

Parameters

c1  Color32
The first color to compare.
c2  Color32
The second color to compare.
tolerance  Byte
The allowed tolerance for ARGB components.
alphaThreshold  Byte  (Optional)
Specifies a threshold under which colors are considered transparent. If both colors have lower A value than the threshold, then they are considered equal. If only one of the specified colors has lower A value than the threshold, then the colors are considered different. If both colors' A value are equal to or greater than this value, then tolerance is applied to the A value, too. This parameter is optional.
Default value: 0.

Return Value

Boolean
, if the colors are considered equal with the specified tolerance; otherwise, .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Color32. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also