Export (0) Print
Expand All
Expand Minimize

D2D1_LAYER_PARAMETERS structure

Contains the content bounds, mask information, opacity settings, and other options for a layer resource.

Syntax


struct D2D1_LAYER_PARAMETERS {
  D2D1_RECT_F         contentBounds;
  ID2D1Geometry       *geometricMask;
  D2D1_ANTIALIAS_MODE maskAntialiasMode;
  D2D1_MATRIX_3X2_F   maskTransform;
  FLOAT               opacity;
  ID2D1Brush          *opacityBrush;
  D2D1_LAYER_OPTIONS  layerOptions;
};

Members

contentBounds

Type: D2D1_RECT_F

The content bounds of the layer. Content outside these bounds is not guaranteed to render.

geometricMask

Type: ID2D1Geometry*

The geometric mask specifies the area of the layer that is composited into the render target.

maskAntialiasMode

Type: D2D1_ANTIALIAS_MODE

A value that specifies the antialiasing mode for the geometricMask.

maskTransform

Type: D2D1_MATRIX_3X2_F

A value that specifies the transform that is applied to the geometric mask when composing the layer.

opacity

Type: FLOAT

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

opacityBrush

Type: ID2D1Brush*

A brush that is used to modify the opacity of the layer. The brush is mapped to the layer, and the alpha channel of each mapped brush pixel is multiplied against the corresponding layer pixel.

layerOptions

Type: D2D1_LAYER_OPTIONS

A value that specifies whether the layer intends to render text with ClearType antialiasing.

Examples

The following example shows how to use CreateLayer, PushLayer, and PopLayer. All fields in the D2D1_LAYER_PARAMETERS structure set to defaults, except opacityBrush, which is set to an ID2D1RadialGradientBrush.


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

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

    // Push the layer with the content bounds.
    pRT->PushLayer(
        D2D1::LayerParameters(
            D2D1::InfiniteRect(),
            NULL,
            D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
            D2D1::IdentityMatrix(),
            1.0,
            m_pRadialGradientBrush,
            D2D1_LAYER_OPTIONS_NONE),
        pLayer
        );

    pRT->DrawBitmap(m_pBambooBitmap, D2D1::RectF(0, 0, 190, 127));

    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->PopLayer();
}
SafeRelease(&pLayer);


For additional examples, see the Layers Overview.

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

See also

Layers Overview

 

 

Community Additions

ADD
Show:
© 2014 Microsoft