Esempio n. 1
0
        private void CapturaPantalla()
        {
            Rectangle bounds  = Screen.GetBounds(Screen.GetBounds(Point.Empty));
            string    fi      = ".png";
            Size      curSize = default(Size);
            Point     curPos  = default(Point);

            DateTime Hoy        = DateTime.Now;
            string   archivo    = Hoy.ToString("yyyyMMddHHmmss") + "-SS";
            string   Path       = ConfigurationManager.AppSettings["Path"].ToString();
            string   ScreenPath = $@"{Path}{archivo}.png";

            ScreenShot.CaptureImage(true, curSize, curPos,
                                    Point.Empty, Point.Empty, bounds, ScreenPath, fi);
        }
Esempio n. 2
0
        private void screenShotBtn_Click(object sender, EventArgs e)
        {
            //Allow 250 milliseconds for the screen to repaint itself
            //(we don't want to include this form in the capture)
            System.Threading.Thread.Sleep(250);

            Rectangle bounds = Screen.GetBounds(Screen.GetBounds(Point.Empty));
            string    fi     = "";

            if (ScreenPath != "")
            {
                fi = new FileInfo(ScreenPath).Extension;
            }

            ScreenShot.CaptureImage(showCursor, curSize, curPos,
                                    Point.Empty, Point.Empty, bounds, ScreenPath, fi);
        }
Esempio n. 3
0
        void Calculate()
        {
            Rectangle bounds = new Rectangle(0, 0, Monitor_Width, Monitor_Height);


            Point[] stripPos_array = new Point[stripPos.Count];
            stripPos.CopyTo(stripPos_array, 0);

            byte[] LEDarray = new Byte[stripPos.Count * 3];
            LEDarray = ScreenShot.CaptureImage(bounds, stripPos_array);
            if ((LEDarray[0] == 255) && (LEDarray[0] == 254) && (LEDarray[0] == 253) && (LEDarray[0] == 252))
            {
                return;
            }


            // BLACK STRIPE ELIMINATOR
            if (Black_Stripe_Eliminator)
            {
                BSD_i++;
                if (BSD_i > 20)
                {
                    Black_Stripe_Detected = true;
                    BSD_i = 0;
                }


                for (int i = 0; i < Black_Stripe_Pos.Count; i++)
                {
                    if ((LEDarray[3 * Black_Stripe_Pos[i] + 0] + LEDarray[3 * Black_Stripe_Pos[i] + 1] + LEDarray[3 * Black_Stripe_Pos[i] + 2]) > Black_Stripe_Threshold)
                    {
                        Black_Stripe_Detected = false;
                        BSD_i = 1;
                    }
                }

                if (Black_Stripe_Detected)
                {
                    Console.Beep();
                    Black_Stripe_Detected = false;
                    BSD_width            += 5; // increase the stripe +5 pixel
                    Set_LED_Positions(8, BSD_width + 8, "2D");
                    return;
                }
            }
            // END of BLACK STRIPE ELIMINATOR


            int r = 0;
            int g = 0;
            int b = 0;
            //int i = 0;

            float led_oran     = (float)stripPos.Count() / TOTAL_LED_COUNT;// +1;
            int   Tx_Buffer_ID = 0;

            for (int i = 0; i < LEDarray.Length; i += 3)
            {
                r += LEDarray[i + 0];
                g += LEDarray[i + 1];
                b += LEDarray[i + 2];



                if ((i / 3) % led_oran >= led_oran - 1)
                {
                    r = (int)(r / led_oran);
                    g = (int)(g / led_oran);
                    b = (int)(b / led_oran);

                    //r = (int)(r * POWER_LEVEL * 0.9);
                    //g = (int)(g * POWER_LEVEL * 1.0);
                    //b = (int)(b * POWER_LEVEL * 0.85);

                    r = (int)(r * POWER_LEVEL * 1.0);
                    g = (int)(g * POWER_LEVEL * 1.0);
                    b = (int)(b * POWER_LEVEL * 1.0);

                    if (r > 250)
                    {
                        r = 250;
                    }
                    if (g > 250)
                    {
                        g = 250;
                    }
                    if (b > 250)
                    {
                        b = 250;
                    }

                    //stripColor[Tx_Buffer_ID] = Color.FromArgb(r , g , b );
                    COM_Tx_Buffer[(Tx_Buffer_ID * 3) + 1] = (byte)(r); //GammaE[(byte)(r)]; //RedRamp[(byte)(r)];// gamma8[(byte)(r)];
                    COM_Tx_Buffer[(Tx_Buffer_ID * 3) + 2] = (byte)(g); //GammaE[(byte)(g)];//GreenRamp[(byte)(g)];// gamma8[(byte)(g)];
                    COM_Tx_Buffer[(Tx_Buffer_ID * 3) + 3] = (byte)(b); // GammaE[(byte)(b)];//BlueRamp[(byte)(b)];// gamma8[(byte)(b)];
                    r = 0;
                    g = 0;
                    b = 0;

                    Tx_Buffer_ID++;
                }
            }
        }