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.

ID2D1EffectImpl::Initialize method

The effect can use this method to do one time initialization tasks. If this method is not needed, the method can just return S_OK.

Syntax


HRESULT Initialize(
  [in] ID2D1EffectContext  *effectContext,
  [in] ID2D1TransformGraph *transformGraph
);

Parameters

effectContext [in]

Type: ID2D1EffectContext*

An internal context interface that creates and returns effect author–centric types.

transformGraph [in]

Type: ID2D1TransformGraph*

The effect can populate the transform graph with a topology and can update it later.

Return value

Type: HRESULT

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Remarks

This moves resource creation cost to the CreateEffect call, rather than during rendering.

If the implementation fails this call, the corresponding ID2D1DeviceContext::CreateEffect call also fails.

The following example shows an effect implementing an initialize method.

Examples

The example here shows an effect implementing an initialize method.


class CEffectImplementation : public ID2D1EffectImpl
{
public:

    virtual ~CEffectImplementation()
    {
        if (_pContextInternal != NULL)
        {
            _pContextInternal->Release();
        }
    }

    IFACEMETHODIMP Initialize(__in ID2D1DeviceContextInternal *pContextInternal, __in ID2D1TransformGraph *pTransformGraph)
    {
        HRESULT hr = S_OK;

        _pContextInternal = pContextInternal;
        _pContextInternal->AddRef();

								_pTransformGraph = pTransformGraph;
        _pTransformGraph>AddRef();

								// Populate the transform graph.					    

        return S_OK;
    }

private:

    ID2D1EffectContext *_pContextInternal;
    ID2D1TransformGraph *_pTransformGraph;
};


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

D2D1EffectAuthor.h

Library

D2D1.lib

See also

ID2D1EffectImpl
ID2D1DeviceContext

 

 

Show:
© 2017 Microsoft