Export (0) Print
Expand All

ID2D1Mesh interface

Represents a set of vertices that form a list of triangles.

When to implement

Custom implementations are not supported.

Members

The ID2D1Mesh interface inherits from ID2D1Resource. ID2D1Mesh also has these types of members:

Methods

The ID2D1Mesh interface has these methods.

MethodDescription
Open

Opens the mesh for population.

 

Remarks

Creating ID2D1Mesh Objects

To create a mesh, call the ID2D1RenderTarget::CreateMesh method on the render target with which the mesh will be used. A mesh can only be used with the render target that created it and the render target's compatible targets.

A mesh is a device-dependent resource: your application should create meshes after it initializes the render target with which the meshes will be used, and recreate the meshes whenever the render target needs recreated. (For more information about resources, see Resources Overview.)

Examples

The following code example shows how to use ID2D1Mesh to represent a set of vertices that form a list of triangles.


 ID2D1GeometrySink *pGeometrySink = NULL;
 hr = pPathGeometry->Open(&pGeometrySink);
 if (SUCCEEDED(hr))
 {
     hr = pGeometry->Widen(
             strokeWidth,
             pIStrokeStyle,
             pWorldTransform,
             pGeometrySink
             );

     if (SUCCEEDED(hr))
     {
         hr = pGeometrySink->Close();
         if (SUCCEEDED(hr))
         {
             ID2D1Mesh *pMesh = NULL;
             hr = m_pRT->CreateMesh(&pMesh);
             if (SUCCEEDED(hr))
             {
                 ID2D1TessellationSink *pSink = NULL;
                 hr = pMesh->Open(&pSink);
                 if (SUCCEEDED(hr))
                 {
                     hr = pPathGeometry->Tessellate(
                             NULL, // world transform (already handled in Widen)
                             pSink
                             );
                     if (SUCCEEDED(hr))
                     {
                         hr = pSink->Close();
                         if (SUCCEEDED(hr))
                         {
                             SafeReplace(&m_pStrokeMesh, pMesh);
                         }
                     }
                     pSink->Release();
                 }
                 pMesh->Release();
             }
         }
     }
     pGeometrySink->Release();
 }
 pPathGeometry->Release();


For the complete example, see the Geometry Realization Sample.

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