Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ID2D1Factory1::CreateDrawingStateBlock method

Creates a new drawing state block, this can be used in subsequent SaveDrawingState and RestoreDrawingState operations on the render target.

Syntax


HRESULT CreateDrawingStateBlock(
  [in, ref, optional] const D2D1_DRAWING_STATE_DESCRIPTION1 &drawingStateDescription,
  [out]                     ID2D1DrawingStateBlock1         **drawingStateBlock
);

Parameters

drawingStateDescription [in, ref, optional]

Type: const D2D1_DRAWING_STATE_DESCRIPTION1

The drawing state description structure.

drawingStateBlock [out]

Type: ID2D1DrawingStateBlock1**

The address of the newly created drawing state block.

Return value

Type: HRESULT

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

HRESULTDescription
S_OKNo error occurred.
E_OUTOFMEMORYDirect2D could not allocate sufficient memory to complete the call.
E_INVALIDARGAn invalid value was passed to the method.

 

Examples

Here is an example of creating a ID2D1DrawingStateBlock1 with the primitive blend mode set to D2D1_PRIMITIVE_BLEND_SOURCE_COPY.


   { 
        ID2D1DrawingStateBlock1 *pDrawingStateBlock = NULL;

        IFR(pD2DDeviceContext->CreateDrawingStateBlock(
            NULL,
            NULL,
            &pDrawingStateBlock
            ));
    }

    {
        ID2D1DrawingStateBlock1 *pDrawingStateBlock = NULL;
        D2D1_DRAWING_STATE_DESCRIPTION desc = D2D1::DrawingStateDescription1();

        desc.primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_COPY;

        IFR(pD2DDeviceContext->CreateDrawingStateBlock(
            &desc,
            NULL,
            &pDrawingStateBlock
            ));
    }


Requirements

Minimum supported client

Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1_1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1Factory1

 

 

Show:
© 2017 Microsoft