DirectX & GDI Render Modes | VCL (2024)

  • 5 minutes to read

This topic outlines UI and content rendering techniques used in DevExpress components, usage scenarios, and limitations of all supported render modes.

Standard Rendering Technique (GDI Mode Only)

Most DevExpress controls rely on standard GDI-based rendering mechanisms available in the VCL library and use a combination of GDI (TcxCanvas) and GDI+ (TdxGPCanvas) API-based canvases to draw content and UI elements. This rendering technique is suitable for most component usage scenarios while offering more freedom for draw routine customization. For example, you can handle an OnCustomDraw~ event of a DevExpress control that uses the standard rendering technique to override or complement a predefined UI element or content draw routine.

The standard rendering technique imposes no limitations and is available for all DevExpress VCL controls under all supported operating systems. All DevExpress VCL controls use GDI as the default render mode.

Universal Rendering Technique (All Render Modes)

With the evolution of VCL components and new hardware requirements (high-DPI (4K+) displays), we created an alternative rendering mechanism based on our universal canvas class (TcxCustomCanvas) to implement new render modes in graphics-rich controls. The TcxCustomCanvas class implements a common API for image and geometric primitive rendering operations to allow supported controls to seamlessly switch between render modes.

All controls that use the universal rendering technique do not have OnCustomDraw~ events that are available in other DevExpress controls. Therefore, you can rely only on skins and public API members for appearance customization. DirectX and GDI+ render modes can help you achieve better draw operation performance compared to GDI-based render modes on high-DPI (4K+) displays when a supported control draws large amounts of images, text, and UI elements with transparency, rotation, antialiasing, and animation effects.

Controls with Support for DirectX and GDI+ Render Modes

Only the following DevExpress controls use the universal rendering technique and can switch between GDI, GDI+, and DirectX render modes:

  • The Chart control (TdxChartControl) that supports multiple series views (bar, area, line, pie, and doughnut) and allows you to display millions of data points.
  • All controls that display images and support multiple appearance options and animation effects (TdxListViewControl, TdxGalleryControl TdxColorGallery TdxDBColorGallery TdxTileControl, and TdxTileBar).
  • The Gantt control (TdxGanttControl).

Important

According to our research, all other controls do not yield performance gains in DirectX render mode (unlike .NET Winforms, due to platform differences). Therefore, fundamental changes to software architecture required to port existing controls to the universal rendering technique cannot be justified.

DirectX Render Mode

A control in DirectX render mode creates a Direct3D device context and uses a Direct2D-based canvas (instead of a combination of GDI and GDI+ API-based canvases) to draw content and UI elements. This mode is the most beneficial on a client machine with a discrete graphics card, since calculation load shifts from CPU to GPU and bitmap storage relies on frame buffer objects in video memory instead of GDI-based images in system memory.

DirectX-Specific Requirements and Limitations

  • The DirectX render mode is supported in Windows 7 Platform Update (with DirectX11) and newer.
  • This render mode is unavailable if an application is in GDI Scaled mode because it draws DirectX-rendered controls unscaled at their original (unscaled) positions.
  • All controls always rely on GDI and GDI+ draw calls at design time.
  • A control’s Transparent property value has no effect in DirectX render mode, since the control has an opaque Direct3D device context that overlaps any background elements.

GDI+ Render Mode

A control in GDI+ render mode uses only GDI+ API-based canvases instead of a combination of GDI and GDI+ API-based canvases. Unlike the basic GDI render mode, controls can also apply the antialiasing effect to geometric primitives.

The GDI+ render mode is available on all supported operating systems but it can be slower compared to the basic GDI render mode if the displayed control does not draw semitransparent shapes.

Switch Between Render Modes

You can enable a render mode at the application level or at the level of an individual control. A render mode setting change affects only those controls that support multiple render modes. All other controls always use the GDI render mode.

Global Render Mode Setting

To change the active render mode application-wide, add a TdxSkinController component and assign a TdxRenderMode value to the component’s RenderMode property.

The global render mode settings affect an application if it contains at least one control that uses the universal rendering technique.

The following code example enables the DirectX render mode at the application level:

  • Delphi
  • C++
uses dxSkinsForm;// ... dxSkinController1.RenderMode := rmDirectX;

Control Render Mode Setting

To change the active render mode for an individual control that uses the universal rendering technique, assign a TdxRenderMode value to the control’s LookAndFeel.RenderMode property.

The following code example enables the DirectX render mode for an individual Chart control:

  • Delphi
  • C++
uses dxChartControl;// ... dxChartControl1.LookAndFeel.RenderMode := rmDirectX;
DirectX & GDI Render Modes | VCL (2024)

FAQs

What is the difference between Direct2D and GDI? ›

Direct2D supports fully hardware-accelerated alpha-blending (transparency). GDI has limited support for alpha-blending. Most GDI functions do not support alpha blending, although GDI does support alpha blending during a bitblt operation.

What is the difference between GDI and GDI+? ›

Windows GDI+ is different from Windows Graphics Device Interface (GDI) in a couple of ways. First, GDI+ expands on the features of GDI by providing new capabilities, such as gradient brushes and alpha blending. Second, the programming model has been revised to make graphics programming easier and more flexible.

Does GDI use GPU? ›

The GDI Hardware Acceleration feature introduced with Windows 7 provides accelerated core graphics device interface (GDI) operations on a graphics processing unit (GPU).

What is GDI mode? ›

The Microsoft Windows graphics device interface (GDI) enables applications to use graphics and formatted text on both the video display and the printer. Windows-based applications do not access the graphics hardware directly. Instead, GDI interacts with device drivers on behalf of applications.

What is GDI renderer? ›

The Graphics Device Interface (GDI) is a legacy component of Microsoft Windows responsible for representing graphical objects and transmitting them to output devices such as monitors and printers. It was superseded by DirectDraw API and later Direct2D API.

What is the disadvantage of GDI? ›

Many people have complained to the National Highway Traffic Safety Administration that their GDI-powered cars experience high rates of fuel system clogging and engine carbon buildup. The results can be drastic, with some drivers experiencing loss of power and engine stalling.

What are the three modes of GDI? ›

Gasoline Direct Injection (GDI)
  • Secondly, hom*ogeneous stoichiometric mode on higher with higher speed. ...
  • Ultra lean mode:- ...
  • Stoichiometric model:- ...
  • Full power mode:- ...
  • mixture Is slightly richer than the stoichiometric feed.
Mar 26, 2023

What is the benefit of GDI? ›

But with GDI, gas is intensively pressurized and then injected directly into the combustion chamber by way of a common rail fuel line. GDI is popular because it can boost gas mileage, improve emissions, and enhance power. While GDI offers many great benefits, it does create greater susceptibility to carbon buildup.

What DirectX does my GPU support? ›

Follow these steps to use the DirectX Diagnostic Tool to check your DirectX version: In the Search box on the toolbar, enter dxdiag. Then select dxdiag from the list of results. In the DirectX Diagnostic Tool, select the System tab, then check the DirectX version under System Information.

Does DirectX use CPU or GPU? ›

One of these cores usually tells the GPU what to do. The game then uses the remaining cores to handle various CPU-intensive settings like a game's particles or draw distance. On the other hand, DirectX 12 spreads a CPU's workload across multiple cores and allows every core to talk to the GPU simultaneously.

Does dx12 use GPU? ›

DirectX 12 is supported by all Ampere, Turing, Pascal, Maxwell, Kepler and *Fermi GPUs.

What is Direct2D? ›

Direct2D is a hardware-accelerated, immediate-mode, 2-D graphics API that provides high performance and high-quality rendering for 2-D geometry, bitmaps, and text.

Is Direct2D deprecated? ›

Direct2D (Windows) is still an important part of DirectX graphics and Windows. You can still use Direct2D to draw 2D games, and to draw overlays (HUDs) on top of Direct3D.

Is GDI+ obsolete? ›

While both GDI and GDI+ continue to be supported in Windows, Direct2D and DirectWrite are recommended for new programs. In some cases, a mix of technologies might be more practical. For these situations, Direct2D and DirectWrite are designed to interoperate with GDI.

What is GDI in Visual Basic? ›

The Windows operating system has always included support for drawing two-dimensional graphics. This support is known as the Graphics Device Interface (GDI) library.

Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6090

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.