Beispiel #1
0
        public override void Update()
        {
            using (vkvg.Context ctx = new vkvg.Context(vkvgSurf))
            {
                ctx.SetSource(1, 1, 1);
                ctx.Paint();


                ctx.LineWidth = 6;
                ctx.SetSource(0.1, 0.1, 0.1, 0.8);

                ctx.MoveTo(points [0]);
                ctx.CurveTo(points [1].X, points [1].Y, points [2].X, points [2].Y, points [3].X, points [3].Y);
                ctx.Stroke();

                ctx.LineWidth = 1;
                ctx.SetSource(0.2, 0.2, 0.2, 1);

                ctx.MoveTo(points[0]);
                ctx.LineTo(points[1]);
                ctx.MoveTo(points[2]);
                ctx.LineTo(points[3]);
                ctx.Stroke();

                ctx.SetSource(0.5, 0.5, 1, 0.9);
                for (int i = 0; i < points.Length; i++)
                {
                    if (i == curPoint)
                    {
                        continue;
                    }
                    ctx.Arc(points[i].X, points [i].Y, cpRadius, 0, Math.PI * 2.0);
                }
                ctx.FillPreserve();
                ctx.Stroke();

                if (curPoint < 0)
                {
                    return;
                }

                ctx.SetSource(1, 0.4, 0.4, 0.9);
                ctx.Arc(points [curPoint].X, points [curPoint].Y, selRadius, 0, Math.PI * 2.0);
                ctx.FillPreserve();
                ctx.Stroke();
            }
        }
Beispiel #2
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();
        }
Beispiel #3
0
 void vkvgDraw()
 {
     using (vkvg.Context ctx = new vkvg.Context(vkvgSurf)) {
         ctx.SetSource(1.0, 1.0, 1.0);
         ctx.Paint();
         ctx.Translate(100, 100);
         ctx.Scale(3, 3);
         ctx.SetSource(0.1, 0.1, 0.1);
         ctx.Arc(100, 100, 10.0, 0, Math.PI * 2.0);
         ctx.LineWidth = 1.0;
         ctx.Stroke();
     }
 }
Beispiel #4
0
        public override void Update()
        {
            using (vkvg.Context ctx = new vkvg.Context(vkvgSurf))
            {
                ctx.Clear();

                for (int i = 0; i < iterations; i++)
                {
                    float x = (float)(rnd.NextDouble() * Width);
                    float y = (float)(rnd.NextDouble() * Height);
                    float r = 0.2f * (float)(rnd.NextDouble() * Width) + 1.0f;

                    randomize_color(ctx);
                    ctx.Arc(x, y, r, 0, 2.0f * Math.PI);
                    ctx.Fill();

                    if (i % 50 == 0)
                    {
                        ctx.Flush();
                    }
                }
            }
        }