ID2D1Factory::CreateGeometryGroup method

Creates an ID2D1GeometryGroup, which is an object that holds other geometries.

Syntax


virtual HRESULT CreateGeometryGroup(
  D2D1_FILL_MODE fillMode,
  [in]   ID2D1Geometry **geometries,
  UINT geometriesCount,
  [out]  ID2D1GeometryGroup **geometryGroup
) = 0;

Parameters

fillMode

Type: D2D1_FILL_MODE

A value that specifies the rule that a composite shape uses to determine whether a given point is part of the geometry.

geometries [in]

Type: ID2D1Geometry**

An array containing the geometry objects to add to the geometry group. The number of elements in this array is indicated by the geometriesCount parameter.

geometriesCount

Type: UINT

The number of elements in geometries.

geometryGroup [out]

Type: ID2D1GeometryGroup**

When this method returns, contains the address of a pointer to the geometry group created by this method.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Geometry groups are a convenient way to group several geometries simultaneously so all figures of several distinct geometries are concatenated into one. To create a ID2D1GeometryGroup object, call the CreateGeometryGroup method on the ID2D1Factory object, 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.

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

See also

ID2D1Factory
Geometries Overview

 

 

Community Additions

ADD
Show:
© 2014 Microsoft