예제 #1
0
        private void colorCells()
        {
            List <HSV> list = HSVSerializer.getHSVTableFromValueGainBlack(Value, Gain, IsBlack);

            foreach (HSV hsv in list)
            {
                if (ForcedH || ForcedS || ForcedV)
                {
                    double h = ForcedH ? (double)numericUpDownH.Value : hsv.H;
                    double s = ForcedS ? (double)numericUpDownS.Value : hsv.S;
                    double v = ForcedV ? (double)numericUpDownV.Value : hsv.V;

                    table.Rows[16 - hsv.Y].Cells[hsv.X - 1].Style.BackColor = HSV.ColorFromHSV(h, s, v);
                }
                else
                {
                    table.Rows[16 - hsv.Y].Cells[hsv.X - 1].Style.BackColor = Color.FromArgb(hsv.R, hsv.G, hsv.B);
                }
            }
        }
예제 #2
0
        private void readAndShow()
        {
            try
            {
                OcrResult res     = Ocr.Read(getScreenImage());
                string    ocrText = res.Text;


                HSV hsv = new HSV(ocrText, 0, 0, 0, 0);

                button1.ForeColor = Color.LimeGreen;

                panel1.BackColor = Color.FromArgb(hsv.R, hsv.G, hsv.B);
            }
            catch (Exception)
            {
                panel1.BackColor = Color.Black;

                button1.ForeColor = Color.OrangeRed;

                return;
            }
        }
예제 #3
0
        private void performReadAndSave()
        {
            try
            {
                OcrResult res     = Ocr.Read(getScreenImage());
                string    ocrText = res.Text;

                int x = currentCell.ColumnIndex + 1;
                int y = 16 - currentCell.RowIndex;

                labelCol.Text = "X: " + x;
                labelRow.Text = "Y: " + y;

                HSV hsv = new HSV(ocrText, x, y, Gain, Value);

                label26.ForeColor = Color.LimeGreen;
                label26.Text      = "OK";

                label1.Text  = hsv.H.ToString("N3");
                label2.Text  = hsv.S.ToString("N3");
                label3.Text  = hsv.V.ToString("N2");
                label25.Text = hsv.R.ToString();
                label24.Text = hsv.G.ToString();
                label23.Text = hsv.B.ToString();

                HSVSerializer.registerHSV(hsv);

                panel3.BackColor = Color.FromArgb(hsv.R, hsv.G, hsv.B);


                if (ForcedH || ForcedS || ForcedV)
                {
                    double h = ForcedH ? (double)numericUpDownH.Value : hsv.H;
                    double s = ForcedS ? (double)numericUpDownS.Value : hsv.S;
                    double v = ForcedV ? (double)numericUpDownV.Value : hsv.V;

                    table.Rows[16 - hsv.Y].Cells[hsv.X - 1].Style.BackColor = HSV.ColorFromHSV(h, s, v);
                }
                else
                {
                    table.Rows[16 - hsv.Y].Cells[hsv.X - 1].Style.BackColor = Color.FromArgb(hsv.R, hsv.G, hsv.B);
                }


                table_SelectionChanged(null, null);
            }
            catch (Exception)
            {
                label26.ForeColor = Color.Red;
                label26.Text      = "Failed";

                label1.Text                      =
                    label2.Text                  =
                        label3.Text              =
                            label25.Text         =
                                label24.Text     =
                                    label23.Text = "???";

                panel3.BackColor = Color.Transparent;

                return;
            }


            //string R = ocrText.Substring(30, 6).Replace('.', ',');
            //string G = ocrText.Substring(40, 6).Replace('.', ',');
            //string B = ocrText.Substring(50, 6).Replace('.', ',');

            //double r = Math.Round(double.Parse(R), 3);
            //double g = Math.Round(double.Parse(G), 3);
            //double b = Math.Round(double.Parse(B), 3);

            //label25.Text = "R: " + R;
            //label24.Text = "G: " + G;
            //label23.Text = "B: " + B;
        }