private void DrawIcon(ICanvas canvas, NGraphics.Rect rect) { if(Graphic == null) return; var padding = ((rect.Size * IconScale) - rect.Size) / 2; var transform = Transform.AspectFillRect(Graphic.ViewBox, rect.GetInflated(padding)); var transformed = Graphic.TransformGeometry(transform); var color = new NGraphics.Color( FillColor.R, FillColor.G, FillColor.B, FillColor.A); foreach(var element in transformed.Children) { if(OverpaintEnabled) { ApplyColor(element, color); } element.Draw(canvas); } }