APIs
- Graphics Device Interface (GDI) is the original graphics interface for 16-bit Windows.
- GDI can only produce aliased graphics.
- GDI+ was introduced in Windows XP as a successor to GDI.
- GDI+ can render anti-aliased graphics, but only in software.
- Direct2D is the successor to both GDI and GDI+.
- DirectWrite is a text layout and rasterization engine.
Overview
- Lightweight COM library
- Built on top of Direct3D
- Support for hardware acceleration on the GPU
- Immediate rendering
- Support for SVG vector graphics that can be scaled to arbitrary dimensions
- Can be used with Direct3D, DirectWrite, Windows Imaging Component (WIC), and XAML
- Win2D is a WinRT wrapper of Direct2D and DirectWrite
<aside>
📜 The latest revision is Direct2D 1.3, released in 2015.
</aside>
<aside>
📜 Direct2D was originally built using Direct3D 10.1.
Direct2D 1.3 is using Direct3D 11.1.
</aside>
<aside>
💡 Direct2D uses a left-handed coordinate system: positive x-axis values proceed to the right and positive y-axis values proceed downward.
</aside>
Device
A device is an abstraction that represents a hardware device that uses the GPU.
Factory
To use Direct2D, you need to create a factory represented by the ID2D1Factory
interface.