첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.

728x90
반응형
728x170
using System;
using System.Drawing;

#region 색상 구하기 - GetColor(color1, color2, proportion)

/// <summary>
/// 색상 구하기
/// </summary>
/// <param name="color1">색상1</param>
/// <param name="color2">색상2</param>
/// <param name="proportion">비율</param>
/// <returns>색상</returns>
public Color GetColor(Color color1, Color color2, double proportion)
{
    double inverseProportion = 1d - proportion;

    int red   = (int)(color1.R * proportion + color2.R * inverseProportion);
    int green = (int)(color1.G * proportion + color2.G * inverseProportion);
    int blue  = (int)(color1.B * proportion + color2.B * inverseProportion);

    red   = Math.Min(Math.Max(0, red)  , 255);
    green = Math.Min(Math.Max(0, green), 255);
    blue  = Math.Min(Math.Max(0, blue) , 255);

    return Color.FromArgb(red, green, blue);
}

#endregion
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요