private void UpdateLabelTexture()
        {
            if (labelImage != null)
            {
                if (labelFont == null)
                {
                    var emSize = Font.SizeInPoints * (labelImage.Height * LabelFontScale) / Font.Height;
                    labelFont = new Font(Font.FontFamily, emSize);
                }

                labelImage.SetZero();
                using (var labelBitmap = new Bitmap(labelImage.Width, labelImage.Height, labelImage.WidthStep, System.Drawing.Imaging.PixelFormat.Format32bppArgb, labelImage.ImageData))
                    using (var graphics = Graphics.FromImage(labelBitmap))
                        using (var regionBrush = new SolidBrush(Color.FromArgb(FillOpacity, Color.Red)))
                            using (var selectedBrush = new SolidBrush(Color.FromArgb(FillOpacity, Color.LimeGreen)))
                                using (var format = new StringFormat())
                                {
                                    graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                                    graphics.SmoothingMode     = SmoothingMode.AntiAlias;
                                    format.Alignment           = StringAlignment.Center;
                                    format.LineAlignment       = StringAlignment.Center;
                                    for (int i = 0; i < regions.Count; i++)
                                    {
                                        var rect  = RegionRectangle(regions[i]);
                                        var brush = i == selectedRoi ? selectedBrush : regionBrush;
                                        graphics.FillEllipse(brush, rect);
                                        graphics.DrawString(i.ToString(CultureInfo.InvariantCulture), labelFont, Brushes.White, rect, format);
                                    }
                                }

                labelTexture.Update(labelImage);
            }
        }
Пример #2
0
 protected virtual void SetImage(IplImage image)
 {
     MakeCurrent();
     texture.Update(image, ImageScale);
     Canvas.Invalidate();
     canvasInvalidated = true;
 }
Пример #3
0
 protected override void ShowMashup(IList <object> values)
 {
     base.ShowMashup(values);
     visualizerCanvas.MakeCurrent();
     if (VisualizerImage != null)
     {
         imageTexture.Update(VisualizerImage);
     }
     visualizerCanvas.Canvas.Invalidate();
 }
Пример #4
0
        protected virtual void ShowMashup(IList <object> values)
        {
            drawnValues = values;
            foreach (var mashupValue in values.Zip(EnumerableMashup(this, Mashups.Select(xs => (DialogTypeVisualizer)xs.Visualizer)), (value, visualizer) => new { value, visualizer }))
            {
                mashupValue.visualizer.Show(mashupValue.value);
            }

            visualizerCanvas.MakeCurrent();
            if (visualizerImage != null)
            {
                imageTexture.Update(visualizerImage);
            }
            visualizerCanvas.Canvas.Invalidate();
        }