Exemplo n.º 1
0
 public override void Unload()
 {
     base.Unload();
     imageTexture.Dispose();
     imagePanel.Dispose();
     imagePanel       = null;
     statusStrip      = null;
     visualizerCanvas = null;
     imageTexture     = null;
 }
 protected override void OnLoad(EventArgs e)
 {
     if (DesignMode)
     {
         return;
     }
     GL.Enable(EnableCap.Blend);
     GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
     labelTexture = new IplImageTexture();
     base.OnLoad(e);
 }
Exemplo n.º 3
0
 protected override void OnLoad(EventArgs e)
 {
     if (DesignMode)
     {
         return;
     }
     allowUpdate       = true;
     canvasInvalidated = false;
     texture           = new IplImageTexture();
     base.OnLoad(e);
 }
Exemplo n.º 4
0
        public override void Load(IServiceProvider provider)
        {
            StatusStripEnabled = true;
            visualizerCanvas   = new VisualizerCanvas {
                Dock = DockStyle.Fill
            };
            statusStrip = new StatusStrip {
                Visible = false
            };
            statusLabel = new ToolStripStatusLabel();
            statusStrip.Items.Add(statusLabel);
            visualizerCanvas.RenderFrame       += (sender, e) => RenderFrame();
            visualizerCanvas.Load              += (sender, e) => imageTexture = new IplImageTexture();
            visualizerCanvas.Canvas.MouseClick += (sender, e) => statusStrip.Visible =
                StatusStripEnabled &&
                e.Button == MouseButtons.Right ? !statusStrip.Visible : statusStrip.Visible;

            visualizerCanvas.Canvas.MouseMove        += (sender, e) => UpdateStatus();
            visualizerCanvas.Canvas.MouseDoubleClick += (sender, e) =>
            {
                if (e.Button == MouseButtons.Left)
                {
                    if (visualizerImage != null)
                    {
                        imagePanel.Parent.ClientSize = new Size(visualizerImage.Width, visualizerImage.Height);
                    }
                }
            };

            imagePanel = new UserControl();
            imagePanel.SuspendLayout();
            imagePanel.Dock = DockStyle.Fill;
            imagePanel.Size = new Size(320, 240);
            imagePanel.AutoScaleDimensions = new SizeF(6F, 13F);
            imagePanel.AutoScaleMode       = AutoScaleMode.Font;
            imagePanel.Controls.Add(visualizerCanvas);
            imagePanel.Controls.Add(statusStrip);
            imagePanel.ResumeLayout(false);

            var visualizerService = (IDialogTypeVisualizerService)provider.GetService(typeof(IDialogTypeVisualizerService));

            if (visualizerService != null)
            {
                updateTimer          = new Timer();
                updateTimer.Interval = TargetInterval;
                updateTimer.Tick    += updateTimer_Tick;
                visualizerService.AddControl(imagePanel);
                updateTimer.Start();
            }

            base.Load(provider);
        }
Exemplo n.º 5
0
 protected override void OnLoad(EventArgs e)
 {
     if (DesignMode)
     {
         return;
     }
     GL.LineWidth(LineWidth * scaleFactor);
     GL.PointSize(PointSize * scaleFactor);
     GL.Enable(EnableCap.PointSmooth);
     GL.Enable(EnableCap.Blend);
     GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
     labelTexture = new IplImageTexture();
     base.OnLoad(e);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    MakeCurrent();
                    if (texture != null)
                    {
                        texture.Dispose();
                        texture = null;
                    }

                    allowUpdate = false;
                    disposed    = true;
                }
            }

            base.Dispose(disposing);
        }
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    MakeCurrent();
                    if (labelTexture != null)
                    {
                        labelTexture.Dispose();
                        labelTexture = null;
                    }

                    if (labelFont != null)
                    {
                        labelFont.Dispose();
                        labelFont = null;
                    }
                    disposed = true;
                }
            }

            base.Dispose(disposing);
        }