Example #1
0
    /// <summary>
    /// 强度更改入口
    /// </summary>
    /// <param name="Currentcolor"></param>
    /// <param name="value"></param>
    /// <param name="call"></param>
    public void ChangeExposeure(Color Currentcolor, float value, ColorChangBack call)
    {
        float num = 0;

        //identy = 0;
        this.callBack = call;
        //计算强度
        //算一算当前的比例
        float[] colorNumArr = new float[3] {
            (Currentcolor.r), Currentcolor.g, Currentcolor.b
        };
        //找出最大的
        for (int i = 0; i < colorNumArr.Length; i++)
        {
            if (colorNumArr[i] > num)
            {
                num = colorNumArr[i];
            }
        }
        if (num.Equals(0))  //当前的RGB值是0
        {
            num          = 0;
            Currentcolor = new Color(1, 1, 1);
        }
        else
        {
            Currentcolor = Currentcolor / num;
        }
        callBack.Invoke(Currentcolor, value);
    }
Example #2
0
    /// <summary>
    /// 控制显示 计算强度
    /// </summary>
    public void Show(Color Currentcolor, ColorChangBack callBack, bool isNeedHDR = false)
    {
        this.isNeedHDR = isNeedHDR;
        this.callBack  = callBack;
        open();

        if (isNeedHDR)
        {
            identy = 0;

            //计算强度
            //算一算当前的比例
            float[] colorNumArr = new float[3] {
                (Currentcolor.r), Currentcolor.g, Currentcolor.b
            };
            //找出最大的
            for (int i = 0; i < colorNumArr.Length; i++)
            {
                if (colorNumArr[i] > identy)
                {
                    identy = colorNumArr[i];
                }
            }
            if (identy.Equals(0))  //当前的RGB值是0
            {
                identy       = 0;
                Currentcolor = new Color(1, 1, 1);
            }
            else
            {
                Currentcolor = Currentcolor / identy;
            }
        }
        else
        {
            identy = 1;
        }
        Init(Currentcolor);
    }