Export (0) Print
Expand All

ID2D1GeometryGroup interface

Represents a composite geometry, composed of other ID2D1Geometry objects.

When to implement

Custom implementations are not supported.

Members

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

Methods

The ID2D1GeometryGroup interface has these methods.

MethodDescription
GetSourceGeometries

Retrieves the geometries in the geometry group.

GetFillMode

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

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

For the complete example, see the Geometry Groups Example.

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft