Beispiel #1
0
        static void DrawRoundedRectangle(vkvg.Context gr, double x, double y, double width, double height, double radius)
        {
            if ((radius > height / 2) || (radius > width / 2))
            {
                radius = Math.Min(height / 2, width / 2);
            }

            gr.MoveTo(x, y + radius);
            gr.Arc(x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
            gr.LineTo(x + width - radius, y);
            gr.Arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0);
            gr.LineTo(x + width, y + height - radius);
            gr.Arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
            gr.LineTo(x + radius, y + height);
            gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
            gr.ClosePath();
        }