첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System.Drawing;

/// <summary>
/// HSV 색상
/// </summary>
public struct HSVColor
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Field
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region Field

    /// <summary>
    /// 색상
    /// </summary>
    public double H;

    /// <summary>
    /// 채도
    /// </summary>
    public double S;

    /// <summary>
    /// 명도
    /// </summary>
    public double V;

    #endregion

    //////////////////////////////////////////////////////////////////////////////////////////////////// Field
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - HSVColor(hue, saturation, value)

    /// <summary>
    /// 생성자
    /// </summary>
    /// <param name="hue">색상</param>
    /// <param name="saturation">채도</param>
    /// <param name="value">명도</param>
    public HSVColor(double hue, double saturation, double value)
    {
        H = hue;
        S = saturation;
        V = value;
    }

    #endregion
}

#region HSV 색상 구하기 - GetHSVColor(red, blue, green)

/// <summary>
/// HSV 색상 구하기
/// </summary>
/// <param name="red">빨간색</param>
/// <param name="blue">파란색</param>
/// <param name="green">녹색</param>
/// <returns>HSV 색상</returns>
public HSVColor GetHSVColor(int red, int blue, int green)
{
    Color otherColor = Color.FromArgb(255, red, blue, green);
            
    return new HSVColor
    (
        otherColor.GetHue(), 
        otherColor.GetSaturation(), 
        otherColor.GetBrightness()
    );
}

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

댓글을 달아 주세요