本文整理汇总了C#中System.Windows.Media.Geometry.GetFlattenedPathGeometry方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.GetFlattenedPathGeometry方法的具体用法?C# Geometry.GetFlattenedPathGeometry怎么用?C# Geometry.GetFlattenedPathGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Geometry
的用法示例。
在下文中一共展示了Geometry.GetFlattenedPathGeometry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlattenGeometry
public PathGeometry FlattenGeometry(Geometry geoSrc, double tolerance)
{
// Return empty PathGeometry if geo is null
if (geoSrc == null)
return GetPathGeometry();
#if !SILVERLIGHT
// Let system flatten it if any part of the Geometry
// is a StreamGeometry of CombinedGeometry
if (HasEmbeddedStreamGeometryOrCombinedGeometry(geoSrc))
return geoSrc.GetFlattenedPathGeometry(tolerance, ToleranceType.Absolute);
#endif
PathGeometry pathGeoDst = GetPathGeometry();
FlattenGeometry(pathGeoDst, geoSrc, tolerance, Matrix.Identity);
return pathGeoDst;
}
示例2: Read
///<summary>
/// Converts a <see cref="WpfGeometry"/> to a Geometry, flattening it first.
///</summary>
/// <param name="shp">The <see cref="WpfGeometry"/></param>
/// <param name="tolerance">The tolerance parameter to use</param>
/// <param name="geomFact">The GeometryFactory to use</param>
/// <returns>A Geometry representing the shape</returns>
public static IGeometry Read(WpfGeometry shp, double tolerance, IGeometryFactory geomFact)
{
var path = shp.GetFlattenedPathGeometry(tolerance, ToleranceType.Relative);
return Read(path, geomFact);
}
示例3: TriangulateText
private static void TriangulateText(out List<Point3D> vertices, out List<Vector3D> normals, out List<int> indices, out List<Point> textures, Geometry geometry, double depth)
{
//Got this here:
//http://msdn.microsoft.com/en-us/magazine/cc163349.aspx
vertices = new List<Point3D>();
normals = new List<Vector3D>();
indices = new List<int>();
textures = new List<Point>();
Point origin = new Point(0, 0); // origin was passed into the making of geometry. Don't think it's need twice
// Convert TextGeometry to series of closed polylines.
PathGeometry path = geometry.GetFlattenedPathGeometry(0.001, ToleranceType.Relative);
List<Point> list = new List<Point>();
foreach (PathFigure fig in path.Figures)
{
list.Clear();
list.Add(fig.StartPoint);
foreach (PathSegment seg in fig.Segments)
{
if (seg is LineSegment)
{
LineSegment lineseg = seg as LineSegment;
list.Add(lineseg.Point);
}
else if (seg is PolyLineSegment)
{
PolyLineSegment polyline = seg as PolyLineSegment;
for (int i = 0; i < polyline.Points.Count; i++)
list.Add(polyline.Points[i]);
}
}
// Figure is complete. Post-processing follows.
if (list.Count > 0)
{
// Remove last point if it's the same as the first.
if (list[0] == list[list.Count - 1])
list.RemoveAt(list.Count - 1);
// Convert points to Y increasing up.
for (int i = 0; i < list.Count; i++)
{
Point pt = list[i];
pt.Y = 2 * origin.Y - pt.Y;
list[i] = pt;
}
// For each figure, process the points.
ProcessTextFigure(list, vertices, normals, indices, textures, depth);
}
}
}
示例4: GradientGeometry
public GradientGeometry(Geometry data, double tolerance, double strokeThickness)
{
// Flatten the PathGeometry
var flattened = data.GetFlattenedPathGeometry(tolerance, ToleranceType.Absolute);
this.FigureGeometries = flattened.Figures.Select(x => new FigureGeometry(x, strokeThickness)).ToArray();
}