This documentation is archived and is not being maintained.

Geometry.Combine Method (Geometry, Geometry, GeometryCombineMode, Transform, Double, ToleranceType)

Combines the two geometries using the specified GeometryCombineMode and tolerance factor, and applies the specified transform to the resulting geometry.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

public static PathGeometry Combine(
	Geometry geometry1,
	Geometry geometry2,
	GeometryCombineMode mode,
	Transform transform,
	double tolerance,
	ToleranceType type
You cannot use methods in XAML.


Type: System.Windows.Media.Geometry

The first geometry to combine.

Type: System.Windows.Media.Geometry

The second geometry to combine.

Type: System.Windows.Media.GeometryCombineMode

One of the enumeration values that specifies how the geometries are combined.

Type: System.Windows.Media.Transform

A transformation to apply to the combined geometry, or null.

Type: System.Double

The maximum bounds on the distance between points in the polygonal approximation of the geometries. Smaller values produce more accurate results but cause slower execution. If tolerance is less than .000001, .000001 is used instead.

Type: System.Windows.Media.ToleranceType

One of the ToleranceType values that specifies whether the tolerance factor is an absolute value or relative to the area of the geometry.

Return Value

Type: System.Windows.Media.PathGeometry
The combined geometry.

Some Geometry methods (such as Combine) produce or use a polygonal approximation of the geometry. The tolerance factor specifies the maximum distance between points in this polygonal approximation. Smaller tolerance values produce better approximations, but require more processing than an approximation with a large tolerance factor.

Careful thought should be involved when using Combine to perform a union as it can be very CPU-expensive. In most cases, a GeometryGroup or AddGeometry will work better.

Use Combine only when any of the following apply:

  • The geometric operation is not a union.

  • Either of the geometries has a FillRule value of EvenOdd and the geometries are self-intersecting (i.e. the FillRule actually matters).

  • Time is not a concern, but space is (for instance, if the geometry is created once and then cached). Typically, Combine produces smaller output than AddGeometry.

  • The resulting geometry will be stroked or used in a path animation and AddGeometry does not provide the desired outline.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0