What's new in Direct2D
Here are some of the new additions to Direct2D.
The following features and APIs were added or updated for Windows 10 Anniversary Update.
Starting in Windows 10 Anniversary Update, Direct2D now supports rendering a wider variety of color font formats, allowing developers to use more types of fonts in their Direct2D-powered apps than ever before. This includes support for:
- The ‘COLR’ OpenType table, which enables compact vector content in fonts. (Supported since Windows 8.1.)
- The ‘SVG ’ OpenType table, which enables SVG content in fonts.
- The ‘CBDT’ OpenType table, which enables color bitmap content in fonts.
- The ‘sbix’ OpenType table, which enables color bitmap content in fonts.
Direct2D supports these color font formats automatically when the D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT flag is enabled. For more information, see the following topics:
Starting in Windows 10 Anniversary Update, Direct2D includes the AlphaMask, CrossFade, Opacity, and Tint effects. This functionality was previously available from specific configurations of Composite, ArithmeticComposite, and ColorMatrix effects, but the new built-in effects make it easier to do these common operations.
The following features and APIs were added or updated for Windows 10.
Starting in Windows 10, Direct2D provides support for creating and rendering sprite batches. Compared to the general-purpose DrawImage method, sprite batches incur dramatically less per-image CPU overhead. This makes them ideal for scenarios involving hundreds or thousands of concurrent images, such as game sprites or particle systems. For more information, see the following topics:
- ID2D1DeviceContext3::CreateSpriteBatch method
- ID2D1DeviceContext3::DrawSpriteBatch methods
- ID2D1SpriteBatch interface
Starting in Windows 10, Direct2D provides a new primitive for gradient meshes. Gradient meshes are often used by professional illustrators in graphic design software, and they allow artists to render complex (even photo-realistic) multicolored shapes with all the memory and scalability benefits of vectors. For more information, see the follow topics:
- Direct2D gradient mesh sample
- D2D1_GRADIENT_MESH_PATCH structure
- ID2D1DeviceContext2::DrawGradientMesh method
Starting with Windows 10, Direct2D offers a new API for loading images, ID2D1ImageSource. The image source improves upon existing image loading APIs including CreateBitmapFromWicBitmap, the Bitmap Source effect, and the YCbCr effect. The Direct2D image source combines the capabilities of these APIs with support for arbitrarily large images, easy integration with printing and effects, and numerous optimizations including YCbCr JPEG and indexed JPEG. For more information, see these topics:
- Direct2D Photo Adjustment SDK sample
Starting in Windows 10, Direct2D provides a new primitive to represent ink strokes. Direct2D ink strokes are defined by Bezier curves, support different nib shapes and transforms, and may have fixed or variable thickness. Direct2D’s built-in support for ink strokes allows apps to easily render faster, more beautiful ink than previous approaches, which typically required apps to manage ink themselves, as a series of ellipses and quadrilaterals. For more information, see the following topics:
Direct2D effects are implemented using HLSL pixel, vertex, and/or compute shaders. Starting with Windows 10, Direct2D now automatically analyzes effect graphs for opportunities to combine and execute individual shaders together. This can provide a significant increase in effect throughput. Consumers of built-in effects do not need to do anything to benefit from effect shader linking, but developers who build their own custom effects should follow updated best practices for leveraging effect shader linking. For more information, see the following topics:
Effect shader linking is designed to not affect the visual output of effects. However, this is not always possible due to specific behavior around effect precision and numerical clipping. For more information on how to control for these behaviors, see:
Starting with Windows 10, Direct2D includes a rich set of new built-in effects which address top developer requests and enable new kinds of visual scenarios. The new effects are:
- Contrast effect
- Exposure effect
- Grayscale effect
- Highlights and shadows effect
- Invert effect
- Sepia effect
- Sharpen effect
- Straighten effect
- Temperature and tint effect
- Vignette effect
The straighten, saturation, contrast, highlights and shadows, and temperature and tint effects are demonstrated in the Direct2D Photo Adjustment SDK sample.
The following features and APIs were added or updated for Windows 8.1.
Starting with Windows 8.1, Direct2D is built on top of Direct3D 11.2.
Starting in Windows 8.1, Direct2D offers geometry realizations. Geometry realizations allow applications to improve geometry rendering performance in certain situations, without some of the drawbacks of rasterizing geometry to a bitmap. For more information, see the following topics:
Starting in Windows 8.1, Direct2D provides support for rendering image data in the JPEG Y’CbCr format. Apps can render JPEG content in its native Y’CbCr representation instead of decompressing to BGRA. This can significantly reduce graphics memory consumption and resource creation time. For more information, see the following topics:
Starting in Windows 8.1, Direct2D provides support for bitmaps that contain DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC2_UNORM, and DXGI_FORMAT_BC3_UNORM pixel data. Apps can replace their image assets with block compressed DDS images. This can significantly reduce graphics memory consumption and resource creation time. For more information, see the following topics:
Starting in Windows 8.1, Direct2D provides support for per-device rendering priority. This new feature allows apps to switch a device between normal rendering priority (the default) and low rendering priority (in which the device will not block other rendering tasks on the system). It is recommended that apps use low rendering priority for tasks that are not critical to user-responsiveness, such as pre-rendering content, rendering while minimized, and other operations that are typically performed in the background. For more information, see the following topics:
The following features and APIs were added or updated for Windows 8.
The new Direct2D interfaces are supported on Windows 7 with the Platform Update for Windows 7 installed.
Direct2D's semantics for devices and device contexts have been updated to more closely resemble the semantics used by Direct3D, and to provide concise operation on Windows Store apps. See Devices and device contexts for more info.
Selected related APIs:
The command list API allows you to share the rendering path for on screen rendering and printing. It also allows you to use primitives to create an image brush for filling primitives.
Selected related APIs:
Direct2D effects is a set of APIs, new in Windows 8, for applying high quality effects to images. It also includes APIs that allow you to make your own custom effects.
Selected related APIs:
Starting with Windows 8, Direct2D includes additional APIs for building multithreaded apps. See Multithreaded Direct2D Apps for more info.
Selected related APIs: