示例#1
0
        private void capture()
        {
            for (ushort i = 0; i < MaxPort; i++)
            {
                Angelo.AngeloRTV_Capture_Stop(i);
            }
            ushort Multi;

            PortNo       = ushort.Parse(comboBox_port.SelectedItem.ToString());//selected port
            Channel      = ushort.Parse(comboBox_channel.SelectedItem.ToString());
            Multi        = (ushort)System.Math.Pow(2, Channel);
            Video_Format = (byte)(comboBox_format.SelectedIndex);
            switch (comboBox_color.SelectedIndex)//selected color format
            {
            default:
            case 0:    //gray
                Color_Format = 1;
                Byte_Pixel   = 1;
                color        = System.Drawing.Imaging.PixelFormat.Format8bppIndexed;
                break;

            case 1:    //rgb15
                Color_Format = 2;
                Byte_Pixel   = 2;
                color        = System.Drawing.Imaging.PixelFormat.Format16bppRgb555;
                break;

            case 2:    //rgb16
                Color_Format = 0;
                Byte_Pixel   = 2;
                color        = System.Drawing.Imaging.PixelFormat.Format16bppRgb565;
                break;

            case 3:    //rgb24
                Color_Format = 3;
                Byte_Pixel   = 3;
                color        = System.Drawing.Imaging.PixelFormat.Format24bppRgb;
                break;

            case 4:    //rgb32
                Color_Format = 4;
                Byte_Pixel   = 4;
                color        = System.Drawing.Imaging.PixelFormat.Format32bppRgb;
                break;
            }
            Angelo.AngeloRTV_Set_Callback(PortNo, null);
            Angelo.AngeloRTV_Set_Callback(PortNo, mycallback);//connect CallBackProc Function though mycallback
            Angelo.AngeloRTV_Set_Color_Format(PortNo, Color_Format);
            Angelo.AngeloRTV_Set_Video_Format(PortNo, Video_Format);
            Angelo.AngeloRTV_Select_Channel(PortNo, Multi);
        }
示例#2
0
        private void capture()
        {
            for (ushort i = 0; i < MaxPort; i++)
            {
                Angelo.AngeloRTV_Capture_Stop(i);
            }
            ushort Multi;

            PortNo       = ushort.Parse(comboBox_port.SelectedItem.ToString());    //selected port
            Channel      = ushort.Parse(comboBox_channel.SelectedItem.ToString()); //selected channel
            Multi        = (ushort)System.Math.Pow(2, Channel);
            Video_Format = (byte)(comboBox_format.SelectedIndex);                  //selected Video format

            switch (comboBox_color.SelectedIndex)                                  //selected color format
            {
            default:
            case 0:    //gray
                Color_Format = 1;
                Byte_Pixel   = 1;
                color        = System.Drawing.Imaging.PixelFormat.Format8bppIndexed;
                break;

            case 1:    //rgb15
                Color_Format = 2;
                Byte_Pixel   = 2;
                color        = System.Drawing.Imaging.PixelFormat.Format16bppRgb555;
                break;

            case 2:    //rgb16
                Color_Format = 0;
                Byte_Pixel   = 2;
                color        = System.Drawing.Imaging.PixelFormat.Format16bppRgb565;
                break;

            case 3:    //rgb24
                Color_Format = 3;
                Byte_Pixel   = 3;
                color        = System.Drawing.Imaging.PixelFormat.Format24bppRgb;
                break;

            case 4:    //rgb32
                Color_Format = 4;
                Byte_Pixel   = 4;
                color        = System.Drawing.Imaging.PixelFormat.Format32bppRgb;
                break;
            }

            #region disconstruct



            Angelo.AngeloRTV_Set_Callback(PortNo, null);
            if (mythread != null)
            {
                ISR_ON = false;  //let ThreadProc go out the loop
                hEvent.Set();
                mythread.Join(); //mainthread will continue afer other threads ending
                mythread = null;
            }
            #endregion

            if (comboBox_interrupt.SelectedIndex == 1)//selected callback or thread
            {
                ISR_ON = true;
                Angelo.AngeloRTV_Set_Int_Event(PortNo, ref Event);  //set dll event
                mythread = new Thread(new ThreadStart(ThreadProc)); //create thread
                mythread.Start();                                   //start thread
            }
            else
            {
                Angelo.AngeloRTV_Set_Callback(PortNo, mycallback);//connect CallBackProc Function though mycallback
            }
            Angelo.AngeloRTV_Set_Color_Format(PortNo, Color_Format);
            Angelo.AngeloRTV_Set_Video_Format(PortNo, Video_Format);
            Angelo.AngeloRTV_Select_Channel(PortNo, Multi);
        }