/// <inheritdoc/>
public override void Draw(TextView textView, DrawingContext drawingContext)
{
if (Pen == null)
{
return;
}
foreach (Rect rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, this))
{
if (rect.Width <= 1 || rect.Height <= 1)
{
// Current segment is inside a folding.
continue;
}
var start = rect.BottomLeft;
var end = rect.BottomRight;
var geometry = new StreamGeometry();
using (var context = geometry.Open())
{
context.BeginFigure(start, false, false);
const double zigLength = 3;
const double zigHeight = 3;
int numberOfZigs = (int)((end.X - start.X) / zigLength + 0.5f);
if (numberOfZigs < 2)
{
numberOfZigs = 2;
}
for (int i = 0; i < numberOfZigs; i++)
{
var p = new Point(
start.X + (i + 1) * zigLength,
start.Y - (i % 2) * zigHeight + 1);
context.LineTo(p, true, false);
}
}
drawingContext.DrawGeometry(null, Pen, geometry);
}
}