728x90
반응형
728x170
using System.Drawing;
using System.Drawing.Imaging;
#region 비슷한 색상 구하기 - GetSimilarColor(colorPalette, color)
/// <summary>
/// 비슷한 색상 구하기
/// </summary>
/// <param name="colorPalette">색상 팔레트</param>
/// <param name="color">색상</param>
/// <returns>유사 색상</returns>
public byte GetSimilarColor(ColorPalette colorPalette, Color color)
{
byte minimumDifference = byte.MaxValue;
byte index = 0;
byte currentDifference;
for(int i = 0; i < colorPalette.Entries.Length - 1; i++)
{
currentDifference = GetMaximumDifference(color, colorPalette.Entries[i]);
if(currentDifference < minimumDifference)
{
minimumDifference = currentDifference;
index = (byte)i;
}
}
return index;
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] 라운드 사각형 그리기 (0) | 2015.02.01 |
---|---|
[C#/WINFORM] 사각형 그리기 (0) | 2015.02.01 |
[C#/WINFORM] 사각형 칠하기 (0) | 2015.02.01 |
[C#/WINFORM] 원에서 특정 각도 포인트 구하기 (0) | 2015.01.31 |
[C#/WINFORM] 범위 색상 구하기 (0) | 2015.01.31 |
[C#/WINFORM] 16진수 색상 코드 구하기 (0) | 2015.01.31 |
[C#/WINFORM] 색상 정렬 리스트 구하기 (0) | 2015.01.31 |
[C#/WINFORM] RGB 구하기 (0) | 2015.01.31 |
[C#/WINFORM] BGRA 구하기 (0) | 2015.01.31 |
[C#/WINFORM] RGBA 구하기 (0) | 2015.01.31 |
댓글을 달아 주세요