当前位置: 首页>>代码示例>>C#>>正文


C# GeometryGroup.GetFlattenedPathGeometry方法代码示例

本文整理汇总了C#中System.Windows.Media.GeometryGroup.GetFlattenedPathGeometry方法的典型用法代码示例。如果您正苦于以下问题:C# GeometryGroup.GetFlattenedPathGeometry方法的具体用法?C# GeometryGroup.GetFlattenedPathGeometry怎么用?C# GeometryGroup.GetFlattenedPathGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.GeometryGroup的用法示例。


在下文中一共展示了GeometryGroup.GetFlattenedPathGeometry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildVertexGeometry

 /// <summary>
 /// Returns the flattened geometry for the argument vertex. It does not take the transforms on the vertex into account.
 /// </summary>
 /// <param name="v"></param>
 /// <returns></returns>
 private static PathGeometry BuildVertexGeometry(Visual v)
 {
     GeometryGroup fromGeometry = new GeometryGroup();
     fromGeometry.FillRule = FillRule.Nonzero;
     WalkChildren((Visual)v, fromGeometry);
     PathGeometry fromGeometryFlat = fromGeometry.GetFlattenedPathGeometry();
     return fromGeometryFlat;
 }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:13,代码来源:GeometryOperation.cs

示例2: CombineGeometries

        //---------------------------------------------------------//
        /// <summary>
        /// Combines two Geometries, offset by the specified amount.
        /// </summary>
        /// <param name="geometry1">The first geometry to combine.</param>
        /// <param name="offset1">The offset of the first geometry relative to the second geometry, specified in puzzle piece units.</param>
        /// <param name="geometry1">The second geometry to combine.</param>
        /// <param name="offset1">The offset of the second geometry relative to the first geometry, specified in puzzle piece units.</param>
        /// <returns>The combined geometry</returns>
        private Geometry CombineGeometries(PuzzlePiece piece1, PuzzlePiece piece2)
        {
            // Get the geometires that will be joined
            Geometry geometry1 = piece1.ClipShape;
            Geometry geometry2 = piece2.ClipShape;

            // Get the offset of each piece relative to the puzzle
            Vector offset1InPixels = GetPieceTopLeftInScreenUnits(piece1);
            Vector offset2InPixels = GetPieceTopLeftInScreenUnits(piece2);

            // Use the offsets determined above to find the offset of each piece relative to the other piece
            // Between the two offsets, only one offset will have a nonzero value for x and y. This could be 
            // the same offset, or different offsets. Possible combinations are (0,0) and (100, 100); (50, 0) 
            // and (0, 75) but not (10, 0) and (15, 0)
            Vector relativeOffset1 = new Vector(Math.Max(0, Math.Round(offset1InPixels.X - offset2InPixels.X)), Math.Max(0, Math.Round(offset1InPixels.Y - offset2InPixels.Y)));
            Vector relativeOffset2 = new Vector(Math.Max(0, Math.Round(offset2InPixels.X - offset1InPixels.X)), Math.Max(0, Math.Round(offset2InPixels.Y - offset1InPixels.Y)));

            // Translate the geometries according to their offsets so they don't overlap when they're joined
            geometry1.Transform = new TranslateTransform(relativeOffset1.X, relativeOffset1.Y);
            geometry2.Transform = new TranslateTransform(relativeOffset2.X, relativeOffset2.Y);

            // Make a new GeometryGroup
            GeometryGroup newGeometry = new GeometryGroup();
            newGeometry.FillRule = FillRule.Nonzero;

            // Add the Geometries to the group
            newGeometry.Children.Add(geometry1);
            newGeometry.Children.Add(geometry2);

            // Flatten the group and return it
            return newGeometry.GetFlattenedPathGeometry();
        }
开发者ID:AnthonyB28,项目名称:Marist_Map,代码行数:41,代码来源:PuzzleMgr.cs


注:本文中的System.Windows.Media.GeometryGroup.GetFlattenedPathGeometry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。