Direct2D
Encyclopedia
Direct2D is a 2D
and vector
graphics application programming interface
(API) designed by Microsoft
and implemented in Windows 7 and Windows Server 2008 R2
, and also Windows Vista
and Windows Server 2008 (with Platform Update installed) and Platform Update Supplement for Windows Vista and for Windows Server 2008(KB2117917) & KB2505189 update installed.
Microsoft has fixed many Direct2D bugs in Windows 7 through Windows 7 Service Pack 1(SP1) and KB2505438 update.
Direct2D offers high quality and fast performance while maintaining interoperability with GDI
/GDI+ APIs and Direct3D
/DirectDraw APIs. It can take advantage of hardware acceleration through compatible graphics cards
.
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 Feature 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 supports high-quality rendering with the following features:
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.
and Mozilla Firefox
7 use Direct2D and DirectWrite
for improved performance and visual quality.
2D computer graphics
2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models and by techniques specific to them...
and vector
Vector graphics
Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygon, which are all based on mathematical expressions, to represent images in computer graphics...
graphics application programming interface
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...
(API) designed by Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
and implemented in Windows 7 and Windows Server 2008 R2
Windows Server 2008 R2
Windows Server 2008 R2 is a server operating system produced by Microsoft. It was released to manufacturing on July 22, 2009 and launched on October 22, 2009. According to the Windows Server Team blog, the retail availability was September 14, 2009. It is built on Windows NT 6.1, the same core...
, and also Windows Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...
and Windows Server 2008 (with Platform Update installed) and Platform Update Supplement for Windows Vista and for Windows Server 2008(KB2117917) & KB2505189 update installed.
Microsoft has fixed many Direct2D bugs in Windows 7 through Windows 7 Service Pack 1(SP1) and KB2505438 update.
Direct2D offers high quality and fast performance while maintaining interoperability with GDI
Graphics Device Interface
The Graphics Device Interface is a Microsoft Windows application programming interface and core operating system component responsible for representing graphical objects and transmitting them to output devices such as monitors and printers....
/GDI+ APIs and Direct3D
Direct3D
Direct3D is part of Microsoft's DirectX application programming interface . Direct3D is available for Microsoft Windows operating systems , and for other platforms through the open source software Wine. It is the base for the graphics API on the Xbox and Xbox 360 console systems...
/DirectDraw APIs. It can take advantage of hardware acceleration through compatible graphics cards
Video card
A video card, Graphics Card, or Graphics adapter is an expansion card which generates output images to a display. Most video cards offer various functions such as accelerated rendering of 3D scenes and 2D graphics, MPEG-2/MPEG-4 decoding, TV output, or the ability to connect multiple monitors...
.
Overview
Direct2D is a native code API based on C++C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
that can be called by managed code
Managed code
Managed code is a term coined by Microsoft to identify computer program code that requires and will only execute under the "management" of a Common Language Runtime virtual machine ....
and uses a "lightweight COM
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...
" approach just like Direct3D
Direct3D
Direct3D is part of Microsoft's DirectX application programming interface . Direct3D is available for Microsoft Windows operating systems , and for other platforms through the open source software Wine. It is the base for the graphics API on the Xbox and Xbox 360 console systems...
, with minimal amount of abstraction. However, unlike WPF
Windows Presentation Foundation
Developed by Microsoft, the Windows Presentation Foundation is a computer-software graphical subsystem for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0. Rather than relying on the older GDI...
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 Feature Level 9 with WDDM 1.1 drivers, falling back to software rendering using WARP10
Windows Advanced Rasterization Platform
The Windows Advanced Rasterization Platform is a software rasterizer device that is a component of Windows Graphics runtime in Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 ....
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 supports high-quality rendering with the following features:
- ClearTypeClearTypeClearType is a trademark for Microsoft's implementation of subpixel rendering technology. ClearType attempts to improve the appearance of text on certain types of computer display screens by sacrificing color fidelity for additional intensity variation. This trade-off is asserted to work well on...
text rendering (provided by DirectWriteDirectWriteDirectWrite is a text-layout and glyph-rendering API by Microsoft. It was designed to replace GDI/GDI+ and Uniscribe for screen-oriented rendering and was shipped with Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 DirectWrite is a text-layout and...
) - 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
DirectWrite
DirectWrite is a text-layout and glyph-rendering API by Microsoft. It was designed to replace GDI/GDI+ and Uniscribe for screen-oriented rendering and was shipped with Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 DirectWrite is a text-layout and...
, Windows Imaging Component
Windows Imaging Component
The Windows Imaging Component is a Component Object Model based imaging codec framework introduced in Windows Vista and Windows XP Service Pack 3 for working with and processing digital images and image metadata...
, 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.
Implementations
Internet Explorer 9Internet Explorer 9
Windows Internet Explorer 9 is the current version of the Internet Explorer web browser from Microsoft. It was released to the public on March 14, 2011 at 21:00 PDT. Internet Explorer 9 supports several CSS 3 properties, embedded ICC v2 or v4 color profiles support via Windows Color System, and...
and Mozilla Firefox
Mozilla Firefox
Mozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...
7 use Direct2D and DirectWrite
DirectWrite
DirectWrite is a text-layout and glyph-rendering API by Microsoft. It was designed to replace GDI/GDI+ and Uniscribe for screen-oriented rendering and was shipped with Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 DirectWrite is a text-layout and...
for improved performance and visual quality.
See also
- DirectXDirectXMicrosoft DirectX is a collection of application programming interfaces for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with Direct, such as Direct3D, DirectDraw, DirectMusic, DirectPlay,...
- DirectWriteDirectWriteDirectWrite is a text-layout and glyph-rendering API by Microsoft. It was designed to replace GDI/GDI+ and Uniscribe for screen-oriented rendering and was shipped with Windows 7 and Windows Server 2008 R2, as well as Windows Vista and Windows Server 2008 DirectWrite is a text-layout and...
- Direct3DDirect3DDirect3D is part of Microsoft's DirectX application programming interface . Direct3D is available for Microsoft Windows operating systems , and for other platforms through the open source software Wine. It is the base for the graphics API on the Xbox and Xbox 360 console systems...
- GDIGraphics Device InterfaceThe Graphics Device Interface is a Microsoft Windows application programming interface and core operating system component responsible for representing graphical objects and transmitting them to output devices such as monitors and printers....
- GDI+
External links
- Blog of Direct2D Lead Developer Thomas Olsen
- Blog of Direct2D Developer Tom Mulcahy
- Direct2D White Papers
- 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