Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ID2D1RenderTarget::PopLayer method (d2d1.h)

Stops redirecting drawing operations to the layer that is specified by the last PushLayer call.

Syntax

void PopLayer();

Return value

None

Remarks

A PopLayer must match a previous PushLayer call.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as PopLayer) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods.

Examples

The following example uses a layer to clip a bitmap to a geometric mask. For the complete example, see How to Clip to a Geometric Mask.

HRESULT DemoApp::RenderWithLayer(ID2D1RenderTarget *pRT)
{
 HRESULT hr = S_OK;

 // Create a layer.
 ID2D1Layer *pLayer = NULL;
 hr = pRT->CreateLayer(NULL, &pLayer);

 if (SUCCEEDED(hr))
 {
 pRT->SetTransform(D2D1::Matrix3x2F::Translation(350, 50));

 // Push the layer with the geometric mask.
 pRT->PushLayer(
 D2D1::LayerParameters(D2D1::InfiniteRect(), m_pPathGeometry),
 pLayer
 );
 
 
 pRT->DrawBitmap(m_pOrigBitmap, D2D1::RectF(0, 0, 200, 133));
 pRT->FillRectangle(D2D1::RectF(0.f, 0.f, 25.f, 25.f), m_pSolidColorBrush); 
 pRT->FillRectangle(D2D1::RectF(25.f, 25.f, 50.f, 50.f), m_pSolidColorBrush);
 pRT->FillRectangle(D2D1::RectF(50.f, 50.f, 75.f, 75.f), m_pSolidColorBrush); 
 pRT->FillRectangle(D2D1::RectF(75.f, 75.f, 100.f, 100.f), m_pSolidColorBrush); 
 pRT->FillRectangle(D2D1::RectF(100.f, 100.f, 125.f, 125.f), m_pSolidColorBrush); 
 pRT->FillRectangle(D2D1::RectF(125.f, 125.f, 150.f, 150.f), m_pSolidColorBrush); 
 

 pRT->PopLayer();
 }

 SafeRelease(&pLayer);

 return hr;
}

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

PushLayer


Feedback

Was this page helpful?

Additional resources