Beispiel #1
0
 public static FillMode ToEto(this sd.FillMode f)
 {
     return
         (f == sd.FillMode.Alternate
                         ? FillMode.Alternate
                         : FillMode.Winding);
 }
Beispiel #2
0
        public static D2D1.Geometry Create(D2D1.RenderTarget target, Paths.Path path,
                                           D2D1.FillMode fillMode = D2D1.FillMode.Winding)
        {
            var segments   = path.Segments;
            var length     = segments.Length;
            var geometries = length > 1 ? new D2D1.Geometry[segments.Length] : null;
            var i          = 0;

            foreach (var segment in path.Segments)
            {
                var geometry = new D2D1.PathGeometry(target.Factory);
                using (var sink = geometry.Open())
                {
                    sink.SetSegmentFlags(D2D1.PathSegment.None);
                    foreach (var x in segment.Commands)
                    {
                        x.Visit(sink, Visitor);
                    }
                    sink.Close();
                }

                if (length == 1)
                {
                    return(geometry);
                }
                geometries[i++] = geometry;
            }

            try
            {
                return(new D2D1.GeometryGroup(target.Factory, fillMode, geometries));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }