World Library  
Flag as Inappropriate
Email this Article

Direct2D

Article Id: WHEBN0020869703
Reproduction Date:

Title: Direct2D  
Author: World Heritage Encyclopedia
Language: English
Subject: DirectX, .NET Framework, DirectDraw, Direct3D, Composite UI Application Block
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Direct2D

Direct2D[1] is a 2D and vector graphics application programming interface (API) designed by Microsoft and implemented in Windows 8, Windows 7 and Windows Server 2008 R2, and also Windows Vista and Windows Server 2008 (with Platform Update installed).[2]

Direct2D offers high quality and fast performance while maintaining interoperability with GDI/GDI+ APIs and Direct3D/DirectDraw APIs.[3] It can take advantage of hardware acceleration through compatible graphics cards.

Direct2D 1.1 was launched with Windows 8.[4] It was also backported to Windows 7 SP1 (but not to Windows Vista) via the Windows 7 platform update.[5][6][7] The original version of Direct2D was tied to DirectX 10, whereas Direct2D 1.1 integrates with DirectX 11.1.[5] Windows 8 also added interoperability between XAML and Direct2D (and even Direct3D) components, which can be all mixed in an application.[8] New features were added to Direct2D in Windows 8.1:[9] Geometry realizations,[10] Direct2D effects API,[11][12][13] command list API , multithreading API's, per-device rendering priority, support for JPEG YCbCr images , support for block compressed formats (DDS files). This latter version of Direct2D is tied to Direct X 11.2.[14]

Overview

Direct2D is a native code API based on C++ that can be called by managed code and uses a "lightweight COM" approach just like Direct3D, with minimal amount of abstraction. However, unlike WPF and similarly to GDI/GDI+, Direct2D is an "immediate mode" rendering API with simple BeginDraw/Draw/EndDraw calls; Direct2D has no concept of a "scene" and does not use retained tree structures, and the rendering state is preserved between drawing calls.

Direct2D can minimize CPU usage and utilise hardware rendering on a graphics card that supports Direct3D 10.1 and/or Direct3D 10 Level 9 with WDDM 1.1 drivers, falling back to software rendering using WARP10 in situations when hardware is not available, such as session 0, and for remote server-side rendering. Direct2D performance and memory usage scale linearly with primitive counts in both software and hardware.

Direct2D[15][16] supports high-quality rendering with the following features:

  • ClearType text rendering (provided by DirectWrite)
  • ClearView
  • Alpha Correction
  • Subpixel rendering
  • Grayscale text rendering
  • Grayscale anti-aliasing
  • Per primitive antialiasing
  • Draw and fill commands for geometries (lines, curves) and bitmaps
  • Solid color, linear, radial, and bitmap brushes.
  • Rendering to intermediate layers
  • Rich geometry operations (e.g. unions, intersections, widening, outlining, etc.)

Direct2D allows interoperability with GDI, GDI+, and Direct3D and permits rendering to and from a Direct3D surface, as well as to and from a GDI/GDI+ device context (HDC) with full serialization of surfaces and device contexts, which enables it to work with other native Windows technologies such as DirectWrite, Windows Imaging Component, etc. Such interoperability allows developers to gradually replace critical code paths with Direct2D code without the need to overhaul their entire source code.

Direct2D uses a device-independent coordinate system, which allows automatic GUI scaling for different DPI settings that depend on various display resolutions and monitor sizes.

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."[17]

In July 2012, the Windows 8 team posted the following on the blog of Steven Sinofsky: "To improve geometry rendering performance in Windows 8, we focused on reducing the CPU cost associated with tessellation in two ways. First, we optimized our implementation of tessellation when rendering simple geometries like rectangles, lines, rounded rectangles, and ellipses."[18] These common-case optimizations claimed to improve performance in the range of 184% to 438%, depending on the primitive. The post continued: "Second, to improve performance when rendering irregular geometry (e.g. geographical borders on a map), we use a new graphics hardware feature called Target Independent Rasterization, or TIR. TIR enables Direct2D to spend fewer CPU cycles on tessellation, so it can give drawing instructions to the GPU more quickly and efficiently, without sacrificing visual quality. TIR is available in new GPU hardware designed for Windows 8 that supports DirectX 11.1."[18] This was followed by a benchmark using some 15 SVGs, claiming performance improvements in the range of 151% to 523%. The section concluded: "We worked closely with our graphics hardware partners to design TIR. Dramatic improvements were made possible because of that partnership. DirectX 11.1 hardware is already on the market today and we’re working with our partners to make sure more TIR-capable products will be broadly available."[18]

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.[19] In response to customer demands, an Nvidia support staffer posted that TIR cannot be simply implemented at the driver level, but requires new hardware;[20][21] the Maxwell 2 architecture, introduced in September 2014, is such hardware.[22]

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.[23]

Uses and performance

Internet Explorer 9 and later versions use Direct2D and DirectWrite for improved performance and visual quality.[24][25][26] Direct2D support was added in the alpha version of Firefox 3.7, roughly doubling its rendering speed.[27] (Firefox 4 also added DirectWrite support, but this was made non-default for some fonts in Firefox 7 due to user complaints about the rendering quality.[28] Google Chrome uses its own 2D library called Skia, which in turn renders through ANGLE on Windows.[29])

Ars Technica's Peter Bright noted in the summer of 2012 that "most desktop applications don't use Direct2D."[30]

Microsoft Office 2013 supports either Direct2D+DirectWrite or GDI+Uniscribe for display rendering and typography.[31]

See also

References

  1. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/dd370990(v=vs.85).aspx
  2. ^ "Updated Direct2D in March DirectX SDK - Tom's Blog - Site Home - TechNet Blogs". blogs.technet.com. 2009-03-24. Retrieved 2011-12-26. 
  3. ^ "Direct2D".  
  4. ^ http://msdn.microsoft.com/en-us/library/windows/hardware/dn653328(v=vs.85).aspx#tir
  5. ^ a b "Windows with C++ - Introducing Direct2D 1.1". Msdn.microsoft.com. 2014-05-02. Retrieved 2014-08-09. 
  6. ^ "Platform Update for Windows 7 (Windows)". Msdn.microsoft.com. Retrieved 2014-08-09. 
  7. ^ Pooya Eimandar (2013). DirectX 11.1 Game Programming. Packt Publishing Ltd. p. 45.  
  8. ^ http://blogs.msdn.com/b/windowsappdev/archive/2012/03/15/combining-xaml-and-directx.aspx
  9. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/hh802478(v=vs.85).aspx
  10. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/dn363632(v=vs.85).aspx
  11. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/hh973240(v=vs.85).aspx
  12. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/hh706316(v=vs.85).aspx
  13. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/hh973241(v=vs.85).aspx
  14. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/dn363632(v=vs.85).aspx
  15. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/ff729481(v=vs.85).aspx
  16. ^ http://msdn.microsoft.com/en-us/library/windows/desktop/dd756766(v=vs.85).aspx
  17. ^ Kilgard, Mark J. (2012). "GPU-accelerated path rendering". ACM Transactions on Graphics 31 (6): 1.  
  18. ^ 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
  19. ^ "War of Words Between NVIDIA and AMD Over DirectX 11.1 Support Continues". Hardware Canucks. 2012-12-17. Retrieved 2014-08-09. 
  20. ^ https://forums.geforce.com/default/topic/511499/geforce-drivers/give-us-dx11-1-driver-support-on-dx11-cards-no-new-hardware-is-required-for-dx11-1/post/3642626/#3642626
  21. ^ http://nvidia.custhelp.com/app/answers/detail/a_id/3196/~/fermi-and-kepler-directx-api-support
  22. ^ http://www.anandtech.com/show/8526/nvidia-geforce-gtx-980-review/4
  23. ^ http://channel9.msdn.com/Events/Build/2013/3-191 19:00 to 20:00 and 55:00 to 56:30
  24. ^ By 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. 
  25. ^ Shankland, Stephen (2014-03-25). "Firefox 4 beta 4 adds hardware acceleration". CNET. Retrieved 2014-08-06. 
  26. ^ Mozilla chucks Roc at Microsoft's new hardness • The Register
  27. ^ Published on 27th November 2009 by Gareth Halfacree (2009-11-27). "Firefox 3.7 gets Direct2D support". bit-tech.net. Retrieved 2014-08-09. 
  28. ^ "Graphic bits » Blog Archive » DirectWrite Text Rendering in Firefox 6". Blog.mozilla.org. 2011-08-11. Retrieved 2014-08-09. 
  29. ^ "GPU Accelerated Compositing in Chrome - The Chromium Projects". Sites.google.com. Retrieved 2014-08-06. 
  30. ^ Bright, Peter (2012-07-24). "Windows 8 GPU acceleration: good news for Metro". Ars Technica. Retrieved 2014-08-09. 
  31. ^ "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 - 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.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 



Copyright © World Library Foundation. All rights reserved. eBooks from Hawaii eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.