public override void Draw(Canvas canvas, RectangleF rectangle, Color color)
        {
            canvas.FillRect(rectangle, color * BackgroundTint);

            var padding = Padding.Calculate();

            var size = Math.Min(rectangle.Width, rectangle.Height) - padding * 2;

            var spacing = Spacing.Calculate();

            var rx = Rx.Calculate(size);
            var ry = Ry.Calculate(size);

            Vector2 step = Vector2.Zero;

            if (rectangle.Width > rectangle.Height)
            {
                step = new Vector2(size + spacing, 0);
            }
            else
            {
                step = new Vector2(0, size + spacing);
            }

            var startC = rectangle.Center - step * Count / 2f;
            var bounds = new RectangleF(startC.X - size / 2, startC.Y - size / 2, size, size);

            for (var idx = 0; idx < Count; ++idx)
            {
                canvas.FillRoundRect(bounds, new Vector2(rx, ry), color);
                bounds = bounds.Offset(step);
            }
        }
Пример #2
0
        public override void Draw(Canvas canvas, RectangleF rectangle, Color color)
        {
            rectangle = rectangle.Deflate(Padding);

            var rx = Rx.Calculate(rectangle.Width);
            var ry = Ry.Calculate(rectangle.Height);

            if (FillColor.A > 0)
            {
                canvas.FillRoundRect(rectangle, new System.Numerics.Vector2(rx, ry), FillColor * color);
            }

            if (StrokeColor.A > 0)
            {
                canvas.DrawRoundRect(rectangle, new System.Numerics.Vector2(rx, ry), StrokeColor * color, StrokeThickness.Calculate());
            }
        }