本文整理汇总了C#中System.Windows.Media.Geometry.GetPathGeometryData方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.GetPathGeometryData方法的具体用法?C# Geometry.GetPathGeometryData怎么用?C# Geometry.GetPathGeometryData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Geometry
的用法示例。
在下文中一共展示了Geometry.GetPathGeometryData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HitTestWithPathGeometry
internal static IntersectionDetail HitTestWithPathGeometry(
Geometry geometry1,
Geometry geometry2,
double tolerance,
ToleranceType type)
{
IntersectionDetail detail = IntersectionDetail.NotCalculated;
unsafe
{
PathGeometryData data1 = geometry1.GetPathGeometryData();
PathGeometryData data2 = geometry2.GetPathGeometryData();
fixed (byte *pbPathData1 = data1.SerializedData)
{
Debug.Assert(pbPathData1 != (byte*)0);
fixed (byte *pbPathData2 = data2.SerializedData)
{
Debug.Assert(pbPathData2 != (byte*)0);
int hr = MilCoreApi.MilUtility_PathGeometryHitTestPathGeometry(
&data1.Matrix,
data1.FillRule,
pbPathData1,
data1.Size,
&data2.Matrix,
data2.FillRule,
pbPathData2,
data2.Size,
tolerance,
type == ToleranceType.Relative,
&detail);
if (hr == (int)MILErrors.WGXERR_BADNUMBER)
{
// When we encounter NaNs in the renderer, we absorb the error and draw
// nothing. To be consistent, we report that the geometry is never hittable.
detail = IntersectionDetail.Empty;
}
else
{
HRESULT.Check(hr);
}
}
}
}
Debug.Assert(detail != IntersectionDetail.NotCalculated);
return detail;
}
示例2: InternalCombine
internal static PathGeometry InternalCombine(
Geometry geometry1,
Geometry geometry2,
GeometryCombineMode mode,
Transform transform,
double tolerance,
ToleranceType type)
{
PathGeometry resultGeometry = null;
unsafe
{
MilMatrix3x2D matrix = CompositionResourceManager.TransformToMilMatrix3x2D(transform);
PathGeometryData data1 = geometry1.GetPathGeometryData();
PathGeometryData data2 = geometry2.GetPathGeometryData();
fixed (byte* pPathData1 = data1.SerializedData)
{
Debug.Assert(pPathData1 != (byte*)0);
fixed (byte* pPathData2 = data2.SerializedData)
{
Debug.Assert(pPathData2 != (byte*)0);
FillRule fillRule = FillRule.Nonzero;
FigureList list = new FigureList();
int hr = UnsafeNativeMethods.MilCoreApi.MilUtility_PathGeometryCombine(
&matrix,
&data1.Matrix,
data1.FillRule,
pPathData1,
data1.Size,
&data2.Matrix,
data2.FillRule,
pPathData2,
data2.Size,
tolerance,
type == ToleranceType.Relative,
new AddFigureToListDelegate(list.AddFigureToList),
mode,
out fillRule);
if (hr == (int)MILErrors.WGXERR_BADNUMBER)
{
// When we encounter NaNs in the renderer, we absorb the error and draw
// nothing. To be consistent, we return an empty geometry.
resultGeometry = new PathGeometry();
}
else
{
HRESULT.Check(hr);
resultGeometry = new PathGeometry(list.Figures, fillRule, null);
}
}
}
}
return resultGeometry;
}