Ejemplo n.º 1
0
 public void UpdateNewColor(Color color)
 {
     m_newColor     = color;
     m_newColorHSV  = new ColorHSV(m_newColor);
     m_newColorLab  = new ColorLab(m_newColor);
     m_newColorHex  = new ColorHex(m_newColor);
     m_newColorCMYK = new ColorCMYK(m_newColor);
     Refresh();
 }
Ejemplo n.º 2
0
 public void InputChangedLab_b(string str)
 {
     if (str == "" || str == "-" || inputFieldLock)
     {
         return;
     }
     m_newColorLab.b = Mathf.Clamp(int.Parse(str), -128, 127);
     m_newColor      = m_newColorLab.ToColor();
     m_newColorHSV   = new ColorHSV(m_newColor);
     m_newColorHex   = new ColorHex(m_newColor);
     m_newColorCMYK  = new ColorCMYK(m_newColor);
     RefreshInputField();
 }
Ejemplo n.º 3
0
 public void InputChangedHex(string str)
 {
     if (str == m_newColorHex.hex || inputFieldLock)
     {
         return;
     }
     m_newColorHex  = new ColorHex(str);
     m_newColor     = m_newColorHex.ToColor();
     m_newColorHSV  = new ColorHSV(m_newColor);
     m_newColorLab  = new ColorLab(m_newColor);
     m_newColorCMYK = new ColorCMYK(m_newColor);
     RefreshInputField();
     RefreshPicker();
 }
Ejemplo n.º 4
0
 public void InputChangedRGB_B(string str)
 {
     if (str == "" || str == "-" || inputFieldLock)
     {
         return;
     }
     m_newColor.b   = Mathf.Clamp01(int.Parse(str) / 255.0f);
     m_newColorHSV  = new ColorHSV(m_newColor);
     m_newColorLab  = new ColorLab(m_newColor);
     m_newColorHex  = new ColorHex(m_newColor);
     m_newColorCMYK = new ColorCMYK(m_newColor);
     RefreshInputField();
     RefreshPicker();
 }
Ejemplo n.º 5
0
 public void InputChangedHSV_V(string str)
 {
     if (str == "" || str == "-" || inputFieldLock)
     {
         return;
     }
     m_newColorHSV.v = Mathf.Clamp01(int.Parse(str) / 100.0f);
     m_newColor      = m_newColorHSV.ToColor();
     m_newColorLab   = new ColorLab(m_newColor);
     m_newColorHex   = new ColorHex(m_newColor);
     m_newColorCMYK  = new ColorCMYK(m_newColor);
     RefreshInputField();
     RefreshPicker();
 }
Ejemplo n.º 6
0
        public void RefreshColor()
        {
            try
            {
                switch (mode)
                {
                case Mode.HSV_H:
                {
                    float h = pickBar.value * 360.0f;
                    float s = pickArea.value.x;
                    float v = pickArea.value.y;

                    m_newColorHSV = new ColorHSV(h, s, v);
                    m_newColor    = m_newColorHSV.ToColor();
                    m_newColorLab = new ColorLab(m_newColor);
                }
                break;

                case Mode.HSV_S:
                {
                    float h = pickArea.value.x * 360.0f;
                    float s = pickBar.value;
                    float v = pickArea.value.y;

                    m_newColorHSV = new ColorHSV(h, s, v);
                    m_newColor    = m_newColorHSV.ToColor();
                    m_newColorLab = new ColorLab(m_newColor);
                }
                break;

                case Mode.HSV_V:
                {
                    float h = pickArea.value.x * 360.0f;
                    float s = pickArea.value.y;
                    float v = pickBar.value;

                    m_newColorHSV = new ColorHSV(h, s, v);
                    m_newColor    = m_newColorHSV.ToColor();
                    m_newColorLab = new ColorLab(m_newColor);
                }
                break;

                case Mode.RGB_R:
                {
                    float r = pickBar.value;
                    float g = pickArea.value.y;
                    float b = pickArea.value.x;

                    m_newColor    = new Color(r, g, b);
                    m_newColorHSV = new ColorHSV(m_newColor);
                    m_newColorLab = new ColorLab(m_newColor);
                }
                break;

                case Mode.RGB_G:
                {
                    float r = pickArea.value.y;
                    float g = pickBar.value;
                    float b = pickArea.value.x;

                    m_newColor    = new Color(r, g, b);
                    m_newColorHSV = new ColorHSV(m_newColor);
                    m_newColorLab = new ColorLab(m_newColor);
                }
                break;

                case Mode.RGB_B:
                {
                    float r = pickArea.value.x;
                    float g = pickArea.value.y;
                    float b = pickBar.value;

                    m_newColor    = new Color(r, g, b);
                    m_newColorHSV = new ColorHSV(m_newColor);
                    m_newColorLab = new ColorLab(m_newColor);
                }
                break;

                case Mode.Lab_L:
                {
                    float L = pickBar.value * 100.0f;
                    float a = pickArea.value.x * 255.0f - 128.0f;
                    float b = pickArea.value.y * 255.0f - 128.0f;

                    m_newColorLab = new ColorLab(L, a, b);
                    m_newColor    = m_newColorLab.ToColor();
                    m_newColorHSV = new ColorHSV(m_newColor);
                }
                break;

                case Mode.Lab_a:
                {
                    float L = pickArea.value.y * 100.0f;
                    float a = pickBar.value * 255.0f - 128.0f;
                    float b = pickArea.value.x * 255.0f - 128.0f;

                    m_newColorLab = new ColorLab(L, a, b);
                    m_newColor    = m_newColorLab.ToColor();
                    m_newColorHSV = new ColorHSV(m_newColor);
                }
                break;

                case Mode.Lab_b:
                {
                    float L = pickArea.value.y * 100.0f;
                    float a = pickArea.value.x * 255.0f - 128.0f;
                    float b = pickBar.value * 255.0f - 128.0f;

                    m_newColorLab = new ColorLab(L, a, b);
                    m_newColor    = m_newColorLab.ToColor();
                    m_newColorHSV = new ColorHSV(m_newColor);
                }
                break;

                default:
                    break;
                }

                m_newColorHex  = new ColorHex(m_newColor);
                m_newColorCMYK = new ColorCMYK(m_newColor);
            } catch
            {
            }
            RefreshInputField();
        }