แก้ไข

แชร์ผ่าน


Geometry.Combine Method

Definition

Combines two Geometry objects.

Overloads

Combine(Geometry, Geometry, GeometryCombineMode, Transform)

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

Combine(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.

Combine(Geometry, Geometry, GeometryCombineMode, Transform)

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

public:
 static System::Windows::Media::PathGeometry ^ Combine(System::Windows::Media::Geometry ^ geometry1, System::Windows::Media::Geometry ^ geometry2, System::Windows::Media::GeometryCombineMode mode, System::Windows::Media::Transform ^ transform);
public static System.Windows.Media.PathGeometry Combine (System.Windows.Media.Geometry geometry1, System.Windows.Media.Geometry geometry2, System.Windows.Media.GeometryCombineMode mode, System.Windows.Media.Transform transform);
static member Combine : System.Windows.Media.Geometry * System.Windows.Media.Geometry * System.Windows.Media.GeometryCombineMode * System.Windows.Media.Transform -> System.Windows.Media.PathGeometry
Public Shared Function Combine (geometry1 As Geometry, geometry2 As Geometry, mode As GeometryCombineMode, transform As Transform) As PathGeometry

Parameters

geometry1
Geometry

The first geometry to combine.

geometry2
Geometry

The second geometry to combine.

mode
GeometryCombineMode

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

transform
Transform

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

Returns

The combined geometry.

Remarks

This method uses the default tolerance factor (described by the StandardFlatteningTolerance property) when combining geometries. To specify your own tolerance factor, use the Combine method.

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.

Applies to

Combine(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.

public:
 static System::Windows::Media::PathGeometry ^ Combine(System::Windows::Media::Geometry ^ geometry1, System::Windows::Media::Geometry ^ geometry2, System::Windows::Media::GeometryCombineMode mode, System::Windows::Media::Transform ^ transform, double tolerance, System::Windows::Media::ToleranceType type);
public static System.Windows.Media.PathGeometry Combine (System.Windows.Media.Geometry geometry1, System.Windows.Media.Geometry geometry2, System.Windows.Media.GeometryCombineMode mode, System.Windows.Media.Transform transform, double tolerance, System.Windows.Media.ToleranceType type);
static member Combine : System.Windows.Media.Geometry * System.Windows.Media.Geometry * System.Windows.Media.GeometryCombineMode * System.Windows.Media.Transform * double * System.Windows.Media.ToleranceType -> System.Windows.Media.PathGeometry
Public Shared Function Combine (geometry1 As Geometry, geometry2 As Geometry, mode As GeometryCombineMode, transform As Transform, tolerance As Double, type As ToleranceType) As PathGeometry

Parameters

geometry1
Geometry

The first geometry to combine.

geometry2
Geometry

The second geometry to combine.

mode
GeometryCombineMode

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

transform
Transform

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

tolerance
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
ToleranceType

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

Returns

The combined geometry.

Remarks

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.

Applies to