Export (0) Print
Expand All

D2D1CreateFactory<Factory>(D2D1_FACTORY_TYPE,Factory**) Function

Creates a factory object that can be used to create Direct2D resources.

template<class Factory>
HRESULT D2D1CreateFactory(
    __in D2D1_FACTORY_TYPE factoryType,
    __out Factory **factory
);

Template Parameters

ParameterDescription
FactoryThe type of ID2D1Factory to create.

 

Parameters

ParameterDescription
factoryTypeThe threading model of the factory and the resources it creates.
factoryWhen this method returns, contains the address of a pointer to the new factory.

 

Return Value

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

Examples

The following example creates a factory. For the complete code, see the Draw Rectangle Example.


HRESULT DemoApp::CreateDeviceIndependentResources()
{
    HRESULT hr = S_OK;

    // Create a Direct2D factory.
    hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDirect2dFactory);

    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]

Minimum supported phone

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

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft