예제 #1
0
파일: curve.cs 프로젝트: jpbruyere/vkvg.net
        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();
            }
        }