1
당신이 내 색상 C# 컬러
일치를 도와 줄 수 일치 나는 그것이 작동하지 않았다 몇 가지 코드를 검색하려고 아니라내 논리가 5 % 또는 10 % 가까운 같은 조정 허용 오차, 아래처럼 색상 :
Red and Light Red = True
Red and Dark Red = True
Red and black = False
여기 내 코드는하지만 어쩌면
public static bool MatchArgb(int Argb1, int Argb2, int tolerance)
{
Color c1 = Color.FromArgb(Argb1);
Color c2 = Color.FromArgb(Argb2);
return Math.Abs(c1.R - c2.R) <= tolerance^
Math.Abs(c1.G - c2.G) <= tolerance^
Math.Abs(c1.B - c2.B) <= tolerance;
}
public static bool MatchColor(Color c1, Color c2, int tolerance)
{
return Math.Abs(c1.R - c2.R) <= tolerance^
Math.Abs(c1.G - c2.G) <= tolerance^
Math.Abs(c1.B - c2.B) <= tolerance;
}
감사합니다. 30 공차에 :) – ayanix