public static void RenderBorderAndArea(ICanvas canvas, IShapef shape, IPathf border, Area.AreaStyle style, Area.AreaStyle nextStyle, float alpha) { // We first fill background. { // We create background fill. ITransform mappingTransform; IMapper mapper; IFill fill = BackgroundStyle.Merge(style != null ? style.Background : null, nextStyle != null ? nextStyle.Background : null, alpha, out mappingTransform, out mapper); if (fill != null) { if (mappingTransform != null) { canvas.TextureTransform = mappingTransform; } // We fill shape canvas.FillShape(fill, shape, mapper); // Must reset. if (mappingTransform != null) { canvas.TextureTransform = null; } } } // Now we add border over it. { ITransform transform; IMapper mapper; Pen pen = BorderStyle.Merge(style != null ? style.Border : null, nextStyle != null ? nextStyle.Border : null, alpha, out transform, out mapper); if (pen != null && pen.Fill != null) { if (transform != null) { canvas.TextureTransform = transform; } canvas.DrawShape(pen, border, mapper); if (transform != null) { canvas.TextureTransform = null; } } } }