コード例 #1
0
        private void drawLatestImage(object sender, PaintEventArgs e)
        {
            if (_latestFrame != null)
            {
                // Draw the latest image from the active camera
                e.Graphics.DrawImage(_latestFrame, 0, 0, pictureBoxDisplay.Width, pictureBoxDisplay.Height);

                // Draw the selection adornment
                if (_drawSelectionAdornment)
                {
                    Pen pen = new Pen(Brushes.Red, 1);
                    e.Graphics.DrawEllipse(pen, _markerCenter.X - _markerRadius, _markerCenter.Y - _markerRadius, 2 * _markerRadius, 2 * _markerRadius);
                }

                if (radioButtonDemo.Checked)
                {
                    if (_drawDemo != null)
                    {
                        _drawDemo.drawCanvas(e.Graphics);
                    }
                    else if (_snakeDemo != null)
                    {
                        _snakeDemo.drawCanvas(e.Graphics);
                    }
                    else if (_imageDemo != null)
                    {
                        _imageDemo.drawCanvas(e.Graphics);
                    }
                    else if (_defendDemo != null)
                    {
                        _defendDemo.drawCanvas(e.Graphics);
                    }
                }
            }
        }
コード例 #2
0
        private void drawLatestImage(object sender, PaintEventArgs e)
        {
            if (_latestFrame != null)
            {
                // Draw the latest image from the active camera
                //_latestFrame.RotateFlip(RotateFlipType.RotateNoneFlipX);
                if (!radioButtonDemo.Checked || checkBoxUseCamera.Checked)
                {
                    e.Graphics.DrawImage(_latestFrame, 0, 0, pictureBoxDisplay.Width, pictureBoxDisplay.Height);
                }
                else
                {
                    //Bitmap image1 = (Bitmap)Image.FromFile(@"\\Mac\Home\classes\interaction_architecture\Touchless_Source_Code\Touchless\Samples\TouchlessDemo\white_bmp.bmp");
                    _white = (Bitmap)((System.Drawing.Image)(resources.GetObject("white_bmp")));
                    if (_loadedBitmap != null && checkBoxUseLoadImage.Checked)
                    {
                        e.Graphics.DrawImage(new Bitmap(_loadedBitmap, pictureBoxDisplay.Width, pictureBoxDisplay.Height), 0, 0, pictureBoxDisplay.Width, pictureBoxDisplay.Height);
                    }
                    else
                    {
                        e.Graphics.DrawImage(new Bitmap(_white, pictureBoxDisplay.Width, pictureBoxDisplay.Height), 0, 0, pictureBoxDisplay.Width, pictureBoxDisplay.Height);
                    }
                }


                // Draw the selection adornment
                if (_drawSelectionAdornment)
                {
                    Pen pen = new Pen(Brushes.Red, 1);
                    //_latestFrame.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    e.Graphics.DrawEllipse(pen, _markerCenter.X - _markerRadius, _markerCenter.Y - _markerRadius, 2 * _markerRadius, 2 * _markerRadius);
                }

                if (radioButtonDemo.Checked)
                {
                    if (_drawDemo != null)
                    {
                        _drawDemo.drawCanvas(e.Graphics);
                    }
                    else if (_snakeDemo != null)
                    {
                        _snakeDemo.drawCanvas(e.Graphics);
                    }
                    else if (_imageDemo != null)
                    {
                        _imageDemo.drawCanvas(e.Graphics);
                    }
                    else if (_defendDemo != null)
                    {
                        _defendDemo.drawCanvas(e.Graphics);
                    }
                }
            }
        }