Пример #1
0
        public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp)
        {
            double opacityFactor = infosFading.GetOpacityFactor(currentTimestamp);

            if (opacityFactor <= 0 || editing)
            {
                return;
            }

            using (SolidBrush brushBack = styleHelper.GetBackgroundBrush((int)(opacityFactor * 128)))
                using (SolidBrush brushText = styleHelper.GetForegroundBrush((int)(opacityFactor * 255)))
                    using (Font fontText = styleHelper.GetFont((float)transformer.Scale))
                    {
                        // Note: recompute background size in case the font floored.
                        SizeF textSize   = canvas.MeasureString(text, fontText);
                        Point bgLocation = transformer.Transform(background.Rectangle.Location);
                        Size  bgSize     = new Size((int)textSize.Width, (int)textSize.Height);

                        SizeF untransformed = transformer.Untransform(textSize);
                        background.Rectangle = new RectangleF(background.Rectangle.Location, untransformed);

                        Rectangle rect = new Rectangle(bgLocation, bgSize);
                        RoundedRectangle.Draw(canvas, rect, brushBack, fontText.Height / 4, false, false, null);
                        canvas.DrawString(text, fontText, brushText, rect.Location);
                    }
        }
Пример #2
0
        public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp)
        {
            if (currentTimestamp < visibleTimestamp)
            {
                return;
            }

            double opacityFactor = 1.0;

            if (currentTimestamp > invisibleTimestamp)
            {
                opacityFactor = infosFading.GetOpacityFactor(currentTimestamp);
            }

            if (opacityFactor <= 0)
            {
                return;
            }

            timecode = GetTimecode(currentTimestamp);
            string text = timecode;

            using (SolidBrush brushBack = styleHelper.GetBackgroundBrush((int)(opacityFactor * 128)))
                using (SolidBrush brushText = styleHelper.GetForegroundBrush((int)(opacityFactor * 255)))
                    using (Font fontText = styleHelper.GetFont((float)transformer.Scale))
                    {
                        SizeF textSize   = canvas.MeasureString(text, fontText);
                        Point bgLocation = transformer.Transform(mainBackground.Rectangle.Location);
                        Size  bgSize     = new Size((int)textSize.Width, (int)textSize.Height);

                        SizeF untransformed = transformer.Untransform(textSize);
                        mainBackground.Rectangle = new RectangleF(mainBackground.Rectangle.Location, untransformed);

                        Rectangle rect           = new Rectangle(bgLocation, bgSize);
                        int       roundingRadius = fontText.Height / 4;
                        RoundedRectangle.Draw(canvas, rect, brushBack, roundingRadius, false, false, null);
                        canvas.DrawString(text, fontText, brushText, rect.Location);

                        if (showLabel && name.Length > 0)
                        {
                            using (Font fontLabel = styleHelper.GetFont((float)transformer.Scale * 0.5f))
                            {
                                // Note: the alignment here assumes fixed margins of the rounded rectangle class.
                                SizeF     lblTextSize         = canvas.MeasureString(name, fontLabel);
                                int       labelRoundingRadius = fontLabel.Height / 3;
                                int       top     = rect.Location.Y - (int)lblTextSize.Height - roundingRadius - labelRoundingRadius;
                                Rectangle lblRect = new Rectangle(rect.Location.X, top, (int)lblTextSize.Width, (int)lblTextSize.Height);
                                RoundedRectangle.Draw(canvas, lblRect, brushBack, labelRoundingRadius, true, false, null);
                                canvas.DrawString(name, fontLabel, brushText, lblRect.Location);
                            }
                        }
                    }
        }
Пример #3
0
        public override void Draw(Graphics _canvas, CoordinateSystem _transformer, bool _bSelected, long _iCurrentTimestamp)
        {
            if (_iCurrentTimestamp < m_iVisibleTimestamp)
            {
                return;
            }

            double fOpacityFactor = 1.0;

            if (_iCurrentTimestamp > m_iInvisibleTimestamp)
            {
                fOpacityFactor = m_InfosFading.GetOpacityFactor(_iCurrentTimestamp);
            }

            if (fOpacityFactor <= 0)
            {
                return;
            }

            m_Timecode = GetTimecode(_iCurrentTimestamp);

            // Update unscaled backround size according to timecode text. Needed for hit testing.
            Font  f         = m_StyleHelper.GetFont(1F);
            SizeF totalSize = _canvas.MeasureString(" " + m_Timecode + " ", f);
            SizeF textSize  = _canvas.MeasureString(m_Timecode, f);

            f.Dispose();
            m_MainBackground.Rectangle = new Rectangle(m_MainBackground.Rectangle.Location, new Size((int)totalSize.Width, (int)totalSize.Height));

            using (SolidBrush brushBack = m_StyleHelper.GetBackgroundBrush((int)(fOpacityFactor * 128)))
                using (SolidBrush brushText = m_StyleHelper.GetForegroundBrush((int)(fOpacityFactor * 255)))
                    using (Font fontText = m_StyleHelper.GetFont((float)_transformer.Scale))
                    {
                        Rectangle rect = _transformer.Transform(m_MainBackground.Rectangle);
                        RoundedRectangle.Draw(_canvas, rect, brushBack, fontText.Height / 4, false);

                        int   margin       = (int)((totalSize.Width - textSize.Width) / 2);
                        Point textLocation = new Point(rect.X + margin, rect.Y);
                        _canvas.DrawString(m_Timecode, fontText, brushText, textLocation);

                        if (m_bShowLabel && m_Label.Length > 0)
                        {
                            using (Font fontLabel = m_StyleHelper.GetFont((float)_transformer.Scale * 0.5f))
                            {
                                SizeF     lblTextSize = _canvas.MeasureString(m_Label, fontLabel);
                                Rectangle lblRect     = new Rectangle(rect.Location.X, rect.Location.Y - (int)lblTextSize.Height, (int)lblTextSize.Width, (int)lblTextSize.Height);
                                RoundedRectangle.Draw(_canvas, lblRect, brushBack, fontLabel.Height / 3, true);
                                _canvas.DrawString(m_Label, fontLabel, brushText, lblRect.Location);
                            }
                        }
                    }
        }
Пример #4
0
        private void DrawAngleText(Graphics canvas, double opacity, IImageToViewportTransformer transformer, AngleHelper angle, SolidBrush brushFill)
        {
            //-------------------------------------------------
            // FIXME: function duplicated. Move to AngleHelper.
            // This version is already more generic.
            //-------------------------------------------------
            double value = CalibrationHelper.ConvertAngleFromDegrees(angle.CalibratedAngle.Sweep);

            if (value < 0)
            {
                value = -value;
            }

            string label = "";

            if (angle.Tenth)
            {
                label = String.Format("{0:0.0} {1}", value, CalibrationHelper.GetAngleAbbreviation());
            }
            else
            {
                label = String.Format("{0} {1}", (int)Math.Round(value), CalibrationHelper.GetAngleAbbreviation());
            }

            if (!string.IsNullOrEmpty(angle.Symbol))
            {
                label = string.Format("{0} = {1}", angle.Symbol, label);
            }

            SolidBrush fontBrush = styleHelper.GetForegroundBrush((int)(opacity * 255));
            Font       tempFont  = styleHelper.GetFont(Math.Max((float)transformer.Scale, 1.0F));
            SizeF      labelSize = canvas.MeasureString(label, tempFont);

            // Background
            float      shiftx        = (float)(transformer.Scale * angle.TextPosition.X);
            float      shifty        = (float)(transformer.Scale * angle.TextPosition.Y);
            Point      origin        = transformer.Transform(angle.Origin);
            PointF     textOrigin    = new PointF(shiftx + origin.X - labelSize.Width / 2, shifty + origin.Y - labelSize.Height / 2);
            RectangleF backRectangle = new RectangleF(textOrigin, labelSize);

            RoundedRectangle.Draw(canvas, backRectangle, brushFill, tempFont.Height / 4, false, false, null);

            // Text
            canvas.DrawString(label, tempFont, fontBrush, backRectangle.Location);

            tempFont.Dispose();
            fontBrush.Dispose();
        }
Пример #5
0
        public void Draw(Graphics canvas, IImageToViewportTransformer transformer, long timestamp, StyleHelper styleHelper)
        {
            double opacityFactor = infosFading.GetOpacityFactor(timestamp);

            if (opacityFactor <= 0)
            {
                return;
            }

            using (SolidBrush brushBack = styleHelper.GetBackgroundBrush((int)(opacityFactor * 255)))
                using (SolidBrush brushText = styleHelper.GetForegroundBrush((int)(opacityFactor * 255)))
                    using (Font fontText = styleHelper.GetFont((float)transformer.Scale))
                        using (Pen penContour = styleHelper.GetForegroundPen((int)(opacityFactor * 255)))
                        {
                            // Note: recompute background size in case the font floored.
                            string text     = value.ToString();
                            SizeF  textSize = canvas.MeasureString(text, fontText);

                            Point bgLocation = transformer.Transform(background.Rectangle.Location);
                            Size  bgSize     = new Size((int)textSize.Width, (int)textSize.Height);

                            SizeF untransformed = transformer.Untransform(textSize);
                            background.Rectangle = new RectangleF(background.Rectangle.Location, untransformed);

                            penContour.Width = 2;
                            Rectangle rect = new Rectangle(bgLocation, bgSize);
                            RoundedRectangle.Draw(canvas, rect, brushBack, fontText.Height / 4, false, true, penContour);
                            canvas.DrawString(text, fontText, brushText, rect.Location);
                        }
        }
Пример #6
0
        public void DrawText(Graphics canvas, double opacity, SolidBrush brushFill, PointF o, IImageToViewportTransformer transformer, CalibrationHelper calibrationHelper, StyleHelper styleHelper)
        {
            float value = calibrationHelper.ConvertAngle(CalibratedAngle);

            string label = "";

            if (tenth || calibrationHelper.AngleUnit == AngleUnit.Radian)
            {
                label = string.Format("{0:0.0} {1}", value, calibrationHelper.GetAngleAbbreviation());
            }
            else
            {
                label = string.Format("{0} {1}", (int)Math.Round(value), calibrationHelper.GetAngleAbbreviation());
            }

            if (!string.IsNullOrEmpty(symbol))
            {
                label = string.Format("{0} = {1}", symbol, label);
            }

            SolidBrush fontBrush = styleHelper.GetForegroundBrush((int)(opacity * 255));

            Font  tempFont  = styleHelper.GetFont(1.0F);
            SizeF labelSize = canvas.MeasureString(label, tempFont);

            Font  tempFontTransformed  = styleHelper.GetFont(Math.Max((float)transformer.Scale, 1.0F));
            SizeF labelSizeTransformed = canvas.MeasureString(label, tempFontTransformed);

            // Background
            PointF textPosition = GetTextPosition(textDistance, labelSize);

            textPosition = textPosition.Scale((float)transformer.Scale);

            PointF     backgroundOrigin = o.Translate(textPosition.X, textPosition.Y);
            RectangleF backRectangle    = new RectangleF(backgroundOrigin, labelSizeTransformed);

            RoundedRectangle.Draw(canvas, backRectangle, brushFill, tempFontTransformed.Height / 4, false, false, null);

            // Text
            canvas.DrawString(label, tempFontTransformed, fontBrush, backgroundOrigin);

            tempFont.Dispose();
            tempFontTransformed.Dispose();
            fontBrush.Dispose();
        }
Пример #7
0
        public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp)
        {
            double opacity = infosFading.GetOpacityFactor(currentTimestamp);

            if (opacity <= 0)
            {
                return;
            }

            //int backgroundOpacity = editing ? 255 : 192;
            int backgroundOpacity = 255;

            using (SolidBrush brushBack = styleHelper.GetBackgroundBrush((int)(opacity * backgroundOpacity)))
                using (SolidBrush brushText = styleHelper.GetForegroundBrush((int)(opacity * 255)))
                    using (Pen pen = styleHelper.GetPen(backgroundOpacity))
                        using (Font fontText = styleHelper.GetFont((float)transformer.Scale))
                        {
                            SizeF textSize   = canvas.MeasureString(text, fontText);
                            Point bgLocation = transformer.Transform(background.Rectangle.Location);
                            Size  bgSize     = new Size((int)textSize.Width, (int)textSize.Height);

                            SizeF untransformed = transformer.Untransform(textSize);
                            background.Rectangle = new RectangleF(background.Rectangle.Location, untransformed);

                            Rectangle rect           = new Rectangle(bgLocation, bgSize);
                            int       roundingRadius = fontText.Height / 4;

                            if (showArrow)
                            {
                                pen.Color = brushBack.Color;
                                pen.Width = fontText.Height / 4;
                                Point arrowStartInScreen = rect.Center();
                                Point arrowEndInScreen   = transformer.Transform(arrowEnd);
                                canvas.DrawLine(pen, arrowStartInScreen, arrowEndInScreen);
                                ArrowHelper.Draw(canvas, pen, arrowEndInScreen, arrowStartInScreen);
                            }

                            RoundedRectangle.Draw(canvas, rect, brushBack, roundingRadius, false, false, null);

                            if (!editing)
                            {
                                canvas.DrawString(text, fontText, brushText, rect.Location);
                            }
                        }
        }
Пример #8
0
        public override void Draw(Graphics _canvas, CoordinateSystem _transformer, bool _bSelected, long _iCurrentTimestamp)
        {
            double fOpacityFactor = m_InfosFading.GetOpacityFactor(_iCurrentTimestamp);

            if (fOpacityFactor <= 0 || m_bEditMode)
            {
                return;
            }

            using (SolidBrush brushBack = m_StyleHelper.GetBackgroundBrush((int)(fOpacityFactor * 128)))
                using (SolidBrush brushText = m_StyleHelper.GetForegroundBrush((int)(fOpacityFactor * 255)))
                    using (Font fontText = m_StyleHelper.GetFont((float)_transformer.Scale))
                    {
                        Rectangle rect = _transformer.Transform(m_Background.Rectangle);
                        RoundedRectangle.Draw(_canvas, rect, brushBack, fontText.Height / 4, false);
                        _canvas.DrawString(m_Text, fontText, brushText, rect.Location);
                    }
        }
        private void DrawTextOnBackground(PointF location, PointF offset, string label, Graphics canvas, double opacity, IImageToViewportTransformer transformer, SolidBrush brushFill)
        {
            Font   tempFont   = styleHelper.GetFont(Math.Max((float)transformer.Scale, 1.0F));
            SizeF  labelSize  = canvas.MeasureString(label, tempFont);
            PointF textOrigin = new PointF(location.X - (labelSize.Width / 2) + offset.X, location.Y - (labelSize.Height / 2) + offset.Y);

            Bicolor    bicolor   = new Bicolor(brushFill.Color);
            SolidBrush fontBrush = new SolidBrush(Color.FromArgb((int)(opacity * 255), bicolor.Foreground));

            RectangleF backRectangle = new RectangleF(textOrigin, labelSize);

            RoundedRectangle.Draw(canvas, backRectangle, brushFill, tempFont.Height / 4, false, false, null);

            // Text
            canvas.DrawString(label, tempFont, fontBrush, backRectangle.Location);

            fontBrush.Dispose();
            tempFont.Dispose();
        }
Пример #10
0
        private void SetText(StyleHelper styleHelper)
        {
            string text = value.ToString();

            using (Font f = styleHelper.GetFont(1.0F))
            {
                SizeF textSize = TextHelper.MeasureString(text, f);

                float width  = value < 10 ? textSize.Height : textSize.Width;
                float height = textSize.Height;
                background.Rectangle = new RectangleF(background.Rectangle.Location, new SizeF(width, height));
            }
        }
Пример #11
0
        public void Draw(Graphics _canvas, CoordinateSystem _transformer, double _fOpacityFactor)
        {
            using (SolidBrush fillBrush = m_StyleHelper.GetBackgroundBrush((int)(_fOpacityFactor * 255)))
                using (Pen p = m_StyleHelper.GetBackgroundPen((int)(_fOpacityFactor * 64)))
                    using (Font f = m_StyleHelper.GetFont((float)_transformer.Scale))
                        using (SolidBrush fontBrush = m_StyleHelper.GetForegroundBrush((int)(_fOpacityFactor * 255)))
                        {
                            // Small dot and connector.
                            Point attch  = _transformer.Transform(m_AttachLocation);
                            Point center = _transformer.Transform(m_Background.Center);
                            _canvas.FillEllipse(fillBrush, attch.Box(2));
                            _canvas.DrawLine(p, attch, center);

                            // Background and text.
                            SizeF     textSize = _canvas.MeasureString(m_Text, f);
                            Point     location = _transformer.Transform(m_Background.Rectangle.Location);
                            Size      size     = new Size((int)textSize.Width, (int)textSize.Height);
                            Rectangle rect     = new Rectangle(location, size);
                            RoundedRectangle.Draw(_canvas, rect, fillBrush, f.Height / 4, false);
                            _canvas.DrawString(m_Text, f, fontBrush, rect.Location);
                        }
        }
Пример #12
0
        public override void Draw(Graphics _canvas, CoordinateSystem _transformer, bool _bSelected, long _iCurrentTimestamp)
        {
            double fOpacityFactor = m_InfosFading.GetOpacityFactor(_iCurrentTimestamp);

            if (fOpacityFactor <= 0)
            {
                return;
            }

            Point     pointO      = _transformer.Transform(m_PointO);
            Point     pointA      = _transformer.Transform(m_PointA);
            Point     pointB      = _transformer.Transform(m_PointB);
            Rectangle boundingBox = _transformer.Transform(m_BoundingBox);

            using (Pen penEdges = m_StyleHelper.GetBackgroundPen((int)(fOpacityFactor * 255)))
                using (SolidBrush brushEdges = m_StyleHelper.GetBackgroundBrush((int)(fOpacityFactor * 255)))
                    using (SolidBrush brushFill = m_StyleHelper.GetBackgroundBrush((int)(fOpacityFactor * m_iDefaultBackgroundAlpha)))
                    {
                        // Disk section
                        _canvas.FillPie(brushFill, boundingBox, m_fStartAngle, m_fSweepAngle);
                        _canvas.DrawPie(penEdges, boundingBox, m_fStartAngle, m_fSweepAngle);

                        // Edges
                        _canvas.DrawLine(penEdges, pointO, pointA);
                        _canvas.DrawLine(penEdges, pointO, pointB);

                        // Handlers
                        _canvas.DrawEllipse(penEdges, pointO.Box(3));
                        _canvas.FillEllipse(brushEdges, pointA.Box(3));
                        _canvas.FillEllipse(brushEdges, pointB.Box(3));

                        SolidBrush fontBrush = m_StyleHelper.GetForegroundBrush((int)(fOpacityFactor * 255));
                        int        angle     = (int)Math.Floor(-m_fSweepAngle);
                        string     label     = angle.ToString() + "°";
                        Font       tempFont  = m_StyleHelper.GetFont((float)_transformer.Scale);
                        SizeF      labelSize = _canvas.MeasureString(label, tempFont);

                        // Background
                        float      shiftx        = (float)(_transformer.Scale * m_TextShift.X);
                        float      shifty        = (float)(_transformer.Scale * m_TextShift.Y);
                        PointF     textOrigin    = new PointF(shiftx + pointO.X - labelSize.Width / 2, shifty + pointO.Y - labelSize.Height / 2);
                        RectangleF backRectangle = new RectangleF(textOrigin, labelSize);
                        RoundedRectangle.Draw(_canvas, backRectangle, brushFill, tempFont.Height / 4, false);

                        // Text
                        _canvas.DrawString(label, tempFont, fontBrush, backRectangle.Location);

                        tempFont.Dispose();
                        fontBrush.Dispose();
                    }
        }
Пример #13
0
        public void Draw(Graphics canvas, IImageToViewportTransformer transformer, double opacityFactor)
        {
            using (SolidBrush fillBrush = styleHelper.GetBackgroundBrush((int)(opacityFactor * 255)))
                using (Pen p = styleHelper.GetBackgroundPen((int)(opacityFactor * 64)))
                    using (Font f = styleHelper.GetFont((float)transformer.Scale))
                        using (SolidBrush fontBrush = styleHelper.GetForegroundBrush((int)(opacityFactor * 255)))
                        {
                            SizeF textSize = canvas.MeasureString(text, f);
                            Point location = transformer.Transform(background.Rectangle.Location);
                            Size  size     = new Size((int)textSize.Width, (int)textSize.Height);

                            SizeF untransformed = transformer.Untransform(textSize);
                            background.Rectangle = new RectangleF(background.Rectangle.Location, untransformed);

                            Point attch  = transformer.Transform(attachLocation);
                            Point center = transformer.Transform(background.Center);
                            canvas.FillEllipse(fillBrush, attch.Box(2));
                            canvas.DrawLine(p, attch, center);

                            Rectangle rect = new Rectangle(location, size);
                            RoundedRectangle.Draw(canvas, rect, fillBrush, f.Height / 4, false, false, null);
                            canvas.DrawString(text, f, fontBrush, rect.Location);
                        }
        }
Пример #14
0
        public void Draw(Graphics canvas, IImageToViewportTransformer transformer, long timestamp, StyleHelper styleHelper)
        {
            double fOpacityFactor = infosFading.GetOpacityFactor(timestamp);

            if (fOpacityFactor <= 0)
            {
                return;
            }

            int alpha = (int)(255 * fOpacityFactor);

            //SetText(styleHelper);

            using (SolidBrush brushBack = styleHelper.GetBackgroundBrush((int)(fOpacityFactor * 255)))
                using (SolidBrush brushFront = styleHelper.GetForegroundBrush((int)(fOpacityFactor * 255)))
                    using (Pen penContour = styleHelper.GetForegroundPen((int)(fOpacityFactor * 255)))
                        using (Font f = styleHelper.GetFont((float)transformer.Scale))
                        {
                            // Note: recompute the background size each time in case font floored.
                            string text = value.ToString();
                            penContour.Width = 2;
                            SizeF textSize      = canvas.MeasureString(text, f);
                            Point bgLocation    = transformer.Transform(background.Rectangle.Location);
                            SizeF untransformed = transformer.Untransform(textSize);
                            background.Rectangle = new RectangleF(background.Rectangle.Location, untransformed);

                            Size bgSize;
                            if (value < 10)
                            {
                                bgSize = new Size((int)textSize.Height, (int)textSize.Height);
                                Rectangle rect = new Rectangle(bgLocation, bgSize);
                                canvas.FillEllipse(brushBack, rect);
                                canvas.DrawEllipse(penContour, rect);
                            }
                            else
                            {
                                bgSize = new Size((int)textSize.Width, (int)textSize.Height);
                                Rectangle rect = new Rectangle(bgLocation, bgSize);
                                RoundedRectangle.Draw(canvas, rect, brushBack, f.Height / 4, false, true, penContour);
                            }

                            int   verticalShift = (int)(textSize.Height / 10);
                            Point textLocation  = new Point(bgLocation.X + (int)((bgSize.Width - textSize.Width) / 2), bgLocation.Y + verticalShift);
                            canvas.DrawString(text, f, brushFront, textLocation);
                        }
        }
        private void DrawGrid(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, CoordinateSystemGrid grid)
        {
            Pen p = styleHelper.GetBackgroundPen(gridAlpha);

            p.DashStyle = DashStyle.Solid;
            p.Width     = 2;

            if (grid.VerticalAxis != null)
            {
                DrawGridLine(canvas, distorter, transformer, p, grid.VerticalAxis.Start, grid.VerticalAxis.End);
            }

            if (grid.HorizontalAxis != null)
            {
                DrawGridLine(canvas, distorter, transformer, p, grid.HorizontalAxis.Start, grid.HorizontalAxis.End);
            }

            p.DashStyle = DashStyle.Dash;
            p.Width     = 1;
            foreach (GridLine line in grid.GridLines)
            {
                DrawGridLine(canvas, distorter, transformer, p, line.Start, line.End);
            }

            SolidBrush brushFill = styleHelper.GetBackgroundBrush(defaultBackgroundAlpha);
            SolidBrush fontBrush = styleHelper.GetForegroundBrush(255);
            Font       font      = styleHelper.GetFont(1.0F);

            foreach (TickMark tick in grid.TickMarks)
            {
                DrawTickMark(canvas, distorter, transformer, tick, brushFill, fontBrush, font);
            }

            font.Dispose();
            fontBrush.Dispose();
            brushFill.Dispose();

            p.Dispose();
        }
Пример #16
0
        public override void Draw(Graphics canvas, DistortionHelper distorter, IImageToViewportTransformer transformer, bool selected, long currentTimestamp)
        {
            double opacityFactor = infosFading.GetOpacityFactor(currentTimestamp);

            if (tracking)
            {
                opacityFactor = 1.0;
            }

            if (opacityFactor <= 0)
            {
                return;
            }

            ComputeValues(transformer);

            Point     pointO      = transformer.Transform(points["o"]);
            Point     pointA      = transformer.Transform(points["a"]);
            Point     pointB      = transformer.Transform(points["b"]);
            Rectangle boundingBox = transformer.Transform(angleHelper.BoundingBox);

            if (boundingBox.Size == Size.Empty)
            {
                return;
            }

            using (Pen penEdges = styleHelper.GetBackgroundPen((int)(opacityFactor * 255)))
                using (SolidBrush brushEdges = styleHelper.GetBackgroundBrush((int)(opacityFactor * 255)))
                    using (SolidBrush brushFill = styleHelper.GetBackgroundBrush((int)(opacityFactor * defaultBackgroundAlpha)))
                    {
                        // Disk section
                        canvas.FillPie(brushFill, boundingBox, (float)angleHelper.Angle.Start, (float)angleHelper.Angle.Sweep);
                        canvas.DrawPie(penEdges, boundingBox, (float)angleHelper.Angle.Start, (float)angleHelper.Angle.Sweep);

                        // Edges
                        canvas.DrawLine(penEdges, pointO, pointA);
                        canvas.DrawLine(penEdges, pointO, pointB);

                        // Handlers
                        canvas.DrawEllipse(penEdges, pointO.Box(3));
                        canvas.FillEllipse(brushEdges, pointA.Box(3));
                        canvas.FillEllipse(brushEdges, pointB.Box(3));

                        SolidBrush fontBrush = styleHelper.GetForegroundBrush((int)(opacityFactor * 255));
                        float      angle     = CalibrationHelper.ConvertAngleFromDegrees(angleHelper.CalibratedAngle.Sweep);
                        string     label     = "";
                        if (CalibrationHelper.AngleUnit == AngleUnit.Degree)
                        {
                            label = string.Format("{0}{1}", (int)Math.Round(angle), CalibrationHelper.GetAngleAbbreviation());
                        }
                        else
                        {
                            label = string.Format("{0:0.00} {1}", angle, CalibrationHelper.GetAngleAbbreviation());
                        }

                        Font  tempFont  = styleHelper.GetFont((float)transformer.Scale);
                        SizeF labelSize = canvas.MeasureString(label, tempFont);

                        // Background
                        float      shiftx        = (float)(transformer.Scale * angleHelper.TextPosition.X);
                        float      shifty        = (float)(transformer.Scale * angleHelper.TextPosition.Y);
                        PointF     textOrigin    = new PointF(shiftx + pointO.X - labelSize.Width / 2, shifty + pointO.Y - labelSize.Height / 2);
                        RectangleF backRectangle = new RectangleF(textOrigin, labelSize);
                        RoundedRectangle.Draw(canvas, backRectangle, brushFill, tempFont.Height / 4, false, false, null);

                        // Text
                        canvas.DrawString(label, tempFont, fontBrush, backRectangle.Location);

                        tempFont.Dispose();
                        fontBrush.Dispose();
                    }
        }