ID2D1RenderTarget::CreateLayer(D2D1_SIZE_F,ID2D1Layer**) method (d2d1.h)

Creates a layer resource that can be used with this render target and its compatible render targets. The new layer has the specified initial size.

Syntax

HRESULT CreateLayer(
  D2D1_SIZE_F size,
  ID2D1Layer  **layer
);

Parameters

size

Type: [in] D2D1_SIZE_F

If (0, 0) is specified, no backing store is created behind the layer resource. The layer resource is allocated to the minimum size when PushLayer is called.

layer

Type: [out] ID2D1Layer**

When the method returns, contains a pointer to a pointer to the new layer. This parameter is passed uninitialized.

Return value

Type: HRESULT

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

Remarks

Regardless of whether a size is initially specified, the layer automatically resizes as needed.

Examples

For an example on how to use CreateLayer, see the How to Clip a Region with a Layer topic.

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
Library D2d1.lib
DLL D2d1.dll

See also

ID2D1RenderTarget

Layers Overview