Exemple #1
0
        public TextModule()
        {
            Get["/examples/w3schools/text/1"] = _ =>
            {
                var svg = new Svg(200, 30);

                svg
                .Text(0, 15, "I love SVG!")
                .WithFill("red")
                .WithFontSize(12);

                return(Response.AsText(svg.ToString(), "image/svg+xml"));
            };

            Get["/examples/w3schools/text/2"] = _ => {
                var svg = new Svg(200, 60);

                svg
                .Text(0, 15, "I love SVG!")
                .WithFill("red")
                .WithFontSize(12)
                .WithTransformRotate(30, 20, 40);


                return(Response.AsText(svg.ToString(), "image/svg+xml"));
            };

            Get["/examples/w3schools/text/3"] = _ => {
                var svg = new Svg(200, 90);

                var text = svg
                           .Text(10, 20, "Several lines:")
                           .WithFill("red")
                           .WithFontSize(12);
                text.AddSpan(10, 45, "First line.");
                text.AddSpan(10, 70, "Second line.");


                return(Response.AsText(svg.ToString(), "image/svg+xml"));
            };

            Get["/examples/w3schools/text/4"] = _ => {
                var svg = new Svg(200, 30);

                var anchor = svg.Anchor("http://www.w3schools.com/svg", "_blank");
                anchor.Text(0, 15, "I love SVG!").WithFill("red");

                return(Response.AsText(svg.ToString(), "image/svg+xml"));
            };
        }
Exemple #2
0
        public LinearGradientsModule()
        {
            Get["/examples/w3schools/linear-gradients/1"] = _ =>
            {
                var svg = new Svg(400, 150);

                var grad1 = svg.Defs
                            .AddLinearGradient("0%", "0%", "100%", "0%")
                            .AddStop("0%", "rgb(255,255,0)", 1)
                            .AddStop("100%", "rgb(255,0,0)", 1);

                svg.Ellipse(200, 70, 85, 55)
                .WithFill(grad1);

                return(Response.AsSvg(svg));
            };

            Get["/examples/w3schools/linear-gradients/2"] = _ =>
            {
                var svg = new Svg(400, 150);

                var grad2 = svg.Defs.AddLinearGradient("0%", "0%", "0%", "100%")
                            .AddStop("0%", "rgb(255,255,0)", 1)
                            .AddStop("100%", "rgb(255,0,0)", 1);

                svg.Ellipse(200, 70, 85, 55)
                .WithFill(grad2);

                return(Response.AsSvg(svg));
            };

            Get["/examples/w3schools/linear-gradients/3"] = _ =>
            {
                var svg = new Svg(400, 150);

                var grad1 = svg.Defs.AddLinearGradient("0%", "0%", "100%", "0%")
                            .AddStop("0%", "rgb(255,255,0)", 1)
                            .AddStop("100%", "rgb(255,0,0)", 1);

                svg.Ellipse(200, 70, 85, 55)
                .WithFill(grad1);
                svg.Text(150, 86, "SVG")
                .WithFill("#ffffff")
                .WithFontSize(45)
                .WithFontFamily("Verdana");

                return(Response.AsSvg(svg));
            };
        }
        public LinearGradientsModule()
        {
            Get["/examples/w3schools/linear-gradients/1"] = _ =>
            {
                var svg = new Svg(400, 150);

                var grad1 = svg.Defs
                    .AddLinearGradient("0%", "0%", "100%", "0%")
                    .AddStop("0%", "rgb(255,255,0)", 1)
                    .AddStop("100%", "rgb(255,0,0)", 1);

                svg.Ellipse(200, 70, 85, 55)
                    .WithFill(grad1);

                return Response.AsSvg(svg);
            };

            Get["/examples/w3schools/linear-gradients/2"] = _ =>
            {
                var svg = new Svg(400, 150);

                var grad2 = svg.Defs.AddLinearGradient("0%", "0%", "0%", "100%")
                    .AddStop("0%", "rgb(255,255,0)", 1)
                    .AddStop("100%", "rgb(255,0,0)", 1);

                svg.Ellipse(200, 70, 85, 55)
                    .WithFill(grad2);

                return Response.AsSvg(svg);
            };

            Get["/examples/w3schools/linear-gradients/3"] = _ =>
            {
                var svg = new Svg(400, 150);

                var grad1 = svg.Defs.AddLinearGradient("0%", "0%", "100%", "0%")
                    .AddStop("0%", "rgb(255,255,0)", 1)
                    .AddStop("100%", "rgb(255,0,0)", 1);

                svg.Ellipse(200, 70, 85, 55)
                    .WithFill(grad1);
                svg.Text(150, 86, "SVG")
                    .WithFill("#ffffff")
                    .WithFontSize(45)
                    .WithFontFamily("Verdana");

                return Response.AsSvg(svg);
            };
        }
Exemple #4
0
        public TextModule()
        {
            Get["/examples/w3schools/text/1"] = _ =>
            {
                var svg = new Svg(200, 30);

                svg
                    .Text(0, 15, "I love SVG!")
                    .WithFill("red")
                    .WithFontSize(12);

                return Response.AsText(svg.ToString(), "image/svg+xml");
            };

            Get["/examples/w3schools/text/2"] = _ => {
                var svg = new Svg(200, 60);

                svg
                    .Text(0, 15, "I love SVG!")
                    .WithFill("red")
                    .WithFontSize(12)
                    .WithTransformRotate(30, 20, 40);

                return Response.AsText(svg.ToString(), "image/svg+xml");
            };

            Get["/examples/w3schools/text/3"] = _ => {
                var svg = new Svg(200, 90);

                var text = svg
                    .Text(10, 20, "Several lines:")
                    .WithFill("red")
                    .WithFontSize(12);
                text.AddSpan(10, 45, "First line.");
                text.AddSpan(10, 70, "Second line.");

                return Response.AsText(svg.ToString(), "image/svg+xml");
            };

            Get["/examples/w3schools/text/4"] = _ => {
                var svg = new Svg(200,30);

                var anchor = svg.Anchor("http://www.w3schools.com/svg", "_blank");
                anchor.Text(0, 15, "I love SVG!").WithFill("red");

                return Response.AsText(svg.ToString(), "image/svg+xml");
            };
        }