using System;
using System.Collections.Generic;
using System.Text;

namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
{
    /// <summary>
    /// 类      名：ColorHSV
    /// 功      能：H 色相 \ S 饱和度(纯度) \ V 明度 颜色模型 
    /// </summary>
    public class ColorHSV
    {
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="h"></param>
        /// <param name="s"></param>
        /// <param name="v"></param>
        public ColorHSV(int h, int s, int v)
        {
            this._h = h;
            this._s = s;
            this._v = v;
        }

        private int _h;
        private int _s;
        private int _v;

        /// <summary>
        /// 色相
        /// </summary>
        public int H
        {
            get { return this._h; }
            set
            {
                this._h = value;
                this._h = this._h > 360 ? 360 : this._h;
                this._h = this._h < 0 ? 0 : this._h;
            }
        }

        /// <summary>
        /// 饱和度(纯度)
        /// </summary>
        public int S
        {
            get { return this._s; }
            set
            {
                this._s = value;
                this._s = this._s > 255 ? 255 : this._s;
                this._s = this._s < 0 ? 0 : this._s;
            }
        }

        /// <summary>
        /// 明度
        /// </summary>
        public int V
        {
            get { return this._v; }
            set
            {
                this._v = value;
                this._v = this._v > 255 ? 255 : this._v;
                this._v = this._v < 0 ? 0 : this._v;
            }
        }
    }
}
