Exemplo n.º 1
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: lb
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(40F, -40F));
                    builder.AddCubicBezier(new Vector2(51.0460014F, -40F), new Vector2(60F, -31.0459995F), new Vector2(60F, -20F));
                    builder.AddLine(new Vector2(60F, -7.68300009F));
                    builder.AddCubicBezier(new Vector2(56.6940002F, -9.60200024F), new Vector2(53.3779984F, -12.2309999F), new Vector2(50.0569992F, -15.6960001F));
                    builder.AddCubicBezier(new Vector2(44.5629997F, -21.4300003F), new Vector2(35.4679985F, -21.4360008F), new Vector2(29.9659996F, -15.7069998F));
                    builder.AddCubicBezier(new Vector2(21.5690002F, -6.96400023F), new Vector2(13.0600004F, -3.33299994F), new Vector2(4F, -3.33299994F));
                    builder.AddCubicBezier(new Vector2(-4.11299992F, -3.33299994F), new Vector2(-10F, 3.398F), new Vector2(-10F, 10.8330002F));
                    builder.AddLine(new Vector2(-10F, 35.9259987F));
                    builder.AddLine(new Vector2(-9.95400047F, 38.7459984F));
                    builder.AddLine(new Vector2(-9.95100021F, 38.8300018F));
                    builder.AddCubicBezier(new Vector2(-9.56599998F, 50.3720016F), new Vector2(-6.91499996F, 60.8740005F), new Vector2(-1.78199995F, 70F));
                    builder.AddLine(new Vector2(-40F, 70F));
                    builder.AddCubicBezier(new Vector2(-51.0460014F, 70F), new Vector2(-60F, 61.0460014F), new Vector2(-60F, 50F));
                    builder.AddLine(new Vector2(-60F, -20F));
                    builder.AddCubicBezier(new Vector2(-60F, -31.0459995F), new Vector2(-51.0460014F, -40F), new Vector2(-40F, -40F));
                    builder.AddLine(new Vector2(40F, -40F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 2
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: s
            CanvasGeometry Geometry_0()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(42.8370018F, -8.77700043F));
                    builder.AddCubicBezier(new Vector2(48.230999F, -3.148F), new Vector2(53.9420013F, 0.925999999F), new Vector2(60F, 3.47099996F));
                    builder.AddCubicBezier(new Vector2(63.2330017F, 4.829F), new Vector2(66.5650024F, 5.75299978F), new Vector2(70F, 6.24499989F));
                    builder.AddCubicBezier(new Vector2(71.9660034F, 6.52600002F), new Vector2(73.9660034F, 6.66699982F), new Vector2(76F, 6.66699982F));
                    builder.AddCubicBezier(new Vector2(77.9329987F, 6.66699982F), new Vector2(79.5459976F, 8.09500027F), new Vector2(79.9189987F, 9.99400043F));
                    builder.AddLine(new Vector2(80F, 10.8330002F));
                    builder.AddLine(new Vector2(80F, 35.8440018F));
                    builder.AddCubicBezier(new Vector2(80F, 62.6629982F), new Vector2(66.8700027F, 80.8960037F), new Vector2(41.2649994F, 89.7860031F));
                    builder.AddCubicBezier(new Vector2(40.4440002F, 90.0709991F), new Vector2(39.5559998F, 90.0709991F), new Vector2(38.7350006F, 89.7860031F));
                    builder.AddCubicBezier(new Vector2(31.4820004F, 87.2679977F), new Vector2(25.2310009F, 84F), new Vector2(19.9950008F, 80F));
                    builder.AddCubicBezier(new Vector2(16.1459999F, 77.0599976F), new Vector2(12.8470001F, 73.723999F), new Vector2(10.1020002F, 70F));
                    builder.AddCubicBezier(new Vector2(3.83500004F, 61.4980011F), new Vector2(0.458999991F, 50.9700012F), new Vector2(0.0439999998F, 38.4970016F));
                    builder.AddLine(new Vector2(0F, 35.8440018F));
                    builder.AddLine(new Vector2(0F, 10.8330002F));
                    builder.AddCubicBezier(new Vector2(0F, 8.53199959F), new Vector2(1.79100001F, 6.66699982F), new Vector2(4F, 6.66699982F));
                    builder.AddCubicBezier(new Vector2(16.2339993F, 6.66699982F), new Vector2(27.2329998F, 1.57500005F), new Vector2(37.1780014F, -8.77999973F));
                    builder.AddCubicBezier(new Vector2(38.7410011F, -10.408F), new Vector2(41.276001F, -10.4069996F), new Vector2(42.8370018F, -8.77700043F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 3
0
        public CanvasGeometry GetGeometry(CanvasDevice device)
        {
            var fill = FillType == PathFillType.Winding
                ? CanvasFilledRegionDetermination.Winding
                : CanvasFilledRegionDetermination.Alternate;
            //    FillRule = path.FillType == PathFillType.EvenOdd ? FillRule.EvenOdd : FillRule.Nonzero,

            var canvasPathBuilder = new CanvasPathBuilder(device);

            canvasPathBuilder.SetFilledRegionDetermination(fill);

            var closed = true;

            for (var i = 0; i < Contours.Count; i++)
            {
                Contours[i].AddPathSegment(canvasPathBuilder, ref closed);
            }

            if (!closed)
            {
                canvasPathBuilder.EndFigure(CanvasFigureLoop.Open);
            }

            return(CanvasGeometry.CreatePath(canvasPathBuilder));
        }
Exemplo n.º 4
0
            // - - - - Shape tree root for layer: icon
            // - - - ShapeGroup: s
            // - Path
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(37.1629982F, -8.77700043F));
                    builder.AddCubicBezier(new Vector2(31.7689991F, -3.148F), new Vector2(26.0580006F, 0.925999999F), new Vector2(20F, 3.47099996F));
                    builder.AddCubicBezier(new Vector2(16.7670002F, 4.829F), new Vector2(13.4350004F, 5.75299978F), new Vector2(10F, 6.24499989F));
                    builder.AddCubicBezier(new Vector2(8.0340004F, 6.52600002F), new Vector2(6.03399992F, 6.66699982F), new Vector2(4F, 6.66699982F));
                    builder.AddCubicBezier(new Vector2(2.06699991F, 6.66699982F), new Vector2(0.453999996F, 8.09500027F), new Vector2(0.0810000002F, 9.99400043F));
                    builder.AddCubicBezier(new Vector2(0.0810000002F, 9.99400043F), new Vector2(0F, 10.8330002F), new Vector2(0F, 10.8330002F));
                    builder.AddCubicBezier(new Vector2(0F, 10.8330002F), new Vector2(0F, 35.8440018F), new Vector2(0F, 35.8440018F));
                    builder.AddCubicBezier(new Vector2(0F, 62.6629982F), new Vector2(13.1300001F, 80.8960037F), new Vector2(38.7350006F, 89.7860031F));
                    builder.AddCubicBezier(new Vector2(39.5559998F, 90.0709991F), new Vector2(40.4440002F, 90.0709991F), new Vector2(41.2649994F, 89.7860031F));
                    builder.AddCubicBezier(new Vector2(48.5180016F, 87.2679977F), new Vector2(54.769001F, 84F), new Vector2(60.0050011F, 80F));
                    builder.AddCubicBezier(new Vector2(63.8540001F, 77.0599976F), new Vector2(67.1529999F, 73.723999F), new Vector2(69.8980026F, 70F));
                    builder.AddCubicBezier(new Vector2(76.1650009F, 61.4980011F), new Vector2(79.5410004F, 50.9700012F), new Vector2(79.9560013F, 38.4970016F));
                    builder.AddCubicBezier(new Vector2(79.9560013F, 38.4970016F), new Vector2(80F, 35.8440018F), new Vector2(80F, 35.8440018F));
                    builder.AddCubicBezier(new Vector2(80F, 35.8440018F), new Vector2(80F, 10.8330002F), new Vector2(80F, 10.8330002F));
                    builder.AddCubicBezier(new Vector2(80F, 8.53199959F), new Vector2(78.2089996F, 6.66699982F), new Vector2(76F, 6.66699982F));
                    builder.AddCubicBezier(new Vector2(63.7659988F, 6.66699982F), new Vector2(52.7669983F, 1.57500005F), new Vector2(42.8219986F, -8.77999973F));
                    builder.AddCubicBezier(new Vector2(41.2589989F, -10.408F), new Vector2(38.723999F, -10.4069996F), new Vector2(37.1629982F, -8.77700043F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 5
0
            CanvasGeometry Geometry_2()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-11, -4.5F));
                    builder.AddLine(new Vector2(-11, -5.26000023F));
                    builder.AddCubicBezier(new Vector2(-11, -6.32000017F), new Vector2(-10.5799999F, -7.34000015F), new Vector2(-9.82999992F, -8.09000015F));
                    builder.AddLine(new Vector2(-7.59000015F, -10.3299999F));
                    builder.AddCubicBezier(new Vector2(-6.84000015F, -11.0799999F), new Vector2(-5.82000017F, -11.5F), new Vector2(-4.76000023F, -11.5F));
                    builder.AddLine(new Vector2(4.76000023F, -11.5F));
                    builder.AddCubicBezier(new Vector2(5.82000017F, -11.5F), new Vector2(6.84000015F, -11.0799999F), new Vector2(7.59000015F, -10.3299999F));
                    builder.AddLine(new Vector2(9.82999992F, -8.09000015F));
                    builder.AddCubicBezier(new Vector2(10.5799999F, -7.34000015F), new Vector2(11, -6.32000017F), new Vector2(11, -5.26000023F));
                    builder.AddLine(new Vector2(11, 8.5F));
                    builder.AddCubicBezier(new Vector2(11, 10.1599998F), new Vector2(9.65999985F, 11.5F), new Vector2(8, 11.5F));
                    builder.AddLine(new Vector2(-8, 11.5F));
                    builder.AddCubicBezier(new Vector2(-9.65999985F, 11.5F), new Vector2(-11, 10.1599998F), new Vector2(-11, 8.5F));
                    builder.AddLine(new Vector2(-11, -4.5F));
                    builder.EndFigure(CanvasFigureLoop.Open);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 6
0
            // - - - - Shape tree root for layer: icon
            // - - - ShapeGroup: lb
            // - Path
            CanvasGeometry Geometry_3()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(40F, -40F));
                    builder.AddCubicBezier(new Vector2(51.0460014F, -40F), new Vector2(60F, -31.0459995F), new Vector2(60F, -20F));
                    builder.AddCubicBezier(new Vector2(60F, -20F), new Vector2(60F, -7.68300009F), new Vector2(60F, -7.68300009F));
                    builder.AddCubicBezier(new Vector2(56.6940002F, -9.60200024F), new Vector2(53.3779984F, -12.2309999F), new Vector2(50.0569992F, -15.6960001F));
                    builder.AddCubicBezier(new Vector2(44.5629997F, -21.4300003F), new Vector2(36.3899994F, -21.6429996F), new Vector2(31.1700001F, -15.6960001F));
                    builder.AddCubicBezier(new Vector2(27.3999996F, -11.4020004F), new Vector2(29.3649998F, -7.09899998F), new Vector2(25.9430008F, -2.8900001F));
                    builder.AddCubicBezier(new Vector2(22.5209999F, 1.31900001F), new Vector2(20F, 3.398F), new Vector2(20F, 10.8330002F));
                    builder.AddCubicBezier(new Vector2(20F, 10.8330002F), new Vector2(20F, 35.9259987F), new Vector2(20F, 35.9259987F));
                    builder.AddCubicBezier(new Vector2(20F, 35.9259987F), new Vector2(20.0470009F, 38.7459984F), new Vector2(20.0470009F, 38.7459984F));
                    builder.AddCubicBezier(new Vector2(20.0470009F, 38.7459984F), new Vector2(20.0489998F, 38.8300018F), new Vector2(20.0489998F, 38.8300018F));
                    builder.AddCubicBezier(new Vector2(20.434F, 50.3720016F), new Vector2(20.434F, 64.2369995F), new Vector2(22.1270008F, 70F));
                    builder.AddCubicBezier(new Vector2(22.1270008F, 70F), new Vector2(-40F, 70F), new Vector2(-40F, 70F));
                    builder.AddCubicBezier(new Vector2(-51.0460014F, 70F), new Vector2(-60F, 61.0460014F), new Vector2(-60F, 50F));
                    builder.AddCubicBezier(new Vector2(-60F, 50F), new Vector2(-60F, -20F), new Vector2(-60F, -20F));
                    builder.AddCubicBezier(new Vector2(-60F, -31.0459995F), new Vector2(-51.0460014F, -40F), new Vector2(-40F, -40F));
                    builder.AddCubicBezier(new Vector2(-40F, -40F), new Vector2(40F, -40F), new Vector2(40F, -40F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 7
0
        public void VerifySendPathTo()
        {
            //
            // This calls each of the path functions, once, and verfies that it works.
            // Sink behavior is verified in more detail in the geometry unit tests.
            //
            CanvasDevice device = new CanvasDevice();

            CanvasPathBuilder pathBuilder = new CanvasPathBuilder(device);

            pathBuilder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Alternate);
            pathBuilder.BeginFigure(0, 0);
            pathBuilder.AddLine(0, 0);
            pathBuilder.AddQuadraticBezier(new Vector2(), new Vector2());
            pathBuilder.AddCubicBezier(new Vector2(), new Vector2(), new Vector2());

            // D2D tries to be smart about degenerate arcs and redundant set segment options, and may sometimes actually
            // surpress them. Therefore, these calls use non-defaults.
            pathBuilder.AddArc(new Vector2 {
                X = 100, Y = 100
            }, 10, 10, 90, CanvasSweepDirection.Clockwise, CanvasArcSize.Small);
            pathBuilder.SetSegmentOptions(CanvasFigureSegmentOptions.ForceUnstroked);

            pathBuilder.EndFigure(CanvasFigureLoop.Closed);

            CanvasGeometry pathGeometry = CanvasGeometry.CreatePath(pathBuilder);

            MyGeometryStreamReader myStreamReader = new MyGeometryStreamReader();

            pathGeometry.SendPathTo(myStreamReader);

            myStreamReader.Verify();
        }
Exemplo n.º 8
0
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(21.4139996F, 59.112999F));
                    builder.AddCubicBezier(new Vector2(22.4300003F, 49.0349998F), new Vector2(25.007F, 39.894001F), new Vector2(29.1480007F, 31.691F));
                    builder.AddCubicBezier(new Vector2(33.2890015F, 23.4880009F), new Vector2(38.875F, 15.8319998F), new Vector2(45.9059982F, 8.72299957F));
                    builder.AddCubicBezier(new Vector2(52.3899994F, 2.16000009F), new Vector2(57.3699989F, -5.0079999F), new Vector2(60.8470001F, -12.7810001F));
                    builder.AddCubicBezier(new Vector2(64.3239975F, -20.5540009F), new Vector2(66.0619965F, -29.0900002F), new Vector2(66.0619965F, -38.387001F));
                    builder.AddCubicBezier(new Vector2(66.0619965F, -47.6839981F), new Vector2(64.2850037F, -56.4339981F), new Vector2(60.7299995F, -64.637001F));
                    builder.AddCubicBezier(new Vector2(57.1749992F, -72.8399963F), new Vector2(52.3510017F, -79.987999F), new Vector2(46.257F, -86.0820007F));
                    builder.AddCubicBezier(new Vector2(40.1629982F, -92.1760025F), new Vector2(33.0149994F, -97), new Vector2(24.8120003F, -100.555F));
                    builder.AddCubicBezier(new Vector2(16.6089993F, -104.110001F), new Vector2(7.85900021F, -105.887001F), new Vector2(-1.43799996F, -105.887001F));
                    builder.AddCubicBezier(new Vector2(-10.7349997F, -105.887001F), new Vector2(-19.4850006F, -104.110001F), new Vector2(-27.6879997F, -100.555F));
                    builder.AddCubicBezier(new Vector2(-35.8909988F, -97), new Vector2(-43.0390015F, -92.1760025F), new Vector2(-49.1329994F, -86.0820007F));
                    builder.AddCubicBezier(new Vector2(-55.2270012F, -79.987999F), new Vector2(-60.0509987F, -72.8399963F), new Vector2(-63.605999F, -64.637001F));
                    builder.AddCubicBezier(new Vector2(-67.1610031F, -56.4339981F), new Vector2(-68.9380035F, -47.6839981F), new Vector2(-68.9380035F, -38.387001F));
                    builder.AddCubicBezier(new Vector2(-68.9380035F, -29.0900002F), new Vector2(-67.1999969F, -20.5540009F), new Vector2(-63.7229996F, -12.7810001F));
                    builder.AddCubicBezier(new Vector2(-60.2459984F, -5.0079999F), new Vector2(-55.2659988F, 2.16000009F), new Vector2(-48.7820015F, 8.72299957F));
                    builder.AddCubicBezier(new Vector2(-41.7509995F, 15.8319998F), new Vector2(-36.1650009F, 23.4880009F), new Vector2(-32.0239983F, 31.691F));
                    builder.AddCubicBezier(new Vector2(-27.8829994F, 39.894001F), new Vector2(-25.3059998F, 49.0349998F), new Vector2(-24.2900009F, 59.112999F));
                    builder.AddLine(new Vector2(21.4139996F, 59.112999F));
                    builder.EndFigure(CanvasFigureLoop.Open);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 9
0
            // - - - - Shape tree root for layer: icon
            // - - - ShapeGroup: Group 2
            // - - Path 1
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-80F, -44.9970016F));
                    builder.AddCubicBezier(new Vector2(-80.0019989F, -58.8050003F), new Vector2(-68.8079987F, -70F), new Vector2(-55F, -70F));
                    builder.AddLine(new Vector2(-28.3600006F, -70F));
                    builder.AddCubicBezier(new Vector2(-25.1149998F, -70F), new Vector2(-21.9570007F, -68.947998F), new Vector2(-19.3610001F, -67.0009995F));
                    builder.AddLine(new Vector2(-3.35800004F, -55F));
                    builder.AddLine(new Vector2(44.9560013F, -55F));
                    builder.AddCubicBezier(new Vector2(58.7630005F, -55F), new Vector2(69.9560013F, -43.9070015F), new Vector2(69.9560013F, -30.1000004F));
                    builder.AddLine(new Vector2(70F, -30F));
                    builder.AddLine(new Vector2(-41.7639999F, -29.9790001F));
                    builder.AddCubicBezier(new Vector2(-48.9420013F, -29.9790001F), new Vector2(-55F, -25.3400002F), new Vector2(-56.4869995F, -17.8490009F));
                    builder.AddLine(new Vector2(-72.2580032F, 63.0509987F));
                    builder.AddCubicBezier(new Vector2(-77.0199966F, 58.5F), new Vector2(-79.9869995F, 52.0849991F), new Vector2(-79.987999F, 44.9780006F));
                    builder.AddLine(new Vector2(-80F, -44.9970016F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 10
0
            // - - - - Shape tree root for layer: icon
            // - - - ShapeGroup: Group 2
            // - - Path 3+Path 2+Path 1.PathGeometry
            CanvasGeometry Geometry_3()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-78.8949966F, -49.3380013F));
                    builder.AddCubicBezier(new Vector2(-80F, -44.7340012F), new Vector2(-80F, -39.1559982F), new Vector2(-80F, -28F));
                    builder.AddLine(new Vector2(-80F, 28F));
                    builder.AddCubicBezier(new Vector2(-80F, 39.1559982F), new Vector2(-80F, 44.7340012F), new Vector2(-78.8949966F, 49.3380013F));
                    builder.AddCubicBezier(new Vector2(-75.3840027F, 63.9640007F), new Vector2(-63.9640007F, 75.3830032F), new Vector2(-49.3380013F, 78.8949966F));
                    builder.AddCubicBezier(new Vector2(-44.7340012F, 80F), new Vector2(-39.1559982F, 80F), new Vector2(-28F, 80F));
                    builder.AddLine(new Vector2(10F, 80F));
                    builder.AddLine(new Vector2(10.0179996F, 39.0730019F));
                    builder.AddCubicBezier(new Vector2(-7.0710001F, 42.2659988F), new Vector2(-25.3899994F, 37.2089996F), new Vector2(-38.5509987F, 23.9319992F));
                    builder.AddCubicBezier(new Vector2(-40.4949989F, 21.9710007F), new Vector2(-40.480999F, 18.8050003F), new Vector2(-38.5200005F, 16.8610001F));
                    builder.AddCubicBezier(new Vector2(-36.5589981F, 14.9169998F), new Vector2(-33.3930016F, 14.9309998F), new Vector2(-31.4489994F, 16.8920002F));
                    builder.AddCubicBezier(new Vector2(-19.8419991F, 28.6009998F), new Vector2(-3.31800008F, 32.4729996F), new Vector2(11.5319996F, 28.4540005F));
                    builder.AddCubicBezier(new Vector2(11.9099998F, 27.3059998F), new Vector2(12.3579998F, 26.2329998F), new Vector2(12.8760004F, 25.2380009F));
                    builder.AddCubicBezier(new Vector2(17.2849998F, 16.0990009F), new Vector2(25.2479992F, 10.7620001F), new Vector2(35.894001F, 10.0710001F));
                    builder.AddLine(new Vector2(37.7879982F, 10.0089998F));
                    builder.AddLine(new Vector2(80F, 10F));
                    builder.AddLine(new Vector2(80F, -28F));
                    builder.AddCubicBezier(new Vector2(80F, -39.1559982F), new Vector2(80F, -44.7340012F), new Vector2(78.8949966F, -49.3380013F));
                    builder.AddCubicBezier(new Vector2(75.3830032F, -63.9640007F), new Vector2(63.9640007F, -75.3840027F), new Vector2(49.3380013F, -78.8949966F));
                    builder.AddCubicBezier(new Vector2(44.7340012F, -80F), new Vector2(39.1559982F, -80F), new Vector2(28F, -80F));
                    builder.AddLine(new Vector2(-28F, -80F));
                    builder.AddCubicBezier(new Vector2(-39.1559982F, -80F), new Vector2(-44.7340012F, -80F), new Vector2(-49.3380013F, -78.8949966F));
                    builder.AddCubicBezier(new Vector2(-63.9640007F, -75.3840027F), new Vector2(-75.3840027F, -63.9640007F), new Vector2(-78.8949966F, -49.3380013F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 11
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: Group 2
            CanvasGeometry Geometry_0()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(60F, -15F));
                    builder.AddCubicBezier(new Vector2(60F, -48.137001F), new Vector2(33.137001F, -75F), new Vector2(0F, -75F));
                    builder.AddCubicBezier(new Vector2(-33.137001F, -75F), new Vector2(-60F, -48.137001F), new Vector2(-60F, -15F));
                    builder.AddLine(new Vector2(-60F, 30F));
                    builder.AddLine(new Vector2(-65.9449997F, 37.4309998F));
                    builder.AddCubicBezier(new Vector2(-69.6750031F, 42.0950012F), new Vector2(-68.9189987F, 48.8989983F), new Vector2(-64.2549973F, 52.6300011F));
                    builder.AddCubicBezier(new Vector2(-62.7210007F, 53.8569984F), new Vector2(-60.8889999F, 54.6380005F), new Vector2(-58.9609985F, 54.901001F));
                    builder.AddLine(new Vector2(-57.5F, 55F));
                    builder.AddLine(new Vector2(57.4790001F, 55F));
                    builder.AddCubicBezier(new Vector2(63.4539986F, 55F), new Vector2(68.2969971F, 50.1559982F), new Vector2(68.2969971F, 44.1809998F));
                    builder.AddCubicBezier(new Vector2(68.2969971F, 41.7280006F), new Vector2(67.4639969F, 39.348999F), new Vector2(65.9329987F, 37.4319992F));
                    builder.AddLine(new Vector2(60F, 30F));
                    builder.AddLine(new Vector2(60F, -15F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 12
0
        void CreateClockFace(ICanvasResourceCreator sender)
        {
            const float begin = center - radius - lineLength / 2;
            const float end = center + radius + lineLength / 2;

            using (var builder = new CanvasPathBuilder(sender))
            {

                // Since we have concentric circles that we want to remain filled we want to use Winding to determine the filled region.
                builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);

                builder.AddCircleFigure(new Vector2(center), radius);
                builder.AddCircleFigure(new Vector2(center), radius * 0.6f);

                builder.AddOneLineFigure(center, begin, center, begin + lineLength);
                builder.AddOneLineFigure(center, end - lineLength, center, end);
                builder.AddOneLineFigure(begin, center, begin + lineLength, center);
                builder.AddOneLineFigure(end - lineLength, center, end, center);

                using (CanvasGeometry clockFaceGeometry = CanvasGeometry.CreatePath(builder))
                {
                    clockFaceCachedFill = CanvasCachedGeometry.CreateFill(clockFaceGeometry);
                    clockFaceCachedStroke18 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 18, timeCircleStrokeStyle);
                    clockFaceCachedStroke16 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 16, timeCircleStrokeStyle);
                }
            }
        }
Exemplo n.º 13
0
            CanvasGeometry Geometry()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-46.8400002F, -15F));
                    builder.AddLine(new Vector2(46.8400002F, -15F));
                    builder.AddCubicBezier(new Vector2(52.7799988F, -15F), new Vector2(56.5089989F, -14.0719995F), new Vector2(59.7680016F, -12.3290005F));
                    builder.AddCubicBezier(new Vector2(63.0270004F, -10.5860004F), new Vector2(65.5859985F, -8.02799988F), new Vector2(67.3290024F, -4.76900005F));
                    builder.AddCubicBezier(new Vector2(69.0719986F, -1.50999999F), new Vector2(70F, 2.22000003F), new Vector2(70F, 8.15999985F));
                    builder.AddLine(new Vector2(70F, 11.8400002F));
                    builder.AddCubicBezier(new Vector2(70F, 17.7800007F), new Vector2(69.0719986F, 21.5090008F), new Vector2(67.3290024F, 24.7679996F));
                    builder.AddCubicBezier(new Vector2(65.5859985F, 28.0270004F), new Vector2(63.0270004F, 30.5860004F), new Vector2(59.7680016F, 32.3289986F));
                    builder.AddCubicBezier(new Vector2(56.5089989F, 34.0719986F), new Vector2(52.7799988F, 35F), new Vector2(46.8400002F, 35F));
                    builder.AddLine(new Vector2(-46.8400002F, 35F));
                    builder.AddCubicBezier(new Vector2(-52.7799988F, 35F), new Vector2(-56.5089989F, 34.0719986F), new Vector2(-59.7680016F, 32.3289986F));
                    builder.AddCubicBezier(new Vector2(-63.0270004F, 30.5860004F), new Vector2(-65.5859985F, 28.0270004F), new Vector2(-67.3290024F, 24.7679996F));
                    builder.AddCubicBezier(new Vector2(-69.0719986F, 21.5090008F), new Vector2(-70F, 17.7800007F), new Vector2(-70F, 11.8400002F));
                    builder.AddLine(new Vector2(-70F, 8.15999985F));
                    builder.AddCubicBezier(new Vector2(-70F, 2.22000003F), new Vector2(-69.0719986F, -1.50999999F), new Vector2(-67.3290024F, -4.76900005F));
                    builder.AddCubicBezier(new Vector2(-65.5859985F, -8.02799988F), new Vector2(-63.0270004F, -10.5860004F), new Vector2(-59.7680016F, -12.3290005F));
                    builder.AddCubicBezier(new Vector2(-56.5089989F, -14.0719995F), new Vector2(-52.7799988F, -15F), new Vector2(-46.8400002F, -15F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 14
0
            // - - - - Shape tree root for layer: icon
            // - - - ShapeGroup: Group 2
            // - - Path 2+Path 1.PathGeometry
            CanvasGeometry Geometry_2()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-80.8570023F, -26.1730003F));
                    builder.AddCubicBezier(new Vector2(-77.1640015F, -37.5940018F), new Vector2(-71.0810013F, -48.0789986F), new Vector2(-63.0540009F, -56.9640007F));
                    builder.AddCubicBezier(new Vector2(-61.6969986F, -58.4669991F), new Vector2(-59.5670013F, -59.0019989F), new Vector2(-57.6599998F, -58.3199997F));
                    builder.AddLine(new Vector2(-38.4770012F, -51.4609985F));
                    builder.AddCubicBezier(new Vector2(-33.276001F, -49.6020012F), new Vector2(-27.5550003F, -52.3110008F), new Vector2(-25.6959991F, -57.512001F));
                    builder.AddCubicBezier(new Vector2(-25.5130005F, -58.0229988F), new Vector2(-25.3719997F, -58.5499992F), new Vector2(-25.2749996F, -59.0830002F));
                    builder.AddLine(new Vector2(-21.6200008F, -79.1429977F));
                    builder.AddCubicBezier(new Vector2(-21.257F, -81.1380005F), new Vector2(-19.7250004F, -82.7149963F), new Vector2(-17.7420006F, -83.137001F));
                    builder.AddCubicBezier(new Vector2(-11.9399996F, -84.3720016F), new Vector2(-5.9920001F, -85F), new Vector2(0.0350000001F, -85F));
                    builder.AddCubicBezier(new Vector2(6.05800009F, -85F), new Vector2(12.0030003F, -84.3720016F), new Vector2(17.802F, -83.1389999F));
                    builder.AddCubicBezier(new Vector2(19.7840004F, -82.7170029F), new Vector2(21.316F, -81.1409988F), new Vector2(21.6800003F, -79.1470032F));
                    builder.AddLine(new Vector2(25.3449993F, -59.0830002F));
                    builder.AddCubicBezier(new Vector2(26.3360004F, -53.6500015F), new Vector2(31.5440006F, -50.0489998F), new Vector2(36.9770012F, -51.0400009F));
                    builder.AddCubicBezier(new Vector2(37.5110016F, -51.137001F), new Vector2(38.0369987F, -51.2779999F), new Vector2(38.5470009F, -51.4599991F));
                    builder.AddLine(new Vector2(57.730999F, -58.3199997F));
                    builder.AddCubicBezier(new Vector2(59.637001F, -59.0019989F), new Vector2(61.7669983F, -58.4669991F), new Vector2(63.1240005F, -56.9640007F));
                    builder.AddCubicBezier(new Vector2(71.151001F, -48.0789986F), new Vector2(77.2350006F, -37.5940018F), new Vector2(80.9280014F, -26.1730003F));
                    builder.AddCubicBezier(new Vector2(81.5510025F, -24.2460003F), new Vector2(80.9499969F, -22.1350002F), new Vector2(79.4059982F, -20.8239994F));
                    builder.AddLine(new Vector2(63.8580017F, -7.62300014F));
                    builder.AddCubicBezier(new Vector2(59.6479988F, -4.04799986F), new Vector2(59.1329994F, 2.26300001F), new Vector2(62.7080002F, 6.47300005F));
                    builder.AddCubicBezier(new Vector2(63.0589981F, 6.88700008F), new Vector2(63.4440002F, 7.27099991F), new Vector2(63.8580017F, 7.62300014F));
                    builder.AddLine(new Vector2(79.4059982F, 20.8239994F));
                    builder.AddCubicBezier(new Vector2(80.9499969F, 22.1340008F), new Vector2(81.5510025F, 24.2469997F), new Vector2(80.9280014F, 26.1730003F));
                    builder.AddCubicBezier(new Vector2(77.2350006F, 37.5950012F), new Vector2(71.151001F, 48.0789986F), new Vector2(63.1240005F, 56.9640007F));
                    builder.AddCubicBezier(new Vector2(61.7669983F, 58.4659996F), new Vector2(59.637001F, 59.0019989F), new Vector2(57.730999F, 58.3199997F));
                    builder.AddLine(new Vector2(38.5480003F, 51.4609985F));
                    builder.AddCubicBezier(new Vector2(33.3470001F, 49.6020012F), new Vector2(27.625F, 52.3120003F), new Vector2(25.7660007F, 57.512001F));
                    builder.AddCubicBezier(new Vector2(25.5830002F, 58.0239983F), new Vector2(25.4430008F, 58.5489998F), new Vector2(25.3449993F, 59.0849991F));
                    builder.AddLine(new Vector2(21.6800003F, 79.1470032F));
                    builder.AddCubicBezier(new Vector2(21.316F, 81.1409988F), new Vector2(19.7840004F, 82.7180023F), new Vector2(17.802F, 83.1389999F));
                    builder.AddCubicBezier(new Vector2(12.0030003F, 84.3730011F), new Vector2(6.05800009F, 85F), new Vector2(0.0350000001F, 85F));
                    builder.AddCubicBezier(new Vector2(-5.9920001F, 85F), new Vector2(-11.9399996F, 84.3720016F), new Vector2(-17.7420006F, 83.137001F));
                    builder.AddCubicBezier(new Vector2(-19.7250004F, 82.7149963F), new Vector2(-21.257F, 81.137001F), new Vector2(-21.6200008F, 79.1429977F));
                    builder.AddLine(new Vector2(-25.2749996F, 59.0839996F));
                    builder.AddCubicBezier(new Vector2(-26.2660007F, 53.6500015F), new Vector2(-31.4729996F, 50.0489998F), new Vector2(-36.9059982F, 51.0400009F));
                    builder.AddCubicBezier(new Vector2(-37.4399986F, 51.137001F), new Vector2(-37.9659996F, 51.2779999F), new Vector2(-38.4770012F, 51.4609985F));
                    builder.AddLine(new Vector2(-57.6599998F, 58.3199997F));
                    builder.AddCubicBezier(new Vector2(-59.5670013F, 59.0019989F), new Vector2(-61.6969986F, 58.4659996F), new Vector2(-63.0540009F, 56.9640007F));
                    builder.AddCubicBezier(new Vector2(-71.0810013F, 48.0789986F), new Vector2(-77.1640015F, 37.5950012F), new Vector2(-80.8570023F, 26.1730003F));
                    builder.AddCubicBezier(new Vector2(-81.4800034F, 24.2469997F), new Vector2(-80.8799973F, 22.1340008F), new Vector2(-79.3359985F, 20.8239994F));
                    builder.AddLine(new Vector2(-63.7869987F, 7.62300014F));
                    builder.AddCubicBezier(new Vector2(-59.5769997F, 4.04799986F), new Vector2(-59.0620003F, -2.26300001F), new Vector2(-62.637001F, -6.47300005F));
                    builder.AddCubicBezier(new Vector2(-62.9889984F, -6.88700008F), new Vector2(-63.3730011F, -7.27099991F), new Vector2(-63.7869987F, -7.62200022F));
                    builder.AddLine(new Vector2(-79.3359985F, -20.8239994F));
                    builder.AddCubicBezier(new Vector2(-80.8799973F, -22.1350002F), new Vector2(-81.4800034F, -24.2460003F), new Vector2(-80.8570023F, -26.1730003F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
        /// <summary>
        /// Adds the Path Element to the Path.
        /// </summary>
        /// <param name="pathBuilder">CanvasPathBuilder object</param>
        /// <param name="currentPoint">The last active location in the Path before adding
        /// the Path Element</param>
        /// <param name="lastElement">The previous PathElement in the Path.</param>
        /// <returns>The latest location in the Path after adding the Path Element</returns>
        public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, ref ICanvasPathElement lastElement)
        {
            // Execute command
            pathBuilder.SetFilledRegionDetermination(_fillValue);

            // Set Last Element
            lastElement = this;

            // Return current point
            return(currentPoint);
        }
        /// <summary>
        /// Adds the Path Element to the Path.
        /// </summary>
        /// <param name="pathBuilder">CanvasPathBuilder object</param>
        /// <param name="currentPoint">The last active location in the Path before adding
        /// the Path Element</param>
        /// <param name="lastElement">The previous PathElement in the Path.</param>
        /// <param name="logger">For logging purpose. To log the set of CanvasPathBuilder
        /// commands, used for creating the CanvasGeometry, in string format.</param>
        /// <returns>The latest location in the Path after adding the Path Element</returns>
        public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint,
                                           ref ICanvasPathElement lastElement, StringBuilder logger)
        {
            // Execute command
            pathBuilder.SetFilledRegionDetermination(_fillValue);

            // Log command
            logger?.AppendLine($"{Indent}pathBuilder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.{_fillValue});");

            // Set Last Element
            lastElement = this;
            // Return current point
            return(currentPoint);
        }
Exemplo n.º 17
0
 CanvasGeometry BuildCircleGeometry()
 {
     using (var builder = new CanvasPathBuilder(null))
     {
         builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
         builder.BeginFigure(new Vector2(42.223F, -146));
         builder.AddCubicBezier(new Vector2(115.248F, -146), new Vector2(174.445F, -86.13F), new Vector2(174.445F, -12.277F));
         builder.AddCubicBezier(new Vector2(174.445F, 61.576F), new Vector2(115.248F, 121.445F), new Vector2(42.223F, 121.445F));
         builder.AddCubicBezier(new Vector2(-30.802F, 121.445F), new Vector2(-90, 61.576F), new Vector2(-90, -12.277F));
         builder.AddCubicBezier(new Vector2(-90, -86.13F), new Vector2(-30.802F, -146), new Vector2(42.223F, -146));
         builder.EndFigure(CanvasFigureLoop.Closed);
         return(CanvasGeometry.CreatePath(builder));
     }
 }
Exemplo n.º 18
0
 CanvasGeometry BuildSquareGeometry()
 {
     using (var builder = new CanvasPathBuilder(null))
     {
         builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
         builder.BeginFigure(new Vector2(-90, -146));
         builder.AddCubicBezier(new Vector2(-90, -146), new Vector2(176, -148.555F), new Vector2(176, -148.555F));
         builder.AddCubicBezier(new Vector2(176, -148.555F), new Vector2(174.445F, 121.445F), new Vector2(174.445F, 121.445F));
         builder.AddCubicBezier(new Vector2(174.445F, 121.445F), new Vector2(-91.555F, 120), new Vector2(-91.555F, 120));
         builder.AddCubicBezier(new Vector2(-91.555F, 120), new Vector2(-90, -146), new Vector2(-90, -146));
         builder.EndFigure(CanvasFigureLoop.Closed);
         return(CanvasGeometry.CreatePath(builder));
     }
 }
Exemplo n.º 19
0
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-114, -236));
                    builder.AddLine(new Vector2(-114, 242));
                    builder.EndFigure(CanvasFigureLoop.Open);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 20
0
            // - - - Layer aggregator
            // - -  Scale:0.70016,1.05751, Offset:<202, 162>
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(3F, -54F));
                    builder.AddCubicBezier(new Vector2(22.2800007F, -39.7159996F), new Vector2(51F, 26F), new Vector2(0F, 53F));
                    builder.AddCubicBezier(new Vector2(17.1389999F, 58.6279984F), new Vector2(43.5250015F, 26.9519997F), new Vector2(40.9780006F, -6.6079998F));
                    builder.AddCubicBezier(new Vector2(39.7750015F, -22.4619999F), new Vector2(30.8500004F, -43.4980011F), new Vector2(3F, -54F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 21
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: Group 1
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(24.4990005F, 65.0039978F));
                    builder.AddCubicBezier(new Vector2(22.1809998F, 76.413002F), new Vector2(12.0930004F, 85F), new Vector2(0F, 85F));
                    builder.AddCubicBezier(new Vector2(-12.0930004F, 85F), new Vector2(-22.1809998F, 76.413002F), new Vector2(-24.4990005F, 65.0039978F));
                    builder.AddLine(new Vector2(24.4990005F, 65.0039978F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 22
0
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(40F, 20F));
                    builder.AddCubicBezier(new Vector2(45.5229988F, 20F), new Vector2(50F, 15.5229998F), new Vector2(50F, 10F));
                    builder.AddCubicBezier(new Vector2(50F, 4.47700024F), new Vector2(45.5229988F, 0F), new Vector2(40F, 0F));
                    builder.AddCubicBezier(new Vector2(34.4770012F, 0F), new Vector2(30F, 4.47700024F), new Vector2(30F, 10F));
                    builder.AddCubicBezier(new Vector2(30F, 15.5229998F), new Vector2(34.4770012F, 20F), new Vector2(40F, 20F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 23
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: Group 2
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(0F, 35F));
                    builder.AddCubicBezier(new Vector2(-4.1420002F, 35F), new Vector2(-7.5F, 38.3580017F), new Vector2(-7.5F, 42.5F));
                    builder.AddCubicBezier(new Vector2(-7.5F, 46.6419983F), new Vector2(-4.1420002F, 50F), new Vector2(0F, 50F));
                    builder.AddCubicBezier(new Vector2(4.1420002F, 50F), new Vector2(7.5F, 46.6419983F), new Vector2(7.5F, 42.5F));
                    builder.AddCubicBezier(new Vector2(7.5F, 38.3580017F), new Vector2(4.1420002F, 35F), new Vector2(0F, 35F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 24
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: Group 3
            CanvasGeometry Geometry_0()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(0F, -80F));
                    builder.AddCubicBezier(new Vector2(44.1829987F, -80F), new Vector2(80F, -44.1829987F), new Vector2(80F, 0F));
                    builder.AddCubicBezier(new Vector2(80F, 44.1829987F), new Vector2(44.1829987F, 80F), new Vector2(0F, 80F));
                    builder.AddCubicBezier(new Vector2(-44.1829987F, 80F), new Vector2(-80F, 44.1829987F), new Vector2(-80F, 0F));
                    builder.AddCubicBezier(new Vector2(-80F, -44.1829987F), new Vector2(-44.1829987F, -80F), new Vector2(0F, -80F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 25
0
            // - - - - Shape tree root for layer: Shape
            // - - -  Offset:<100, 100>
            // - - Path 2+Path 1.PathGeometry
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-2.33299994F, -1.14300001F));
                    builder.AddCubicBezier(new Vector2(-2.33299994F, -2.40499997F), new Vector2(-1.28900003F, -3.4289999F), new Vector2(0F, -3.4289999F));
                    builder.AddCubicBezier(new Vector2(1.28900003F, -3.4289999F), new Vector2(2.33299994F, -2.40499997F), new Vector2(2.33299994F, -1.14300001F));
                    builder.AddCubicBezier(new Vector2(2.33299994F, 0.119000003F), new Vector2(1.28900003F, 1.14300001F), new Vector2(0F, 1.14300001F));
                    builder.AddCubicBezier(new Vector2(-1.28900003F, 1.14300001F), new Vector2(-2.33299994F, 0.119000003F), new Vector2(-2.33299994F, -1.14300001F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 26
0
            // - - - - Shape tree root for layer: icon
            // - - - ShapeGroup: Group 2
            // - - Path 3+Path 2+Path 1.PathGeometry
            CanvasGeometry Geometry_2()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-40F, -20F));
                    builder.AddCubicBezier(new Vector2(-40F, -25.5230007F), new Vector2(-35.5229988F, -30F), new Vector2(-30F, -30F));
                    builder.AddCubicBezier(new Vector2(-24.4769993F, -30F), new Vector2(-20F, -25.5230007F), new Vector2(-20F, -20F));
                    builder.AddCubicBezier(new Vector2(-20F, -14.4770002F), new Vector2(-24.4769993F, -10F), new Vector2(-30F, -10F));
                    builder.AddCubicBezier(new Vector2(-35.5229988F, -10F), new Vector2(-40F, -14.4770002F), new Vector2(-40F, -20F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 27
0
        static CanvasGeometry MakeGeometry(IEnumerable <Data.Path> paths, CanvasFilledRegionDetermination fillRule = CanvasFilledRegionDetermination.Winding)
        {
            var device = CanvasDevice.GetSharedDevice();

            using var builder = new CanvasPathBuilder(device);

            if (paths != null)
            {
                foreach (var path in paths)
                {
                    builder.AddGeometry(path.CanvasPath);
                }
            }
            builder.SetFilledRegionDetermination(fillRule);

            return(CanvasGeometry.CreatePath(builder));
        }
Exemplo n.º 28
0
            // - - - - Shape tree root for layer: icon
            // - - -  Offset:<-3.8320007, 0>
            // - - Path 3+Path 1.PathGeometry
            CanvasGeometry Geometry_5()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(-40F, 30F));
                    builder.AddCubicBezier(new Vector2(-28.9540005F, 30F), new Vector2(-20F, 21.0459995F), new Vector2(-20F, 10F));
                    builder.AddCubicBezier(new Vector2(-20F, -1.046F), new Vector2(-28.9540005F, -10F), new Vector2(-40F, -10F));
                    builder.AddCubicBezier(new Vector2(-51.0460014F, -10F), new Vector2(-60F, -1.046F), new Vector2(-60F, 10F));
                    builder.AddCubicBezier(new Vector2(-60F, 21.0459995F), new Vector2(-51.0460014F, 30F), new Vector2(-40F, 30F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 29
0
            // - - - - - Shape tree root for layer: icon
            // - - - -  Offset:<-3.8320007, 0>
            // - - - Path 3+Path 1.PathGeometry
            // - - Path
            CanvasGeometry Geometry_16()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(70F, 30F));
                    builder.AddCubicBezier(new Vector2(81.0459976F, 30F), new Vector2(90F, 21.0459995F), new Vector2(90F, 10F));
                    builder.AddCubicBezier(new Vector2(90F, -1.046F), new Vector2(81.0459976F, -10F), new Vector2(70F, -10F));
                    builder.AddCubicBezier(new Vector2(58.9539986F, -10F), new Vector2(50F, -1.046F), new Vector2(50F, 10F));
                    builder.AddCubicBezier(new Vector2(50F, 21.0459995F), new Vector2(58.9539986F, 30F), new Vector2(70F, 30F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 30
0
            // - - - Shape tree root for layer: icon
            // - - ShapeGroup: Group 1
            CanvasGeometry Geometry_2()
            {
                CanvasGeometry result;

                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(6.99499989F, 35.1259995F));
                    builder.AddCubicBezier(new Vector2(6.99499989F, 31.2619991F), new Vector2(3.86299992F, 28.1299992F), new Vector2(-0.00100000005F, 28.1299992F));
                    builder.AddCubicBezier(new Vector2(-3.86500001F, 28.1299992F), new Vector2(-6.99700022F, 31.2619991F), new Vector2(-6.99700022F, 35.1259995F));
                    builder.AddCubicBezier(new Vector2(-6.99700022F, 38.9900017F), new Vector2(-3.86500001F, 42.1220016F), new Vector2(-0.00100000005F, 42.1220016F));
                    builder.AddCubicBezier(new Vector2(3.86299992F, 42.1220016F), new Vector2(6.99499989F, 38.9900017F), new Vector2(6.99499989F, 35.1259995F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return(result);
            }
Exemplo n.º 31
0
        public void VerifySendPathTo()
        {
            //
            // This calls each of the path functions, once, and verfies that it works.
            // Sink behavior is verified in more detail in the geometry unit tests.
            //
            CanvasDevice device = new CanvasDevice();

            CanvasPathBuilder pathBuilder = new CanvasPathBuilder(device);
            pathBuilder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Alternate);
            pathBuilder.BeginFigure(0, 0);
            pathBuilder.AddLine(0, 0);
            pathBuilder.AddQuadraticBezier(new Vector2(), new Vector2());
            pathBuilder.AddCubicBezier(new Vector2(), new Vector2(), new Vector2());

            // D2D tries to be smart about degenerate arcs and redundant set segment options, and may sometimes actually
            // surpress them. Therefore, these calls use non-defaults.
            pathBuilder.AddArc(new Vector2 { X = 100, Y = 100 }, 10, 10, 90, CanvasSweepDirection.Clockwise, CanvasArcSize.Small);
            pathBuilder.SetSegmentOptions(CanvasFigureSegmentOptions.ForceUnstroked);

            pathBuilder.EndFigure(CanvasFigureLoop.Closed);

            CanvasGeometry pathGeometry = CanvasGeometry.CreatePath(pathBuilder);

            MyGeometryStreamReader myStreamReader = new MyGeometryStreamReader();
            pathGeometry.SendPathTo(myStreamReader);

            myStreamReader.Verify();
        }
Exemplo n.º 32
0
        public static CanvasGeometry ToCanvasGeometry(this XPathGeometry pg, CanvasDrawingSession ds)
        {
            CanvasGeometry g;

            using (var builder = new CanvasPathBuilder(ds))
            {
                if (pg.FillRule == XFillRule.EvenOdd)
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Alternate);
                else
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);

                foreach (var pf in pg.Figures)
                {
                    builder.BeginFigure(
                        (float)pf.StartPoint.X,
                        (float)pf.StartPoint.Y,
                        pf.IsFilled ? CanvasFigureFill.Default : CanvasFigureFill.DoesNotAffectFills);

                    foreach (var segment in pf.Segments)
                    {
                        var options = CanvasFigureSegmentOptions.None;
                        if (!segment.IsStroked)
                            options |= CanvasFigureSegmentOptions.ForceUnstroked;

                        if (segment.IsSmoothJoin)
                            options |= CanvasFigureSegmentOptions.ForceRoundLineJoin;

                        builder.SetSegmentOptions(options);

                        if (segment is XArcSegment)
                        {
                            var arcSegment = segment as XArcSegment;
                            builder.AddArc(
                                new N.Vector2(
                                    (float)arcSegment.Point.X,
                                    (float)arcSegment.Point.Y),
                                (float)(arcSegment.Size.Width / 2.0),
                                (float)(arcSegment.Size.Height / 2.0),
                                (float)arcSegment.RotationAngle,
                                arcSegment.SweepDirection == XSweepDirection.Clockwise ? CanvasSweepDirection.Clockwise : CanvasSweepDirection.CounterClockwise,
                                arcSegment.IsLargeArc ? CanvasArcSize.Large : CanvasArcSize.Small);
                        }
                        else if (segment is XBezierSegment)
                        {
                            var bezierSegment = segment as XBezierSegment;
                            builder.AddCubicBezier(
                                new N.Vector2(
                                    (float)bezierSegment.Point1.X,
                                    (float)bezierSegment.Point1.Y),
                                new N.Vector2(
                                    (float)bezierSegment.Point2.X,
                                    (float)bezierSegment.Point2.Y),
                                new N.Vector2(
                                    (float)bezierSegment.Point3.X,
                                    (float)bezierSegment.Point3.Y));
                        }
                        else if (segment is XLineSegment)
                        {
                            var lineSegment = segment as XLineSegment;
                            builder.AddLine(
                                new N.Vector2(
                                    (float)lineSegment.Point.X,
                                    (float)lineSegment.Point.Y));
                        }
                        else if (segment is XPolyBezierSegment)
                        {
                            var polyBezierSegment = segment as XPolyBezierSegment;
                            if (polyBezierSegment.Points.Count >= 3)
                            {
                                builder.AddCubicBezier(
                                    new N.Vector2(
                                        (float)polyBezierSegment.Points[0].X,
                                        (float)polyBezierSegment.Points[0].Y),
                                    new N.Vector2(
                                        (float)polyBezierSegment.Points[1].X,
                                        (float)polyBezierSegment.Points[1].Y),
                                    new N.Vector2(
                                        (float)polyBezierSegment.Points[2].X,
                                        (float)polyBezierSegment.Points[2].Y));
                            }

                            if (polyBezierSegment.Points.Count > 3
                                && polyBezierSegment.Points.Count % 3 == 0)
                            {
                                for (int i = 3; i < polyBezierSegment.Points.Count; i += 3)
                                {
                                    builder.AddCubicBezier(
                                        new N.Vector2(
                                            (float)polyBezierSegment.Points[i].X,
                                            (float)polyBezierSegment.Points[i].Y),
                                        new N.Vector2(
                                            (float)polyBezierSegment.Points[i + 1].X,
                                            (float)polyBezierSegment.Points[i + 1].Y),
                                        new N.Vector2(
                                            (float)polyBezierSegment.Points[i + 2].X,
                                            (float)polyBezierSegment.Points[i + 2].Y));
                                }
                            }
                        }
                        else if (segment is XPolyLineSegment)
                        {
                            var polyLineSegment = segment as XPolyLineSegment;

                            if (polyLineSegment.Points.Count >= 1)
                            {
                                builder.AddLine(
                                    new N.Vector2(
                                        (float)polyLineSegment.Points[0].X,
                                        (float)polyLineSegment.Points[0].Y));
                            }

                            if (polyLineSegment.Points.Count > 1)
                            {
                                for (int i = 1; i < polyLineSegment.Points.Count; i++)
                                {
                                    builder.AddLine(
                                        new N.Vector2(
                                            (float)polyLineSegment.Points[i].X,
                                            (float)polyLineSegment.Points[i].Y));
                                }
                            }
                        }
                        else if (segment is XPolyQuadraticBezierSegment)
                        {
                            var polyQuadraticSegment = segment as XPolyQuadraticBezierSegment;
                            if (polyQuadraticSegment.Points.Count >= 2)
                            {
                                builder.AddQuadraticBezier(
                                    new N.Vector2(
                                        (float)polyQuadraticSegment.Points[0].X,
                                        (float)polyQuadraticSegment.Points[0].Y),
                                    new N.Vector2(
                                        (float)polyQuadraticSegment.Points[1].X,
                                        (float)polyQuadraticSegment.Points[1].Y));
                            }

                            if (polyQuadraticSegment.Points.Count > 2
                                && polyQuadraticSegment.Points.Count % 2 == 0)
                            {
                                for (int i = 3; i < polyQuadraticSegment.Points.Count; i += 3)
                                {
                                    builder.AddQuadraticBezier(
                                        new N.Vector2(
                                            (float)polyQuadraticSegment.Points[i].X,
                                            (float)polyQuadraticSegment.Points[i].Y),
                                        new N.Vector2(
                                            (float)polyQuadraticSegment.Points[i + 1].X,
                                            (float)polyQuadraticSegment.Points[i + 1].Y));
                                }
                            }
                        }
                        else if (segment is XQuadraticBezierSegment)
                        {
                            var qbezierSegment = segment as XQuadraticBezierSegment;
                            builder.AddQuadraticBezier(
                                new N.Vector2(
                                    (float)qbezierSegment.Point1.X,
                                    (float)qbezierSegment.Point1.Y),
                                new N.Vector2(
                                    (float)qbezierSegment.Point2.X,
                                    (float)qbezierSegment.Point2.Y));
                        }
                        else
                        {
                            throw new NotSupportedException("Not supported segment type: " + segment.GetType());
                        }
                    }

                    builder.EndFigure(pf.IsClosed ? CanvasFigureLoop.Closed : CanvasFigureLoop.Open);
                }

                g = CanvasGeometry.CreatePath(builder);
            }

            return g;
        }
        void CreateClockFace(ICanvasResourceCreator sender)
        {
            const float begin = center - radius - lineLength / 2;
            const float end = center + radius + lineLength / 2;

            using (var builder = new CanvasPathBuilder(sender))
            {

                // Since we have concentric circles that we want to remain filled we want to use Winding to determine the filled region.
                builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);

                builder.AddCircleFigure(new Vector2(center), radius);
                builder.AddCircleFigure(new Vector2(center), radius * 0.6f);

                builder.AddOneLineFigure(center, begin, center, begin + lineLength);
                builder.AddOneLineFigure(center, end - lineLength, center, end);
                builder.AddOneLineFigure(begin, center, begin + lineLength, center);
                builder.AddOneLineFigure(end - lineLength, center, end, center);

                using (CanvasGeometry clockFaceGeometry = CanvasGeometry.CreatePath(builder))
                {
                    clockFaceCachedFill = CanvasCachedGeometry.CreateFill(clockFaceGeometry);
                    clockFaceCachedStroke18 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 18, timeCircleStrokeStyle);
                    clockFaceCachedStroke16 = CanvasCachedGeometry.CreateStroke(clockFaceGeometry, 16, timeCircleStrokeStyle);
                }
            }
        }