Does Direct2D layers, device contexts, content bounds only available within Direct2D 1.1?

thebluetropics 1,046 Reputation points
2022-09-04T00:39:46.393+00:00

I noticed in this tutorial there is ID2D1Factory1, which is strange for me as I know only ID2D1Factory, and then I realized that was Direct2D factory for version 1.1 (d2d1_1.h).

In the tutorial, I found out the CreateDevice() is only exists for ID2D1Factory1. Does features like Layers, Device Contexts, Content Bounds only exists in Direct2D version 1.1?

Also, why I need Direct3D device for creating a device-context?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,426 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,537 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 9,181 Reputation points Microsoft Vendor
    2022-09-05T02:55:25.047+00:00

    Hi

    @thebluetropics

    Accoring to the Doc: D2D1CreateDevice function

    This function will also create a new ID2D1Factory1 that can be retrieved through ID2D1Resource::GetFactory.

    As far as I'm concerned, you should create a ID2D1Device object through the ID2D1Factory1 interface. The ID2D1Factory1 interface inherits from ID2D1Factory.

    In my opinion, features like Layers, Device Contexts, Content Bounds exists in ID2D1Factory1 interface.

    According to the Doc: Direct2D quickstart for Windows 8

    After you create a factory, use it to create a Direct2D device and then use the device to create a Direct2D device context. In order to create these Direct2D objects, you must have a Direct3D 11 device , a DXGI device, and a DXGI swap chain.


0 additional answers

Sort by: Most helpful