Beispiel #1
0
 private void Form4_SizeChanged(object sender, EventArgs e)
 {
     if (m_View != null)
     {
         float WidthScalor  = (float)(this.Size.Width) / m_Buffers.Width;
         float HeightScalor = (float)(this.Size.Height) / m_Buffers.Height;
         m_View.SetScalingMode(WidthScalor, HeightScalor);
         m_ImageBox.OnSize();
     }
 }
Beispiel #2
0
        void InitCam(int n)
        {
            DestroyObjects();
            DisposeObjects();
            m_ServerLocation = new SapLocation("X64-CL_iPro_1", 0);
            m_ConfigFileName = "IAG3.ccf";
            // define on-line object
            m_Acquisition = new SapAcquisition(m_ServerLocation, m_ConfigFileName);

            m_Buffers = new SapBufferWithTrash(n, m_Acquisition, SapBuffer.MemoryType.ScatterGather);

            m_Buffers.PixelDepth = SystemParam.cmosInfo.PixelDepth;
            m_Buffers.Format     = SapFormat.Mono16;
            m_Buffers.Height     = SystemParam.cmosInfo.ColPixels;
            m_Buffers.Width      = SystemParam.cmosInfo.RowPixels;
            m_Xfer = new SapAcqToBuf(m_Acquisition, m_Buffers);
            m_View = new SapView(m_Buffers);
            m_View.SetScalingMode(true);

            //event for view
            m_Xfer.Pairs[0].EventType = SapXferPair.XferEventType.EndOfFrame;
            m_Xfer.XferNotify        += new SapXferNotifyHandler(xfer_XferNotify1);
            m_Xfer.XferNotifyContext  = this;

            // event for signal status
            m_Acquisition.SignalNotify       += new SapSignalNotifyHandler(GetSignalStatus1);
            m_Acquisition.SignalNotifyContext = this;

            m_ImageBox.View = m_View;
            while (true)
            {
                try
                {
                    if (!CreateObjects())
                    {
                        DisposeObjects();
                        WFNetLib.WFGlobal.WaitMS(20);
                        continue;
                    }
                    break;
                }
                catch
                {
                    WFNetLib.WFGlobal.WaitMS(20);
                }
            }
            float WidthScalor  = (float)(this.Size.Width) / m_Buffers.Width;
            float HeightScalor = (float)(this.Size.Height) / m_Buffers.Height;

            m_View.SetScalingMode(WidthScalor, HeightScalor);
            m_ImageBox.OnSize();
            EnableSignalStatus();
            SystemParam.ByteLen4Pic = SystemParam.Pixel4Pic * m_Buffers.BytesPerPixel;
            m_Xfer.Grab();
        }
Beispiel #3
0
        void InitCam(int n)
        {
            while (true)
            {
                try
                {
                    DestroyObjects();
                    DisposeObjects();
                    m_ServerLocation = new SapLocation("X64-CL_iPro_1", 0);
                    m_ConfigFileName = SystemParam.ccfPath;//@"C:\Program Files\Teledyne DALSA\Sapera\CamFiles\User\w512x512.ccf";
                    // define on-line object
                    m_Acquisition = new SapAcquisition(m_ServerLocation, m_ConfigFileName);

                    m_Buffers = new SapBufferWithTrash(n, m_Acquisition, SapBuffer.MemoryType.ScatterGather);


                    m_Xfer = new SapAcqToBuf(m_Acquisition, m_Buffers);
                    //                 m_View = new SapView(m_Buffers);
                    //                 m_View.SetScalingMode(true);

                    //event for view
                    m_Xfer.Pairs[0].EventType = SapXferPair.XferEventType.EndOfFrame;
                    m_Xfer.XferNotify        += new SapXferNotifyHandler(xfer_XferNotify1);
                    m_Xfer.XferNotifyContext  = this;

                    // event for signal status
                    m_Acquisition.SignalNotify       += new SapSignalNotifyHandler(GetSignalStatus1);
                    m_Acquisition.SignalNotifyContext = this;
                    m_View = new SapView(m_Buffers);
                    m_View.SetScalingMode(true);
                    m_ImageBox.View = m_View;
                    while (true)
                    {
                        try
                        {
                            if (!CreateObjects())
                            {
                                DisposeObjects();
                                WFNetLib.WFGlobal.WaitMS(20);
                                continue;
                            }
                            break;
                        }
                        catch
                        {
                            WFNetLib.WFGlobal.WaitMS(20);
                        }
                    }
                    //                     SystemParam.cmosInfo.PixelDepth = m_Buffers.PixelDepth;
                    //                     SystemParam.cmosInfo.ColPixels = m_Buffers.Height;
                    //                     SystemParam.cmosInfo.RowPixels = m_Buffers.Width;
                    if (SystemParam.cmosInfo.bRGB != 0)
                    {
                        wfSapGUI.GetRGBPixelInfo(m_Buffers.Width, m_Buffers.Height, SystemParam.cmosInfo.RGB1, SystemParam.cmosInfo.RGB2, SystemParam.cmosInfo.RGB3, SystemParam.cmosInfo.RGB4);
                    }
                    SystemParam.Pixel4Pic = m_Buffers.Height * m_Buffers.Width;//(int)SystemParam.cmosInfo.ColPixels * SystemParam.cmosInfo.RowPixels;
                    float WidthScalor  = (float)(this.Size.Width) / m_Buffers.Width;
                    float HeightScalor = (float)(this.Size.Height) / m_Buffers.Height;

                    m_View.SetScalingMode(WidthScalor, HeightScalor);
                    m_ImageBox.OnSize();
                    EnableSignalStatus();
                    SystemParam.ByteLen4Pic = SystemParam.Pixel4Pic * m_Buffers.BytesPerPixel;
                    m_Xfer.Grab();
                    return;
                }
                catch
                {
                }
            }
        }