Exemplo n.º 1
0
        public void Draw(global::AvaloniaEdit.Rendering.TextView textView, DrawingContext drawingContext)
        {
            if (this.result == null)
            {
                return;
            }

            BackgroundGeometryBuilder builder = new BackgroundGeometryBuilder();

            builder.CornerRadius = 1;

            builder.AddSegment(textView, new TextSegment()
            {
                StartOffset = result.OpeningBracketOffset, Length = result.OpeningBracketLength
            });
            builder.CloseFigure();             // prevent connecting the two segments
            builder.AddSegment(textView, new TextSegment()
            {
                StartOffset = result.ClosingBracketOffset, Length = result.ClosingBracketLength
            });

            Geometry geometry = builder.CreateGeometry();

            if (geometry != null)
            {
                drawingContext.DrawGeometry(backgroundBrush, borderPen, geometry);
            }
        }
Exemplo n.º 2
0
        public BracketHighlightRenderer(global::AvaloniaEdit.Rendering.TextView textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }

            this.borderPen = new Pen(new SolidColorBrush(Color.FromArgb(52, 0, 0, 255)), 1).ToImmutable();

            this.backgroundBrush = new SolidColorBrush(Color.FromArgb(22, 0, 0, 255)).ToImmutable();

            this.textView = textView;

            this.textView.BackgroundRenderers.Add(this);
        }