ID2D1GeometryGroup interface (d2d1.h)

Represents a composite geometry, composed of other ID2D1Geometry objects.

Inheritance

The ID2D1GeometryGroup interface inherits from ID2D1Geometry. ID2D1GeometryGroup also has these types of members:

Methods

The ID2D1GeometryGroup interface has these methods.

 
ID2D1GeometryGroup::GetFillMode

Indicates how the intersecting areas of the geometries contained in this geometry group are combined.
ID2D1GeometryGroup::GetSourceGeometries

Retrieves the geometries in the geometry group.
ID2D1GeometryGroup::GetSourceGeometryCount

Indicates the number of geometry objects in the geometry group.

Remarks

Geometry groups are a convenient way to group several geometries simultaneously so all figures of several distinct geometries are concatenated into one.

Creating ID2D1GeometryGroup Objects

To create a ID2D1GeometryGroup object, call the ID2D1Factory::CreateGeometryGroup method, passing in the fillMode with possible values of D2D1_FILL_MODE_ALTERNATE (alternate) and D2D1_FILL_MODE_WINDING, an array of geometry objects to add to the geometry group, and the number of elements in this array.

Direct2D geometries are immutable and device-independent resources created by ID2D1Factory. In general, you should create geometries once and retain them for the life of the application, or until they need to be modified. For more information about device-independent and device-dependent resources, see the Resources Overview.

Examples

The following code example first declares an array of geometry objects. These objects are four concentric circles that have the following radii: 25, 50, 75, and 100. Then call the CreateGeometryGroup on the ID2D1Factory object, passing in D2D1_FILL_MODE_ALTERNATE, an array of geometry objects to add to the geometry group, and the number of elements in this array.

ID2D1Geometry *ppGeometries[] =
{
    m_pEllipseGeometry1,
    m_pEllipseGeometry2,
    m_pEllipseGeometry3,
    m_pEllipseGeometry4
};

hr = m_pD2DFactory->CreateGeometryGroup(
    D2D1_FILL_MODE_ALTERNATE,
    ppGeometries,
    ARRAYSIZE(ppGeometries),
    &m_pGeoGroup_AlternateFill
    );

if (SUCCEEDED(hr))
{
    hr = m_pD2DFactory->CreateGeometryGroup(
        D2D1_FILL_MODE_WINDING,
        ppGeometries,
        ARRAYSIZE(ppGeometries),
        &m_pGeoGroup_WindingFill
        );
}

The following illustration shows the results of rendering the two group geometries from the example.

Illustration of two sets of four concentric circles, one with the second and fourth rings filled and one with all rings filled

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1.h

See also

ID2D1Geometry