XMConvertFloatToHalfStream
XMConvertHalfToFloatStream
XMMatrixDecompose
XMPlaneTransformStream
XMVector2TransformCoordStream
XMVector2TransformNormalStream
XMVector2TransformStream
XMVector3ProjectStream
XMVector3TransformCoordStream
XMVector3TransformNormalStream
XMVector3TransformStream
XMVector3UnprojectStream
XMVector4TransformStream
Expand Minimize

LayerParameters function

Creates a D2D1_LAYER_PARAMETERS structure.

Syntax


D2D1_LAYER_PARAMETERS LayerParameters(
  _In_      const D2D1_RECT_F &contentBounds = D2D1::InfiniteRect(),
  _In_opt_  ID2D1Geometry *geometricMask = NULL,
  D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
  D2D1_MATRIX_3X2_F maskTransform = D2D1::IdentityMatrix(),
  FLOAT opacity = 1.0,
  ID2D1Brush *opacityBrush = NULL,
  D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE
);

Parameters

contentBounds [in, ref]

Type: const D2D1_RECT_F

The content bounds of the layer. Content outside these bounds is not guaranteed to render. The default value is D2D1::InfiniteRect.

geometricMask [in, optional]

Type: ID2D1Geometry*

A mask that specifies the area of the layer that is composited into the render target, or NULL. The default value is NULL.

maskAntialiasMode

Type: D2D1_ANTIALIAS_MODE

A value that specifies the antialiasing mode for the geometric mask. The default value is D2D1_ANTIALIAS_MODE_PER_PRIMITIVE.

maskTransform

Type: D2D1_MATRIX_3X2_F

A value that specifies the transform that is applied to the geometric mask when composing the layer. The default value is D2D1::IdentityMatrix.

opacity

Type: FLOAT

An opacity that is applied uniformly to all resources in the layer when compositing to the target. The default value is 1.0.

opacityBrush

Type: ID2D1Brush*

A brush that is used to alter the opacity of the layer. The brush is mapped to the layer, and the alpha channel of each mapped brush pixel is multiplied by the corresponding layer pixel. The default value is NULL.

layerOptions

Type: D2D1_LAYER_OPTIONS

A value that specifies whether the layer intends to render text with ClearType antialiasing. The default value is D2D1_LAYER_OPTIONS_NONE.

Return value

Type: D2D1_LAYER_PARAMETERS

A structure that contains the content bounds, mask information, opacity settings, and other options for a layer resource.

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

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]

Header

D2d1helper.h

Library

D2d1.lib

DLL

D2d1.dll

See also

Layers Overview
D2D1_LAYER_OPTIONS
D2D1_LAYER_PARAMETERS
ID2D1Brush
D2D1_ANTIALIAS_MODE

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.