Direct2D
Direct2D
Direct2D takes advantage of hardware acceleration via the graphics processing unit (
Overview
Direct2D is a
Direct2D can minimize CPU usage and utilize hardware rendering on a graphics card with minimum support of Direct3D Feature Level 9 with
Direct2D[6][7] supports high-quality rendering with the following key features:
- High-quality subpixel text rendering via DirectWrite for both grayscale and ClearType technique
- Per-primitive antialiasing
- Bézier geometry draw and fill
- Rich geometry operations (e.g. Boolean operations, path widening, outlining, etc.)
- Composite layers
- Primitive blend modes (e.g. source-over, source-copy, min blends, etc.)
- Image built-in and custom effects for photo adjustment, graphical and color transform
- Gradient brush and mesh
- Command list for command buffering and printing
- Scalable ink stroke
- Sprite batch for game development
Direct2D allows full interoperability with GDI, GDI+, and permits rendering to and from a Direct3D surface, as well as to and from a GDI/GDI+ device context (HDC). It can be used effectively together with Windows Imaging Component (WIC) for image encoding/decoding, and with DirectWrite for text formatting and font processing. Such interoperability allows developers to gradually replace critical code paths with Direct2D code without the need to overhaul their entire source code. In Windows 10 timeframe, an Open Source project called Win2D was developed by Microsoft to further simplify the usage of Direct2D and DirectWrite in Universal Windows Platform (UWP) application. Win2D is a highly-efficient WinRT wrapper of Direct2D and DirectWrite designed from the ground up to integrate seamlessly with XAML Canvas control while preserving the power of the underlying graphics subsystem.
Subsequent versions
Direct2D 1.1
An updated version of Direct2D was launched with
Direct2D 1.2
New features were added to Direct2D with Windows 8.1 in October 2013:[13] Geometry realizations,[14] Direct2D effects API,[15][16][17] command list API, multithreading APIs, per-device rendering priority, support for JPEG YCbCr images for smaller memory footprint, and support for block compressed formats (DDS files).
Direct2D 1.3
The release of
Implementation
In their 2012 paper on the competing NV path rendering OpenGL extension, Mark Kilgard and Jeff Bolz explain (and criticize) the internals of Direct2D as follows: "Direct2D operates by transforming paths on the CPU and then performing a constrained trapezoidal tessellation of each path. The result is a set of pixel-space trapezoids and additional shaded geometry to compute fractional coverage for the left and right edges of the trapezoids. These trapezoids and shaded geometry are then rasterized by the GPU. The resulting performance is generally better than entirely CPU-based approaches and requires no ancillary storage for multisample or stencil state; Direct2D renders directly into an aliased framebuffer with properly antialiased results. Direct2D’s primary disadvantage is [that] the ultimate performance is determined not by the GPU (doing fairly trivial rasterization) but rather by the CPU performing the transformation and trapezoidal tessellation of each path and Direct3D validation work."[18]
In July 2012, the
The TIR feature was among those that caused a "war of words" between Nvidia and AMD around December 2012, because Nvidia's Kepler GPU family does not support it, whereas AMD's GCN does.[20] In response to customer demands, an Nvidia support staffer posted that TIR cannot be simply implemented at the driver level, but requires new hardware;[21][22] the Maxwell 2 architecture, introduced in September 2014, is such hardware.[23]
In Windows 8.1, Direct2D can use the Direct3D11 hardware tesselators, but only in conjunction with D2D1_FILL_MODE_ALTERNATE
. If another fill mode is used (e.g. D2D1_FILL_MODE_WINDING
) then Direct2D falls back to tessellation on the CPU, but still uses TIR for anti-aliasing (if TIR is available). Since hardware tessellation is available in base Direct3D11 (not necessarily 11.1), Microsoft claimed significant performance improvements with Direct2D in Windows 8.1 (vs. Windows 8) on non-TIR hardware.[24]
Uses and performance
Ars Technica's Peter Bright noted in the summer of 2012 that "most desktop applications don't use Direct2D."[32]
Microsoft Office 2013 supports either Direct2D+DirectWrite or GDI+Uniscribe for display rendering and typography.[33]
See also
- DirectX
- Direct3D
- Cairo – a cross platform vector graphics library
- OpenVG
- Simple and Fast Multimedia Library
- Starling Framework
- Quartz 2D
References
- ^ "Direct2D - Win32 apps".
- ^ "What's New in Direct2D and DirectWrite for Windows 10 (Channel 9)". Channel 9. Retrieved 2015-12-03.
- ^ "Updated Direct2D in March DirectX SDK - Tom's Blog - Site Home - TechNet Blogs". blogs.technet.com. 2009-03-24. Archived from the original on 2009-03-28. Retrieved 2011-12-26.
- MSDN. Retrieved 2011-12-26.
- ^ ".net - What exactly is "lightweight COM"?". Stack Overflow.
- ^ "Text Rendering with Direct2D and DirectWrite - Win32 apps".
- ^ "Supported Pixel Formats and Alpha Modes - Win32 apps".
- ^ "DirectX feature improvements in Windows 8 - Windows drivers".
- ^ a b "Windows with C++ - Introducing Direct2D 1.1". Msdn.microsoft.com. 2014-05-02. Retrieved 2014-08-09.
- ^ "Platform Update for Windows 7 (Windows)". Msdn.microsoft.com. Retrieved 2014-08-09.
- ISBN 978-1-84969-481-0.
- ^ "DevBlogs".
- ^ "What's new in Direct2D - Win32 apps".
- ^ "Geometry Realizations Overview - Win32 apps".
- ^ "Effects (Direct2D) - Win32 apps".
- ^ "Built-in Effects - Win32 apps".
- ^ "How to Apply Effects to Primitives - Win32 apps".
- S2CID 12967014.
- ^ a b c Rob Copeland, with contributions from Sriram Subramanian, Dan McLachlan, Kam VedBrat, Steve Lim, and Jianye Lu, and introduction by Steven Sinofsky Hardware accelerating everything: Windows 8 graphics
- ^ "War of Words Between NVIDIA and AMD Over DirectX 11.1 Support Continues". Hardware Canucks. 2012-12-17. Retrieved 2014-08-09.
- ^ "Give us DX11.1 driver support on DX11 cards. no new hardware is required for dx11.1". NVIDIA.
- ^ "Fermi and Kepler DirectX API Support | NVIDIA". nvidia.custhelp.com.
- ^ Smith, Ryan. "The NVIDIA GeForce GTX 980 Review: Maxwell Mark 2". www.anandtech.com.
- ^ http://channel9.msdn.com/Events/Build/2013/3-191 19:00 to 20:00 and 55:00 to 56:30
- ^ tim, on August 11th, 2010 Follow tim on Twitter (2010-08-11). "Firefox 4 as Psychedelic as IE9 with Direct2D enabled « Tim Anderson's ITWriting". Itwriting.com. Retrieved 2014-08-06.
{{cite web}}
:|author=
has generic name (help)CS1 maint: multiple names: authors list (link) CS1 maint: numeric names: authors list (link) - ^ Shankland, Stephen (2014-03-25). "Firefox 4 beta 4 adds hardware acceleration". CNET. Retrieved 2014-08-06.
- ^ "Mozilla chucks Roc at Microsoft's new hardness • The Register". www.theregister.com.
- ^ Published on 27th November 2009 by Gareth Halfacree (2009-11-27). "Firefox 3.7 gets Direct2D support". bit-tech.net. Retrieved 2014-08-09.
{{cite web}}
: CS1 maint: numeric names: authors list (link) - ^ "Graphic bits » Blog Archive » DirectWrite Text Rendering in Firefox 6". Blog.mozilla.org. 2011-08-11. Archived from the original on 2014-08-10. Retrieved 2014-08-09.
- ^ "GPU Accelerated Compositing in Chrome - The Chromium Projects". Retrieved 2014-08-06.
- ^ Buckler, Craig (2011-12-20). "How to Enable WebGL for Blocked Graphics Cards in Firefox". Retrieved 2019-10-21.
- ^ Bright, Peter (2012-07-24). "Windows 8 GPU acceleration: good news for Metro". Ars Technica. Retrieved 2014-08-09.
- ^ "Office Adopts New Windows Display Technology - Murray Sargent: Math in Office - Site Home - MSDN Blogs". Blogs.msdn.com. 2012-07-29. Retrieved 2014-08-09.
External links
- Main Direct2D page at MSDN with links to the programming guide, new features in Windows 8.1, interoperability with Direct3D, etc.
- Blog of Direct2D Lead Developer Thomas Olsen
- Blog of Direct2D Developer Tom Mulcahy
- Windows 7: Introducing Direct2D and DirectWrite - PDC 2008 video
- Windows API Code Pack for Microsoft .NET Framework - allows developing Direct2D apps in managed code
- Introducing Direct2D - June 2009 issue of MSDN Magazine
- Drawing with Direct2D - September 2009 issue of MSDN Magazine
- Direct2D API for Microsoft .Net Framework 4 Archived 2011-07-08 at the Wayback Machine - Direct2D API for Microsoft .Net Framework 4
- USPTO application for target independent rasterization
- Direct2D 1.1 Migration Guide for Windows 7 Developers
- Charles Petzold's column on DirectX has several articles on Direct2D ranging from introductory ones like Triangles and Tessellation or Direct2D Geometries and Their Manipulations to more advanced ones like Finger Painting with Direct2D Geometries, A 2D Portal into a 3D World, etc.