Skip to content

Latest commit

 

History

History
119 lines (86 loc) · 4.18 KB

nf-d2d1-id2d1rendertarget-poplayer.md

File metadata and controls

119 lines (86 loc) · 4.18 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:d2d1.ID2D1RenderTarget.PopLayer
ID2D1RenderTarget::PopLayer (d2d1.h)
Stops redirecting drawing operations to the layer that is specified by the last PushLayer call.
ID2D1RenderTarget interface [Direct2D]
PopLayer method
ID2D1RenderTarget.PopLayer
ID2D1RenderTarget::PopLayer
PopLayer
PopLayer method [Direct2D]
PopLayer method [Direct2D]
ID2D1RenderTarget interface
d2d1/ID2D1RenderTarget::PopLayer
direct2d.ID2D1RenderTarget_PopLayer
direct2d\ID2D1RenderTarget_PopLayer.htm
Direct2D
6ab05160-4f42-477f-a5bf-f16863b0635c
12/05/2018
ID2D1RenderTarget interface [Direct2D],PopLayer method, ID2D1RenderTarget.PopLayer, ID2D1RenderTarget::PopLayer, PopLayer, PopLayer method [Direct2D], PopLayer method [Direct2D],ID2D1RenderTarget interface, d2d1/ID2D1RenderTarget::PopLayer, direct2d.ID2D1RenderTarget_PopLayer
d2d1.h
Windows
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps \| UWP apps]
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps \| UWP apps]
D2d1.lib
D2d1.dll
Windows
19H1
ID2D1RenderTarget::PopLayer
d2d1/ID2D1RenderTarget::PopLayer
c++
APIRef
kbSyntax
COM
D2d1.dll
ID2D1RenderTarget.PopLayer

ID2D1RenderTarget::PopLayer

-description

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

-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;
}

-see-also

ID2D1RenderTarget

Layers Overview

PushLayer