Пример #1
0
        public static bool prepareLUV(String L, String u, String v)
        {
            TransformationLUVtoRGB trans = new TransformationLUVtoRGB(L, u, v);
            bool flag  = true;
            int  red   = trans.getRed();
            int  green = trans.getGreen();
            int  blue  = trans.getBlue();

            if (trans.getRed() < 0)
            {
                red  = 0;
                flag = false;
            }
            if (trans.getGreen() < 0)
            {
                green = 0;
                flag  = false;
            }
            if (trans.getBlue() < 0)
            {
                blue = 0;
                flag = false;
            }
            if (trans.getRed() > 255)
            {
                red  = 255;
                flag = false;
            }
            if (trans.getGreen() > 255)
            {
                green = 255;
                flag  = false;
            }
            if (trans.getBlue() > 255)
            {
                blue = 255;
                flag = false;
            }
            return(flag);
        }
Пример #2
0
        // For HLS
        private void setRGBFromLUV(TransformationLUVtoRGB trans)
        {
            textBoxRed.TextChanged   -= textBoxRed_TextChanged;
            textBoxGreen.TextChanged -= textBoxGreen_TextChanged;
            textBoxBlue.TextChanged  -= textBoxBlue_TextChanged;
            trackBarRed.Scroll       -= trackBarRed_Scroll;
            trackBarGreen.Scroll     -= trackBarGreen_Scroll;
            trackBarBlue.Scroll      -= trackBarBlue_Scroll;

            textBoxRed.Text     = Convert.ToString(trans.getRed());
            textBoxGreen.Text   = Convert.ToString(trans.getGreen());
            textBoxBlue.Text    = Convert.ToString(trans.getBlue());
            trackBarRed.Value   = trans.getRed();
            trackBarGreen.Value = trans.getGreen();
            trackBarBlue.Value  = trans.getBlue();

            textBoxRed.TextChanged   += textBoxRed_TextChanged;
            textBoxGreen.TextChanged += textBoxGreen_TextChanged;
            textBoxBlue.TextChanged  += textBoxBlue_TextChanged;
            trackBarRed.Scroll       += trackBarRed_Scroll;
            trackBarGreen.Scroll     += trackBarGreen_Scroll;
            trackBarBlue.Scroll      += trackBarBlue_Scroll;
        }