public void ReplaceHandler(sensor.Replace replace)
        {
            this.sensorState = replace.Body;
            this.SendNotification(this._subMgrPort, replace);

            replace.ResponsePort.Post(DefaultReplaceResponseType.Instance);
        }
Exemple #2
0
        /// <summary>
        /// Handler for new frames from the camera
        /// </summary>
        /// <param name="replace">A webcamsensor Replace message with the image</param>
        private void CameraUpdateFrameHandler(webcamsensor.Replace replace)
        {
            // Make sure that there is a form to display the image on
            if (this.cameraForm == null)
            {
                return;
            }

            var bmp     = new Bitmap(replace.Body.Width, replace.Body.Height, PixelFormat.Format24bppRgb);
            var bmpData = bmp.LockBits(
                new Rectangle(0, 0, bmp.Width, bmp.Height),
                ImageLockMode.WriteOnly,
                bmp.PixelFormat);

            Marshal.Copy(replace.Body.Data, 0, bmpData.Scan0, replace.Body.Data.Length);
            bmp.UnlockBits(bmpData);

            // MakeBitmap(frame.Size.Width, frame.Size.Height, frame.Frame);
            this.DisplayImage(bmp);
        }
 public void ReplaceHandler(webcam.Replace replace)
 {
     this.webCamPartner.Post(replace);
 }