/// <summary>
/// Draws objects using pens with different settings on specified drawing engine.
/// </summary>
/// <param name="drawingEngine">Drawing engine.</param>
/// <param name="area">Area to draw objects in.</param>
public static void PenExample(DrawingEngine drawingEngine, RectangleF area)
{
    DrawingFactory factory = drawingEngine.DrawingFactory;
    // create graphics path to draw
    using (IGraphicsPath path = factory.CreateGraphicsPath())
    {
        // add path elements
        PointF[] linePoints = new PointF[]
        {
            new PointF(area.X + area.Width * 0.15f, area.Y + area.Height * 0.47f),
            new PointF(area.X + area.Width * 0.15f, area.Y + area.Height * 0.3f),
            new PointF(area.X + area.Width * 0.23f, area.Y),
        };
        path.AddLines(linePoints);
        PointF[] curvePoints = new PointF[]
        {
            new PointF(area.X + area.Width * 0.23f, area.Y),
            new PointF(area.X + area.Width * 0.47f, area.Y + area.Height * 0.1f),
            new PointF(area.X + area.Width * 0.47f, area.Y + area.Height * 0.2f),
            new PointF(area.X + area.Width * 0.35f, area.Y + area.Height * 0.22f),
            new PointF(area.X + area.Width * 0.27f, area.Y + area.Height * 0.24f),
            new PointF(area.X + area.Width * 0.27f, area.Y + area.Height * 0.35f),
            new PointF(area.X + area.Width * 0.45f, area.Y + area.Height * 0.47f),
        };
        path.AddBezierCurves(curvePoints);
        path.Transform(AffineMatrix.CreateScaling(0.66f, 1, area.X, area.Y));
        // set minimum pen width
        float minPenWidth = area.Width * 0.005f;
        // create simple pen and draw a path
        using (IDrawingPen pen = factory.CreatePen(Color.Red, minPenWidth * 2))
            drawingEngine.DrawPath(pen, path);
        // translate path
        path.Transform(AffineMatrix.CreateTranslation(area.Width / 3, 0));
        // create pen with dash pattern and arrow cap on line end
        using (IDrawingPen pen = factory.CreatePen(Color.Red, minPenWidth))
        using (DrawingLineCap cap = factory.CreateLineCap(DrawingLineCapType.Arrow, area.Height * 0.1f, area.Width * 0.1f))
        {
            pen.DashPattern = new float[] { 3, 1 };
            // draw path
            drawingEngine.DrawPath(pen, path, null, cap);
        }
        // translate path
        path.Transform(AffineMatrix.CreateTranslation(area.Width / 3, 0));
        // create pen with dash pattern and dash cap
        using (IDrawingPen pen = factory.CreatePen(Color.Red, minPenWidth * 3))
        {
            pen.DashPattern = new float[] { 1, 1 };
            pen.DashCap = LineDashCapStyle.Round;
            pen.LineCap = LineCapStyle.Round;
            // draw path
            drawingEngine.DrawPath(pen, path);
        }
        // translate path
        path.Transform(AffineMatrix.CreateTranslation(0, area.Height / 2));
        // create pen with round line join and butt cap on line start
        using (IDrawingPen pen = factory.CreatePen(Color.DarkGreen, minPenWidth * 7))
        using (DrawingLineCap cap = factory.CreateLineCap(DrawingLineCapType.Butt, area.Height * 0.1f, area.Width * 0.1f))
        {
            pen.LineJoin = LineJoinStyle.Round;
            // draw path
            drawingEngine.DrawPath(pen, path, cap, null);
        }
        // translate path
        path.Transform(AffineMatrix.CreateTranslation(-area.Width / 3, 0));
        // create pen with bevel line join and draw path
        using (IDrawingPen pen = factory.CreatePen(Color.Blue, minPenWidth * 6))
        {
            pen.LineJoin = LineJoinStyle.Bevel;
            drawingEngine.DrawPath(pen, path);
        }
        // translate path
        path.Transform(AffineMatrix.CreateTranslation(-area.Width / 3, 0));
        // create pen with dash pattern, dash offset and different line caps
        using (IDrawingPen pen = factory.CreatePen(Color.Blue, minPenWidth))
        using (DrawingLineCap startCap = factory.CreateLineCap(DrawingLineCapType.FilledRectangle, minPenWidth * 10, minPenWidth * 10))
        using (DrawingLineCap endCap = factory.CreateLineCap(DrawingLineCapType.Ellipse, minPenWidth * 10, minPenWidth * 10))
        {
            pen.DashOffset = 5;
            pen.DashPattern = new float[] { 3, 1, 1, 1 };
            // draw path
            drawingEngine.DrawPath(pen, path, startCap, endCap);
        }
    }
}