Esempio n. 1
0
        private static void DrawFlower(Context2d context, double leafLength, double leafs, double x, double y)
        {
            context.BeginPath();

            var leafAngle = (2d * Math.PI / leafs);

            for (var i = 0d; i < leafs; i++)
            {
                var startAngle       = i * leafAngle;
                var circlePointAngle = (i + 0.5) * leafAngle;
                var arcStartAngle    = circlePointAngle - 0.5 * Math.PI;
                var acrEndAngle      = arcStartAngle + Math.PI;

                context.MoveTo(x, y);
                context.LineTo(
                    x + leafLength * Math.Cos(startAngle),
                    y + leafLength * Math.Sin(startAngle));
                context.Arc(
                    x + leafLength * Math.Cos(circlePointAngle),
                    y + leafLength * Math.Sin(circlePointAngle),
                    0.5 * leafLength * leafAngle,
                    arcStartAngle,
                    acrEndAngle);

                context.ClosePath();
            }
            context.Fill();
            context.Stroke();
        }
Esempio n. 2
0
        private static void DrawFlower(Context2d context, double leafLength, double leafs, double x, double y)
        {
            context.BeginPath();

            var leafAngle = (2d * Math.PI / leafs);
            for (var i = 0d; i < leafs; i++)
            {
                var startAngle = i * leafAngle;
                var circlePointAngle = (i + 0.5) * leafAngle;
                var arcStartAngle = circlePointAngle - 0.5 * Math.PI;
                var acrEndAngle = arcStartAngle + Math.PI;

                context.MoveTo(x, y);
                context.LineTo(
                    x + leafLength * Math.Cos(startAngle),
                    y + leafLength * Math.Sin(startAngle));
                context.Arc(
                    x + leafLength * Math.Cos(circlePointAngle),
                    y + leafLength * Math.Sin(circlePointAngle),
                    0.5 * leafLength * leafAngle,
                    arcStartAngle,
                    acrEndAngle);

                context.ClosePath();
            }
            context.Fill();
            context.Stroke();
        }
        public override void MouseMoveHandler(object sender, MouseEventArgs e)
        {
            if (Viewer2d.IsActive())
            {
                View2d.ShowHit(e.X, e.Y);
            }
            if (!Viewer2d.IsActive())
            {
                View2d.EraseHit();
            }

            Context2d.MoveTo(e.X, e.Y, View2d);
        }