Fact-checked by Grok 2 weeks ago

Graphics Device Interface

The Graphics Device Interface (GDI) is a core application programming interface (API) in the Microsoft Windows operating system that enables applications to generate device-independent graphics and formatted text output for both video displays and printers. By abstracting hardware specifics through interactions with device drivers, GDI insulates developers from direct hardware manipulation, ensuring consistent rendering across diverse output devices. Originally developed for 16-bit Windows systems and subsequently updated for 32-bit and 64-bit architectures, GDI has served as the foundational layer since the operating system's early iterations. Over time, it evolved to support key functionalities such as handling for , and operations for rendering shapes and paths, clipping to define visible regions, and the creation of filled shapes using brushes and pens. Additional capabilities include line and curve , font rendering for text output, region management for complex areas, and metafile support for scalable storage and playback. While GDI remains integral to legacy and certain system-level applications, its limitations in and advanced features like alpha blending led to the introduction of successors, including GDI+ in for enhanced 2D graphics via C++ classes and .NET integration. More recently, Direct2D emerged in as a modern 2D , building on for hardware-accelerated rendering, superior , transparency effects, and , while maintaining interoperability with GDI for backward compatibility. Despite these advancements, GDI continues to underpin essential Windows elements and printer drivers, highlighting its enduring role in the ecosystem.

Overview

Definition and Purpose

The Graphics Device Interface (GDI) is a core () in the Windows operating system that enables applications to represent graphical objects, such as lines, shapes, and images, and transmit them to output hardware devices including monitors and printers. GDI was introduced with , released in 1985. GDI provides a standardized mechanism for rendering two-dimensional graphics and formatted text, ensuring consistent output across diverse display and printing environments. The primary purpose of GDI is to achieve device independence, allowing developers to create graphics without writing hardware-specific code, as GDI abstracts the complexities of underlying devices and translates application requests into device-appropriate commands. It supports key graphical elements including bitmaps for raster images, vector primitives for scalable shapes, text rendering with fonts, and color palettes for managing display colors. By handling these operations in a uniform manner, GDI promotes portability and simplifies application development for visual content. As an intermediary layer, GDI sits between applications and device drivers, intercepting graphical calls from software and coordinating with drivers to produce output on physical devices, thereby insulating applications from low-level hardware variations. This architecture enables reliable, cross-device rendering while maintaining efficiency in resource management.

Role in Windows Operating System

The Graphics Device Interface (GDI) serves as a foundational subsystem within the Windows operating system architecture, bridging user-mode applications and kernel-level components to facilitate 2D graphics rendering and text output. Implemented primarily through the user-mode library gdi32.dll, GDI interacts closely with USER32.DLL, the core module for management, enabling applications to draw into device contexts associated with windows, bitmaps, and printers. This integration allows USER32 to invoke GDI functions during window painting operations, such as in response to WM_PAINT messages, ensuring consistent graphical output across the . Additionally, GDI relies on kernel-mode support via win32k.sys, where certain operations—like and driver communication—are handled to maintain system stability and security. GDI's dependency on display drivers forms a critical part of its role in the , particularly in earlier Windows versions where was limited. Applications issue GDI calls that are translated into driver-specific commands, routed through the to miniport drivers for execution on graphics hardware. For instance, (via DDRAW.DLL) extends this pipeline by providing low-level access to display surfaces, allowing GDI to leverage hardware blitting and overlays while maintaining device independence; functions in ddrawgdi.h explicitly wrap GDI device contexts for compatibility. This setup positioned GDI as the primary interface for the graphics stack before the rise of fully accelerated APIs like and , handling the bulk of 2D operations in a unified, driver-agnostic manner. Despite the shift toward modern graphics technologies, GDI remains a required subsystem in all Windows versions, including and 2025, to ensure compatibility with legacy applications that depend on it for rendering. Recent updates, such as the Rust-based reimplementation of GDI regions in the for version 24H2, underscore its ongoing maintenance for reliability and security in enterprise and environments. GDI supports both client-side rendering, where applications directly drive drawing operations in their processes for immediate control, and server-side modes, managed by the system (e.g., via USER32 for window updates), which batch and optimize output to reduce overhead in multi-session scenarios like . This dual capability preserves while integrating with the broader ecosystem.

Technical Architecture

Core Components and Device Contexts

The Graphics Device Interface (GDI) relies on device contexts as its central mechanism for managing graphics output, providing a structured between applications and rendering devices. A device context () is a that encapsulates a set of graphic objects, their attributes, and the graphic modes that influence output operations, enabling consistent drawing across diverse hardware. This abstraction allows applications to perform device-independent rendering without directly handling low-level device specifics. Device contexts are created through specific GDI functions, such as CreateDC, which initializes a new DC for a particular device like a display or printer, or GetDC, which retrieves a temporary DC associated with a window for immediate drawing. Once obtained, a DC maintains handles to key graphic objects, including pens for line drawing, brushes for filling areas, bitmaps for image manipulation, fonts for text rendering, and palettes for color management. These handles reference GDI-managed resources that can be selected into the DC to define the active drawing state. Additionally, DCs support mapping modes, which define the unit of measure and orientation for coordinate transformations from logical (application-defined) units to device-specific units, such as pixels or millimeters, thereby promoting portability across output devices. Predefined mapping modes like MM_TEXT (one unit equals one device pixel) or MM_LOENGLISH (one unit equals 0.01 inches) handle common scenarios, while customizable modes like MM_ISOTROPIC allow equal scaling in both axes. DCs are categorized into memory-based and physical types to support varied rendering needs. Memory DCs operate in off-screen buffers, such as those tied to bitmaps, facilitating preparatory rendering before displaying or the results. In contrast, physical DCs are linked to tangible output devices, like screens or printers, directing directly to . GDI distinguishes between logical and physical DCs to abstract details: logical DCs provide a uniform interface for applications, hiding device variations, while physical DCs interface directly with drivers for actual output. This separation ensures that applications interact solely with logical constructs, with GDI translating operations to physical implementations. GDI actively manages DC state information to maintain context during operations, including the current position—initialized at (0,0) in logical coordinates—and clipping regions that restrict drawing to designated areas. The current position serves as a reference point for sequential drawing commands, such as lines starting from the last endpoint, and can be queried or updated via functions like GetCurrentPositionEx. Clipping regions, often rectangular by default, are selected into the as graphic objects and modified through operations like intersection or exclusion to define visible bounds, preventing unintended output outside specified areas. These state elements collectively ensure coherent and controlled graphics rendering within the . Device contexts form the foundation for higher-level GDI drawing functions, where selected objects and states dictate the behavior of primitives like lines and fills.

Device-Independent Graphics Model

The Graphics Device Interface (GDI) achieves device independence by allowing applications to issue high-level graphics calls that are abstracted from underlying hardware specifics, with GDI translating these into device-specific commands via drivers. This model insulates applications from variations in display monitors, printers, or other output s, enabling portable code that renders consistently across platforms without modification. For , particularly in printing scenarios, GDI records drawing operations as enhanced metafiles (), which are device-independent sequences of GDI calls that can be replayed on any compatible . Central to this abstraction are logical units and coordinate transformations, which define output in terms that are independent of physical resolutions. Logical units can represent measurements such as (in MM_TEXT mode, where one unit equals one ), inches (in MM_HIENGLISH mode, with 1000 units per inch), or other scales like millimeters or twips, allowing developers to specify in user-friendly terms rather than . modes, set via functions like SetMapMode, further customize this by defining how logical units map to coordinates, supporting isotropic (equal x and y scaling) or anisotropic transformations for flexible output. Advanced transformations, including scaling, , and , are applied through world-space to page-space mappings using SetWorldTransform, which applies a affine to adjust rendering without altering the original logical coordinates. contexts serve as the primary for these operations, encapsulating the state and enabling seamless application-to-driver communication. GDI extends support to diverse devices by requiring drivers to implement escape functions, which provide access to custom capabilities beyond standard GDI . Functions like and ExtEscape allow applications to query or invoke device-specific features, such as printer-specific controls, ensuring that while core rendering remains portable, specialized hardware can be leveraged when needed. This driver-mediated translation maintains consistency in both vector-based (e.g., lines, curves) and raster output across devices. Enhanced metafiles further reinforce this model by storing complete, device-independent graphics scenes that can be rendered reliably. The PlayEnhMetaFile function replays these metafiles on a target device context, executing the recorded GDI calls to produce identical output regardless of the destination hardware, thus ensuring portability for complex illustrations or print jobs.

Graphics Primitives and Operations

Drawing and Filling Functions

The Graphics Device Interface (GDI) provides a set of functions for drawing lines and filling shapes in a device context, enabling applications to render independently of the . These operations rely on pens for outlining and brushes for filling, with attributes selected into the device context before . Raster operations allow customization of how drawn elements combine with existing content in the device context. Line drawing in GDI begins by setting a current position using the MoveToEx function, which updates the device context's current point to the specified coordinates and optionally stores the previous position. The LineTo function then draws a line from this current position to a new endpoint, updating the current position accordingly. For multiple connected lines, the Polyline function draws a series of line segments defined by an array of points, starting from the first point and connecting sequentially. Pens control the appearance of lines and outlines, created via functions like CreatePen, which specify a style (such as solid, dashed, or dotted), width in logical units, and color. Cosmetic pens, the default type, have widths that are either 1 or as thin as possible on the device, while geometric pens support variable widths for precise scaling. To apply a pen, an application calls SelectObject to replace the current pen in the device context. Shape filling functions draw and fill closed regions using the current . The Rectangle function draws a with the specified bounding coordinates, outlining it with the current pen and filling the interior with the current . Similarly, Ellipse fills and outlines an or circle within the given bounding rectangle. For arbitrary shapes, Polygon draws and fills a single defined by an array of points, closing the path automatically. Brushes, selected via SelectObject, define fill patterns, including solid colors, hatches, or bitmaps. Complex polygon filling in GDI uses one of two modes set by SetPolyFillMode: ALTERNATE (the default), which applies the even-odd rule to fill regions between odd- and even-numbered boundary crossings on each scan line, or WINDING, which fills regions where the (net edge traversals) is nonzero. The ALTERNATE mode suits non-overlapping or simple intersecting s, while WINDING handles nested or self-intersecting shapes by considering edge direction. These modes ensure consistent rendering across devices, with the previous mode retrievable via GetPolyFillMode. Raster operations, controlled by SetROP2, define how the pen or brush combines with the destination pixels during drawing, using ternary raster operation codes like R2_COPYPEN (direct copy) or R2_XORPEN ( for reversible drawing). This allows effects such as transparent overlays or highlighting without altering underlying content permanently. A typical sequence for drawing involves creating and selecting objects into the device context, as shown in this example:
c
HPEN hPen = CreatePen(PS_SOLID, 2, RGB(0, 0, 255));  // [Blue](/page/Blue) solid pen, 2 units wide
HBRUSH hBrush = CreateSolidBrush(RGB(255, 0, 0));    // [Red](/page/Red) solid brush
SelectObject(hdc, hPen);                             // Select pen
SelectObject(hdc, hBrush);                           // Select [brush](/page/Brush)
SetROP2(hdc, R2_COPYPEN);                            // Standard copy mode
MoveToEx(hdc, 10, 10, NULL);                         // Start at (10,10)
LineTo(hdc, 100, 10);                                // Draw line to (100,10)
Rectangle(hdc, 20, 20, 80, 60);                      // Draw and fill [rectangle](/page/Rectangle)
DeleteObject(hPen);                                  // Clean up
DeleteObject(hBrush);
This code draws a line and a filled , demonstrating object selection and basic operations. Text paths can integrate with these drawing functions by converting text to outlines for filling, though detailed text rendering is handled separately.

Curve Drawing

GDI supports drawing and using functions that create smooth paths. The Arc function draws an elliptical from a starting to an ending within a bounding , using the current pen. Similarly, Chord draws a (a line connecting the endpoints of the ) and fills the sector with the current brush, while Pie fills the pie-shaped sector bounded by the and two radii. For more complex , PolyBezier draws one or more Bézier defined by an array of points, where every three points define a cubic Bézier segment, and PolyBezierTo continues from the current position. These functions enable rendering of rounded shapes and paths independently of the device.

Bitmap Handling

GDI provides functions for creating, loading, and manipulating bitmaps to handle raster images. The CreateBitmap function creates a device-dependent bitmap from specified width, height, planes, bits per pixel, and an array of initial pixel data. LoadBitmap loads a bitmap resource from the application's executable or a file. To display or transfer bitmaps, BitBlt performs bit-block transfers between bitmaps or between a bitmap and the device context, supporting raster operations for effects like copying, AND, OR, or XOR. Additional functions like StretchBlt scale bitmaps during transfer, and MaskBlt applies transparency using a mask bitmap. These operations allow device-independent image manipulation and rendering.

Clipping and Regions

Clipping in GDI restricts drawing operations to a defined , preventing output outside specified boundaries. The SelectClipRgn function sets a region as the clipping region for the device context, where subsequent drawing is limited to the interior of that region. ExtSelectClipRgn extends this with modes like RGN_AND ( with current) or RGN_OR (). Regions are created using functions such as CreateRectRgn for rectangular regions, CreateEllipticRgn for elliptical ones, or CreatePolygonRgn for polygonal areas. Complex regions can be combined with CombineRgn, using operations like RGN_DIFF (difference) or RGN_XOR (). Filling regions uses FillRgn with a , and FrameRgn outlines them with a and . These capabilities manage complex visible areas and ensure precise rendering across devices.

Metafile Support

GDI metafiles allow recording and playback of operations for scalable, device-independent storage. metafiles () are created with CreateEnhMetaFile, which records drawing calls into a or . Functions like PlayEnhMetaFile replay the metafile in a device context, scaling and mapping coordinates as needed. SetEnhMetaFileBits loads an EMF from a . Metafiles support paths, text, bitmaps, and regions, enabling portable that render consistently on displays or printers without loss of quality. As of , EMF+ extends this with additional features like gradient fills, though classic GDI metafiles remain foundational.

Text Rendering and Fonts

The Graphics Device Interface (GDI) manages fonts through logical font objects created via functions such as CreateFontIndirect, which constructs a font based on characteristics specified in a LOGFONT structure, including typeface name, , width, and attributes like bold or italic. This approach allows applications to define fonts independently of specific devices, supporting both scalable fonts and device-specific raster or fonts that reside on output devices like printers. To enumerate available fonts, GDI provides functions like EnumFontFamilies, which lists all styles within a specified font family on a device context, or EnumFonts, which retrieves fonts matching a given typeface name; these are essential for applications to discover and device fonts installed on the system. For outputting text, GDI offers TextOut, a basic function that draws a character string at a specified position in the device context using the currently selected font, operating at the driver level for efficiency. More advanced formatting is handled by DrawText, which renders text within a rectangular region and supports flags in its uFormat parameter for alignment (e.g., DT_CENTER for horizontal centering or DT_VCENTER for vertical), clipping (e.g., DT_CLIP to restrict drawing to the rectangle), and integration with background modes set via SetBkMode (e.g., TRANSPARENT or OPAQUE to control fill behind the text). These functions enable precise control over text placement and appearance, with DrawText automatically handling line breaks and justification based on the flags provided. GDI supports custom text rendering through GetGlyphOutline, which retrieves the outline or bitmap representation of a from a font selected in the device context, allowing applications to obtain cubic Bézier curves (via GGO_BEZIER) or grayscale bitmaps (via GGO_GRAY4 for 17 levels) for manipulation and redrawing. For Unicode text, ExtTextOut extends this capability, drawing strings with optional spacing, clipping, and background rectangles while supporting wide-character () input through its W variant, making it suitable for internationalized applications and direct driver-level performance. In device contexts, GDI performs font mapping by substituting a logical font with the closest matching physical font available on the system or , using an internal that considers attributes like pitch, family, and ; this substitution can be influenced by SetMapperFlags to prioritize exact matches over aspect adjustments. However, classic GDI text rendering has notable limitations in , lacking sub-pixel positioning and y-axis smoothing, which results in jagged edges and uneven spacing at small sizes compared to modern alternatives like DirectWrite.

History and Evolution

Early Development and Windows 1.0 to 3.x

The (GDI) was developed by in 1985 as the core graphics subsystem for , marking the company's entry into graphical user interfaces with a release on November 20, 1985. This system provided an for applications to render 2D graphics and text without direct dependencies, enabling consistent output across varying display and printer devices. Drawing inspiration from early GUI innovations like the workstation created at Xerox PARC in the 1970s, GDI adopted concepts of bitmapped displays and vector-based drawing to support interactive computing environments. The Alto's bitmap-oriented graphics model influenced GDI's focus on device-independent primitives, allowing developers to target multiple output mediums through a unified . From through 3.0, GDI featured basic 16-color palette support to accommodate early color graphics cards, simple device contexts (DCs) for managing drawing states like pens and brushes, and compatibility with adapters such as VGA for color resolutions up to 640x480 and for high-resolution text modes at 720x348. These DCs served as handles to encapsulate graphic attributes and output destinations, enabling straightforward calls for lines, shapes, and bitmaps but limited to 16-bit operations in . Windows 3.0, released in May 1990, advanced GDI with improved metafile support, allowing to be recorded and replayed more reliably for enhanced portability between devices like screens and printers. Building on this, Windows 3.1 in 1992 integrated fonts into GDI, introducing scalable outline fonts that rendered smoothly at any size without , a joint development with Apple to rival Adobe's dominance. Initial GDI versions enforced a 1:1 mapping in the MM_TEXT coordinate , where logical units directly corresponded to physical pixels without built-in or , often requiring developers to implement device-specific workarounds for mismatches or corrections. This rigid mapping prioritized with low-resolution hardware like CGA and EGA but constrained flexibility, leading to hacks such as custom drivers for non-standard adapters to achieve consistent rendering.

Windows 95 to XP Era

The transition to 32-bit Windows operating systems marked a significant maturation for the Graphics Device Interface (GDI). in 1995 introduced the , but GDI retained a 16-bit core with a 32-bit layer (GDI32.dll) for , enabling more robust handling for consumer applications. A fully 32-bit GDI was implemented in in 1996, replacing the hybrid model in the enterprise branch. This architecture supported advanced features such as 24-bit (16.7 million colors) through device-independent and display drivers. Basic alpha blending capabilities were also incorporated, primarily via bit-block transfer (bitblt) operations that handled during rendering, laying groundwork for layered windows and in graphical user interfaces. In the Windows NT lineage, from NT 4.0 in 1996 through in 2001, GDI evolved with deeper integration into the NT kernel for enhanced stability and security, moving core rendering services to kernel mode to prevent user-mode faults from destabilizing the system. This architectural change, implemented via the introduction of GDI32.DLL as the primary user-mode to kernel-level operations, reduced context switches and improved for -intensive tasks while isolating GDI from malicious or erroneous applications. further refined GDI's role in printing by enhancing the spooler architecture with better support for Enhanced Metafile () spooling, allowing more efficient device-independent print job processing and reduced overhead in multi-user environments. By , GDI gained improved theme support through the UXTheme subsystem, which leveraged GDI primitives for rendering visual styles and enabling customizable user without compromising . A key outcome of this era, particularly in the NT/XP branches, was GDI's shift to protected-mode execution and integration starting with , which mitigated system-wide crashes by confining graphics errors to individual processes. The consumer /98 branches provided partial improvements but retained hybrid elements vulnerable to broader instability. This protection mechanism, combined with 32-bit memory addressing in the NT line, significantly enhanced reliability for desktop applications, enabling GDI to handle complex device contexts more securely in multi-tasking scenarios.

Windows Vista to 7 Enhancements

Windows Vista, released in 2006, integrated the Graphics Device Interface (GDI) with the new Desktop Window Manager (DWM) to support composited desktop effects while maintaining backward compatibility for legacy applications. Under DWM, GDI-rendered content from non-aware applications is redirected to off-screen bitmaps, which are then composited using hardware-accelerated DirectX for visual effects like transparency and animations, allowing GDI to coexist with the modern rendering pipeline without requiring immediate code changes. Additionally, Vista introduced DPI awareness modes through the SetProcessDPIAware function and application manifests, enabling developers to opt out of system-level bitmap scaling and handle high-DPI displays directly via GDI device contexts for sharper rendering on diverse hardware. Vista also refined ClearType technology, Microsoft's subpixel rendering method optimized for LCD panels, by incorporating enhancements that improved text legibility through better color subpixel antialiasing and gamma adjustments tailored to flat-panel displays. These updates built on ClearType's foundation from earlier Windows versions, focusing on reducing color fringing and enhancing horizontal resolution for on-screen text without altering the core GDI text output primitives. In Windows 7, released in 2009, GDI received hardware acceleration support, allowing core operations such as bit-blits, line drawing, and fills to leverage GPU capabilities via the Windows Display Driver Model (WDDM), which optimized performance for Aero visual effects and reduced CPU overhead in composited scenarios. This acceleration improved font smoothing through more efficient ClearType processing, resulting in smoother edges and lower resource usage for GDI-based text rendering, particularly beneficial for legacy applications running under DWM. Meanwhile, while classic GDI remained unchanged to ensure compatibility, GDI+ was positioned as the preferred extension for new applications seeking enhanced 2D graphics features, though developers were increasingly directed toward emerging APIs for optimal integration with Aero.

Windows 8 and Later Updates

In and 10, released between 2012 and 2015, the Graphics Device Interface (GDI) was maintained primarily for with legacy Win32 applications, even as promoted for performance-critical graphics rendering in modern apps. These versions introduced enhancements for high-DPI displays, including DPI virtualization for GDI-based applications that do not declare explicit DPI awareness, allowing Windows to automatically scale elements to prevent blurriness on high-resolution screens. Additionally, increased the per-session limit for GDI objects to support more complex legacy workloads without frequent resource exhaustion. Windows 11 and 2025 continue to provide full support for GDI, with delivering monthly security updates to address ongoing vulnerabilities in core components like GDI32.DLL. 2025 was released on November 1, 2024. In 2025, several patches targeted remote code execution (RCE) risks, including those in May, July, and August releases, which fixed flaws such as CVE-2025-53766—a critical heap-based in GDI+ integration that could allow unauthorized attackers to execute arbitrary code over a . In November 2025, addressed another critical GDI RCE vulnerability, CVE-2025-60724. These updates underscore GDI's persistent role in environments, where it handles for a significant portion of legacy applications amid the shift to successors like .

Applications and Usage

Display Output on Screens

The Graphics Device Interface (GDI) facilitates display output on screens by providing device contexts (DCs) tailored for rendering graphical content to client areas in real-time, interactive environments. Screen DCs, obtained via functions like GetDC or through BeginPaint in response to system messages, enable applications to draw directly to the visible surface of windows on the primary monitor. A core mechanism for screen rendering involves handling the WM_PAINT message, which the system sends to a procedure when its client area requires redrawing due to invalidation events such as resizing, uncovering, or scrolling. In processing WM_PAINT, applications retrieve a display using BeginPaint, which automatically incorporates the update region to limit drawing to only the affected portions of the window, thereby optimizing the repainting process; drawing operations are then performed using GDI primitives like lines, shapes, and text, followed by a call to EndPaint to release the and validate the update region. This approach ensures efficient partial updates, where the system tracks invalidated regions to avoid unnecessary full-window redraws. For complex rendering scenarios, GDI supports off-screen through memory device contexts (DCs), which allow developers to prepare graphics in memory before transferring them to the screen. To implement this, an application creates a memory DC compatible with the screen using CreateCompatibleDC, then selects a of appropriate dimensions via CreateCompatibleBitmap and SelectObject to serve as the drawing surface. Drawing occurs entirely within this memory DC, enabling layered composition without flickering on the visible screen; subsequently, BitBlt copies the composited from the memory DC to the screen DC, supporting operations like scrolling by shifting rectangular regions of pixels. This technique is particularly useful for animations or dynamic updates, as it decouples preparation from display. In classic Windows modes without composition, GDI handles output directly to the primary monitor's surface, where the origin (0,0) is positioned, allowing immediate pixel-level rendering without intermediate buffering layers. For adapting content to varying resolutions or window sizes, StretchBlt performs bit-block transfers while scaling the source to fit the destination , preserving aspect ratios or stretching as specified to ensure proper visual fidelity on screen displays. To further enhance efficiency in partial screen updates, GDI employs clipping regions that constrain drawing to specific areas, excluding invalid or non-client regions. The ExcludeClipRect function modifies the current clipping region by subtracting a specified , such as non-updated parts of a , preventing unnecessary drawing operations and reducing overdraw in scenarios like complex layouts or overlapping controls. This clipping integrates seamlessly with WM_PAINT handling, where the initial update region from BeginPaint can be refined to focus rendering on visible, relevant screen areas.

GDI-Based Printing

GDI-based printing enables Windows applications to generate print jobs by leveraging the (GDI) to abstract device-specific details, allowing developers to draw graphics and text that are spooled and rendered for output on . When an application initiates , it obtains a printer device context (DC) using functions like CreateDC, which serves as a for issuing GDI drawing commands tailored to the selected printer. This DC captures the application's output in a device-independent manner, facilitating across various printer types without requiring direct interaction. To manage the print job lifecycle, applications call StartDoc to initiate the job, specifying details such as the document name, output file (if applicable), and device mode structure containing printer settings like and . For each page of the document, applications call StartPage to begin rendering the page, perform operations—such as lines, shapes, and text—within the DC, and then call EndPage to finish the page. The job concludes with EndDoc, which finalizes the spool file and notifies the system to process it. For rasterization, the PlayEnhMetaFile function replays an Enhanced Metafile (EMF) onto the printer , converting and instructions into printable raster data suitable for the target device. The Enhanced Metafile (EMF) format plays a central role in GDI-based printing as a spoolable, device-independent vector representation of graphics, storing sequences of GDI calls that include paths, fills, and text rather than raw pixels. This vector-based structure ensures scalability and fidelity during rendering, while supporting both vector elements and embedded bitmaps for complex images. EMF files also accommodate GDI escape functions, which allow applications to invoke printer-specific features—such as duplex printing or custom paper trays—via Escape or ExtEscape calls that pass control codes directly to the driver when standard GDI primitives are insufficient. Print jobs are managed through the Windows Print Spooler service, which receives the spool file from GDI, interprets its records, and coordinates with the for output. The spooler adds job , such as page counts and user credentials, before forwarding the data to the port driver for transmission to the physical printer. For efficiency with large images or high-resolution outputs, GDI employs banding, dividing the page into horizontal strips (bands) that are rendered and spooled sequentially, reducing memory usage and enabling progressive processing without loading the entire page at once. In modern Windows environments starting from , GDI print jobs for compatible printers are converted to the XML Paper Specification () format via an internal GDI-to-XPS pipeline, providing enhanced and compression for contemporary devices. However, classic GDI-based drivers persist for legacy support, particularly for older and inkjet printers that lack XPS compatibility, ensuring backward compatibility through direct EMF rendering and raw device commands.

Limitations and Challenges

Performance and Scalability Issues

The Graphics Device Interface (GDI) relies on a software-based rendering pipeline that is predominantly CPU-bound, as many of its core operations, such as drawing primitives like lines and fills, do not leverage hardware acceleration and instead execute entirely on the processor. This design choice, rooted in GDI's origins as an immediate-mode graphics system, results in significant performance degradation during animations or dynamic content updates, where frequent redraws consume substantial CPU cycles without offloading work to the GPU. For instance, real-time rendering applications using GDI can exhibit high CPU utilization on multi-core systems for simple frame updates, highlighting its inefficiency for smooth, high-frame-rate visuals. GDI's scalability is further constrained by its limited native support for high-resolution displays, particularly in environments exceeding 96 DPI, where it lacks inherent DPI awareness and relies on system-level bitmap stretching that introduces aliasing and blurring artifacts. On 4K monitors with scaling factors like 200%, GDI-rendered elements often appear pixelated or distorted unless applications explicitly implement per-monitor DPI handling, a feature not fully integrated into GDI until later Windows versions through compatibility modes. This leads to suboptimal rendering quality and increased computational overhead for scaling operations, making GDI ill-suited for modern ultra-high-definition workflows without additional mitigations. A key inefficiency arises from GDI's immediate-mode , which requires redrawing entire invalidated regions during window updates rather than maintaining a retained , proving particularly burdensome for large or complex interfaces. When a window invalidates—such as during resizing or overlapping—GDI processes the full region via WM_PAINT messages, recomputing all graphics primitives from scratch, which contrasts sharply with retained-mode systems that and incrementally only changed elements. This can result in redraw times quadratically with window size, leading to noticeable lag in applications with expansive canvases, such as CAD tools or editors. Additionally, GDI's use of enhanced metafiles (EMF) for spooling and complex scene representation contributes to memory bloat, as these vector-based records expand rapidly with intricate containing numerous primitives or embedded rasters. In scenarios involving detailed diagrams or layered drawings, EMF files can balloon to tens or hundreds of megabytes due to uncompressed , exacerbating memory pressure during rendering or operations. This overhead not only strains system resources but also prolongs processing times, underscoring GDI's challenges in managing resource-intensive graphical workloads.

Security Vulnerabilities and Exploits

The Graphics Device Interface (GDI) in Windows has long been a target for security researchers and attackers due to its in handling graphical data, leading to several classes of vulnerabilities. Common issues include overflows during font parsing, particularly with Font (TTF) files, where improper bounds checking allows attackers to overwrite memory and achieve remote code execution (RCE). For instance, vulnerabilities like those addressed in Microsoft Security Bulletin MS12-034 (CVE-2012-0159) involved heap-based overflows in the win32k.sys driver when processing malformed TTF data, enabling or code execution without user interaction. Similarly, RCE can occur through malformed images processed in device contexts (DCs), such as enhanced metafile () or EMF+ records, which GDI uses for rendering graphics; attackers craft inputs like invalid RECT structures in EmfPlusSetTSClip records to trigger out-of-bounds reads or writes on the , potentially leaking sensitive data or executing arbitrary code. In 2025, Microsoft addressed multiple critical GDI-related flaws through its Patch Tuesday updates. CVE-2025-53766, a heap-based buffer overflow in GDI+ triggered by specially crafted EMF+ metafiles (e.g., via EmfPlusDrawRects records), was patched in August 2025 (KB5063878) and carries a CVSS v3.1 score of 9.8, allowing unauthenticated remote attackers to execute code over a network without privileges or user interaction. Earlier, in May 2025 (KB5058411), Microsoft fixed CVE-2025-30388, an RCE in GDI+ exploitable via malformed EMF+ files like those using EmfPlusDrawString, which could corrupt memory in DCs during rendering. Additionally, July 2025's update (KB5062553) resolved CVE-2025-47984, an information disclosure vulnerability in core GDI components stemming from improper handling of EMR_STARTDOC records in EMF files, potentially exposing kernel memory to unprivileged processes. These patches enhanced input validation in GDI and GDI+ to prevent memory corruption, but exploitation remains feasible on unpatched systems, particularly in scenarios involving untrusted graphical content like documents or web previews. Historically, GDI flaws have facilitated sophisticated malware persistence and propagation. The 2010 Stuxnet worm exploited a zero-day vulnerability in the Windows Print Spooler service (CVE-2010-2729, addressed in MS10-061), using specially crafted print requests to load malicious code and spread across networks; this involved GDI's processing of EMF spool files for rendering, allowing the malware to achieve local privilege escalation and maintain persistence in air-gapped environments like industrial control systems. Ongoing risks persist in the print spooler, where GDI handles EMF-based print jobs, enabling attackers to deliver malformed images via network-shared printers or documents, as seen in later exploits like PrintNightmare (CVE-2021-34527), which permitted RCE by abusing spooler APIs to load arbitrary drivers during GDI rendering. Such vectors highlight GDI's exposure in printing workflows, where untrusted inputs can bypass sandboxing if legacy components are enabled. To counter these threats, Microsoft employs built-in mitigations like (ASLR), which randomizes memory addresses for GDI libraries to hinder exploit reliability, and Data Execution Prevention (DEP), which marks heap and stack memory as non-executable to block injected code from running. Enhanced ASLR in modern Windows versions, including bottom-up randomization for GDI objects, further complicates attacks on buffer overflows. Additionally, disabling legacy GDI paths in sandboxed environments—such as browsers or applications using isolated processes—prevents exploitation of DCs and font parsers by restricting access to kernel-mode GDI calls, as recommended in exploit protection configurations. These measures, while not eliminating risks, significantly raise the bar for successful attacks on GDI components.

Successors and Legacy

GDI+ as an Extension

GDI+ was released in 2001 as part of , implemented as the Gdiplus.dll library to extend the capabilities of the original Graphics Device Interface (GDI). It serves as a managed extension designed for integration with the .NET Framework, providing developers with a higher-level for 2D graphics rendering while maintaining compatibility with existing GDI-based applications. This extension addressed limitations in GDI by introducing object-oriented classes that simplify graphics operations, particularly for applications requiring more advanced visual effects without direct . Key enhancements in GDI+ include support for alpha blending to enable transparent overlays, gradient fills using classes like LinearGradientBrush and PathGradientBrush for smooth color transitions along paths, and anti-aliased rendering for smoother lines and curves in paths. The central class facilitates these operations, allowing developers to draw shapes, text, and images with improved quality, while built-in support for image formats such as and expands beyond GDI's limited handling. Additionally, GDI+ introduces transforms for applying scaling, rotation, and shearing to graphical elements, enabling complex manipulations like perspective effects on paths and brushes. GDI+ ensures with classic GDI through wrappers, permitting seamless mixing of GDI calls with GDI+ objects in the same device context, though GDI+ primitives like PathGradientBrush require translation for GDI fallback. This design allows legacy applications to leverage new features incrementally without full rewrites. In terms of memory management, GDI+'s managed code support via .NET wrappers abstracts raw GDI handles and pointers, relying on the garbage collector for automatic resource cleanup, which reduces common issues like handle leaks prevalent in unmanaged GDI programming.

Modern Alternatives like Direct2D

, introduced by in in 2009, serves as a primary successor to the Graphics Device Interface (GDI) for 2D graphics rendering on Windows platforms. This immediate-mode is built on , enabling that leverages the (GPU) for high-performance rendering of vector geometry, bitmaps, text, and visual effects, such as blurs and shadows. Unlike GDI, which relies heavily on CPU-based processing, offloads rendering tasks to the GPU, significantly alleviating performance bottlenecks in complex scenes and high-resolution displays. A key advantage of Direct2D is its support for advanced text rendering through integration with DirectWrite, including subpixel positioning for sharper glyph edges and improved readability on LCD screens. This addresses GDI's limitations in and transparency handling, where inconsistent results across hardware could occur due to software emulation. By utilizing video memory and Direct3D's feature set, achieves higher frame rates and better scalability for demanding applications, such as real-time data or interactive UIs. For managed code environments, Windows Presentation Foundation (WPF) provides an alternative to GDI, employing for vector-based graphics, animations, and layout in desktop applications. In the context of (UWP) and modern Windows apps, WinUI—particularly WinUI 3—offers a native UI framework with a high-performance Visual layer for 2D graphics, effects, and input handling, built on and Composition APIs. recommends using modern APIs like for new development to ensure better performance and compatibility with contemporary hardware, while GDI continues to be supported for legacy applications and system components. As part of its continued support, in Windows 11 version 24H2 (released October 2024), introduced a Rust-based implementation of GDI region handling in the (win32kbase_rs.sys) to improve reliability and security. Transitioning from GDI to involves replacing traditional device contexts (DCs) with render targets, such as ID2D1HwndRenderTarget, which directly associates a Direct2D surface with a window handle for efficient, GPU-accelerated drawing. This migration path maintains interoperability—for instance, via ID2D1GdiInteropRenderTarget to blend GDI content into scenes—allowing incremental updates without full rewrites, while yielding substantial performance gains in redraw-intensive operations.

References

  1. [1]
    Windows GDI - Win32 apps - Microsoft Learn
    Jan 27, 2023 · The Microsoft Windows graphics device interface (GDI) enables applications to use graphics and formatted text on both the video display and the printer.Bitmaps · Painting and Drawing · Clipping · Filled Shapes
  2. [2]
    Overview of the Windows Graphics Architecture - Win32 apps
    Aug 22, 2022 · Graphics Device Interface (GDI) is the original graphics interface for Windows. · GDI+ was introduced in Windows XP as a successor to GDI.Missing: history | Show results with:history
  3. [3]
    Overview of GDI+ - Win32 apps - Microsoft Learn
    Jan 7, 2021 · As its name suggests, GDI+ is the successor to Windows Graphics Device Interface (GDI), the graphics device interface included with earlier ...Missing: history | Show results with:history
  4. [4]
    The history of PCs | Microsoft Windows
    Dec 31, 2024 · The launch of Windows 1.0 in 1985 marked the beginning of a new era in personal computing. Windows provided a graphical user interface (GUI) ...
  5. [5]
    About the GDI Print API - Win32 apps | Microsoft Learn
    Jan 7, 2021 · An application calls high-level functions from the graphics device interface (GDI). For example, to print a bitmapped image, an application can call the BitBlt ...
  6. [6]
    [PDF] Sample Chapters from Windows Internals, Sixth Edition, Part 1
    The W32PROCESS structure is created the first time a thread calls a Windows USER or GDI function that is implemented in kernel mode . With the exception of ...
  7. [7]
    Ddrawgdi.h header - Win32 apps - Microsoft Learn
    Jan 23, 2023 · Wrapper for the NtGdiDdGetDC function and returns a Windows Graphics Device Interface (GDI) device context (DC) that represents the Microsoft ...
  8. [8]
    What's new in Windows 11 IoT Enterprise, version 24H2?
    Oct 1, 2024 · There's a new implementation of GDI region in win32kbase_rs.sys that utilizes Rust, which offers advantages in reliability and security over ...
  9. [9]
    About Device Contexts - Win32 apps | Microsoft Learn
    Jan 7, 2021 · A device context (DC) is a structure that defines graphic objects and their attributes, and the graphic modes affecting output. Applications ...
  10. [10]
    Device Contexts - Win32 apps | Microsoft Learn
    Jan 7, 2021 · A device context is a structure that defines a set of graphic objects and their associated attributes, as well as the graphic modes that affect output.Missing: documentation | Show results with:documentation
  11. [11]
    Device Context Functions - Win32 apps | Microsoft Learn
    Jan 7, 2021 · Device context functions are used with device contexts, such as creating, deleting, and getting a device context for a window or screen.
  12. [12]
    Mapping Modes and Translations - Win32 apps | Microsoft Learn
    Jan 7, 2021 · The other two mapping modes (MM_ISOTROPIC and MM_ANISOTROPIC) require that the extents are specified. This is done by calling SetMapMode to set ...
  13. [13]
    Predefined Mapping Modes - Win32 apps - Microsoft Learn
    Jan 7, 2021 · Of the six predefined mapping modes, one is device dependent (MM_TEXT) and the remaining five (MM_HIENGLISH, MM_LOENGLISH, MM_HIMETRIC, ...
  14. [14]
    Display Device Contexts - Win32 apps - Microsoft Learn
    Jan 7, 2021 · Common device contexts are display DCs maintained in a special cache by the system. Common device contexts are used in applications that perform ...
  15. [15]
    Display Device Context Defaults - Win32 apps - Microsoft Learn
    Jan 7, 2021 · When an application releases these device contexts, the current selections, such as mapping mode and clipping region, are lost as the context is ...
  16. [16]
    GetCurrentPositionEx function (wingdi.h) - Win32 - Microsoft Learn
    Feb 22, 2024 · A handle to the device context. A pointer to a POINT structure that receives the logical coordinates of the current position.
  17. [17]
    Clipping Regions - Win32 apps - Microsoft Learn
    Jan 7, 2021 · A clipping region is one of the graphic objects that an application can select into a device context (DC). It is typically rectangular.Missing: state position
  18. [18]
    Introduction to Printing - Windows drivers | Microsoft Learn
    Sep 27, 2024 · The GDI graphics engine either spools the drawing instructions as an enhanced metafile (EMF) file or, together with a printer driver, renders a ...<|control11|><|separator|>
  19. [19]
    SetMapMode function (wingdi.h) - Win32 apps | Microsoft Learn
    Oct 12, 2021 · The SetMapMode function sets the mapping mode of the specified device context. The mapping mode defines the unit of measure used to transform page-space units ...
  20. [20]
    SetWorldTransform function (wingdi.h) - Win32 apps | Microsoft Learn
    Feb 22, 2024 · The SetWorldTransform function sets a two-dimensional linear transformation between world space and page space for the specified device context.
  21. [21]
    Escape function (wingdi.h) - Win32 apps - Microsoft Learn
    Oct 12, 2021 · The Escape function enables an application to access the system-defined device capabilities that are not available through GDI.
  22. [22]
    PlayEnhMetaFile function (wingdi.h) - Win32 apps | Microsoft Learn
    Oct 12, 2021 · The PlayEnhMetaFile function displays the picture stored in the specified enhanced-format metafile.
  23. [23]
    CreatePen function (wingdi.h) - Win32 apps | Microsoft Learn
    Aug 23, 2022 · The CreatePen function creates a logical pen that has the specified style, width, and color. The pen can subsequently be selected into a device context and ...
  24. [24]
    Cosmetic Pens - Win32 apps - Microsoft Learn
    Jan 7, 2021 · Cosmetic pens have three attributes: width, style, and color. For ... To create a cosmetic pen, use the CreatePen, CreatePenIndirect, or ...
  25. [25]
    SetPolyFillMode function (wingdi.h) - Win32 apps - Microsoft Learn
    Feb 22, 2024 · Selects alternate mode (fills the area between odd-numbered and even-numbered polygon sides on each scan line). WINDING. Selects winding mode ( ...Syntax · Parameters
  26. [26]
    About Polygons - Win32 apps | Microsoft Learn
    Jan 7, 2021 · An application can select either mode by calling the SetPolyFillMode function. For more information about polygon fill modes, see Regions. The ...
  27. [27]
    SetROP2 function (wingdi.h) - Win32 apps | Microsoft Learn
    Oct 12, 2021 · The SetROP2 function sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors ...
  28. [28]
    Binary Raster Operations - Win32 apps - Microsoft Learn
    Jan 7, 2021 · This section lists the binary raster-operation codes used by the GetROP2 and SetROP2 functions. Raster-operation codes define how GDI ...
  29. [29]
    Painting and Drawing Functions - Win32 apps | Microsoft Learn
    Jan 7, 2021 · It is used to draw a string. Fills the clipping region in a device context with a pattern.
  30. [30]
    CreateFontIndirectA function (wingdi.h) - Win32 apps | Microsoft Learn
    Feb 22, 2024 · The CreateFontIndirect function creates a logical font that has the specified characteristics. The font can subsequently be selected as the current font for ...
  31. [31]
    Raster, Vector, TrueType, and OpenType Fonts - Win32 apps
    Jan 7, 2021 · TrueType and OpenType fonts provide both relatively fast drawing speed and true device independence. By using the hints associated with a glyph, ...
  32. [32]
    EnumFontFamiliesA function (wingdi.h) - Win32 apps - Microsoft Learn
    Feb 8, 2023 · The EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device.
  33. [33]
    Enumerating the Installed Fonts - Win32 apps - Microsoft Learn
    Jan 7, 2021 · The EnumFontFamilies function enumerates all the styles associated with a specified family name, not simply the bold and italic attributes.
  34. [34]
    Drawing Text (Windows GDI) - Win32 apps | Microsoft Learn
    Jan 7, 2021 · It can begin drawing characters and symbols by calling any of the text-output functions. When an application calls one of these functions, the operating system ...
  35. [35]
    DrawText function (winuser.h) - Win32 apps | Microsoft Learn
    Aug 2, 2022 · The DrawText function draws formatted text in the specified rectangle. It formats the text according to the specified method (expanding tabs, justifying ...
  36. [36]
    GetGlyphOutlineA function (wingdi.h) - Win32 apps | Microsoft Learn
    Feb 8, 2023 · The GetGlyphOutline function retrieves the outline or bitmap for a character in the TrueType font that is selected into the specified device context.Missing: GDI | Show results with:GDI
  37. [37]
    Font Creation and Selection - Win32 apps - Microsoft Learn
    Jan 7, 2021 · The Font common dialog box simplifies the process of creating and selecting fonts. By initializing the CHOOSEFONT structure and calling the CHOOSEFONT function,
  38. [38]
    Introducing DirectWrite - Win32 apps - Microsoft Learn
    Jan 26, 2022 · This is an introduction to how DirectWrite enables Windows applications to enhance the text experience for UI and documents.Missing: DirectDraw | Show results with:DirectDraw
  39. [39]
    Microsoft introduces Windows 1.0 for the PC - History of Information
    Nov 20, 1985 · On November 20, 1985 Microsoft introduced Windows 1.0 Offsite Link for the PC. Rather than a completely new operating system, Windows 1.0 ...
  40. [40]
    How the Graphical User Interface Was Invented - IEEE Spectrum
    Throughout the 1970s and early 1980s, many of the early concepts for windows, menus, icons, and mice were arduously researched at Xerox Corp.'s Palo Alto ...
  41. [41]
    Xerox Alto Source Code - CHM - Computer History Museum
    Oct 21, 2014 · We celebrate the creators: Bob Taylor inspired PARC to invent the Alto, Chuck Thacker designed its hardware, Butler Lampson architected its software.Missing: GDI | Show results with:GDI
  42. [42]
    A Visual History: Microsoft Windows Over the Decades | PCMag
    Apr 4, 2025 · PCMag has covered Microsoft's Windows operating system from its first iteration in 1985 right up to the current, heady days of Windows 11.
  43. [43]
    A brief history of TrueType - Typography - Microsoft Learn
    Jun 10, 2020 · Microsoft first included TrueType in Windows 3.1, in April 1992. Soon afterwards, Microsoft began rewriting the TrueType rasterizer to improve ...
  44. [44]
    Display Drivers Included with Windows 95 and Supported Modes
    Colors are described in bits per pixel (bpp), the following table lists the bpp-to-colors conversion: 1bpp = Monochrome 4bpp = 16 colors 8bpp = 256 colors ...
  45. [45]
    Resource Leaks: Detecting, Locating, and Repairing Your Leaky ...
    Since Windows NT 4.0, the GDI (and USER) code has been moved from the user space to the kernel realm. Now GDI objects and data structures are in a space where ...
  46. [46]
    The History of Windows NT 4 - by Bradford Morgan White
    Sep 24, 2023 · GDI was moved to kernel mode rather than being a user mode process. This change meant that a context switch was eliminated in calling GDI ...
  47. [47]
    Print Spooler Architecture - Windows drivers | Microsoft Learn
    Dec 14, 2021 · Client-side rendering eases the print server workload, is transparent to the print driver, and is enabled by default in Windows Vista.
  48. [48]
    [PDF] Summary of Improvements over Windows 3.1
    Mar 13, 2006 · Windows 95 improves upon the MS-DOS and Windows 3.1 environment by implementing many device drivers as 32-bit protected-mode code. Virtual ...
  49. [49]
    The Desktop Window Manager - Win32 apps - Microsoft Learn
    Apr 27, 2021 · Windows Vista fundamentally changed how windows are drawn, by introducing the Desktop Window Manager (DWM). When the DWM is enabled, a ...Missing: GDI | Show results with:GDI
  50. [50]
    Windows with C++ - High-Performance Window Layering Using the ...
    Windows Vista introduced a service called the Desktop Window Manager. The ... The system allocates one such surface per top-level window and all GDI ...
  51. [51]
    Windows with C++ - Write High-DPI Apps for Windows 8.1
    Windows Vista introduced the SetProcessDPIAware function to mark the calling process as DPI-aware. This function took no arguments and simply turned on DPI ...
  52. [52]
    Microsoft ClearType - Typography
    Jun 9, 2022 · ClearType is a software technology developed by Microsoft that improves the readability of text on existing LCDs (Liquid Crystal Displays), ...Missing: Vista | Show results with:Vista
  53. [53]
    GDI Hardware Acceleration - Windows drivers | Microsoft Learn
    Dec 19, 2024 · The GDI Hardware Acceleration feature provides accelerated core graphics device interface (GDI) operations on a GPU. This feature was introduced in Windows 7.
  54. [54]
    Comparing Direct2D and GDI Hardware Acceleration - Win32 apps
    Jan 3, 2022 · Direct2D is layered on top Direct3D and GDI has its own driver model, the GDI Device Driver Interface (DDI), which corresponds to the GDI ...
  55. [55]
    WDDM 1.2 and Windows 8 - Windows drivers | Microsoft Learn
    Jul 19, 2022 · This section provides details about features and enhancements that were added in WDDM version 1.2, which is available starting with Windows 8.<|separator|>
  56. [56]
    High DPI Scaling Improvements for Desktop Applications and ...
    Oct 24, 2016 · Windows 8.1 introduced support for “Per-Monitor-DPI Awareness” to enable developers to write applications that could resize on a per-DPI basis.Missing: GDI | Show results with:GDI
  57. [57]
    KB5070762: Safe OS Dynamic out-of-band update for Windows 11 ...
    Oct 20, 2025 · KB5070762: Safe OS Dynamic out-of-band update for Windows 11, version 24H2 and 25H2, and Windows Server 2025: October 20, 2025. Applies To.
  58. [58]
    Drawn to Danger: Windows Graphics Vulnerabilities Lead to ...
    Nov 2, 2025 · ... Patch Tuesday updates in May, July, and August 2025. These are the vulnerabilities: CVE-2025-30388, rated important and considered more ...
  59. [59]
    CVE-2025-53766 Detail - NVD
    Aug 12, 2025 · CVE-2025-53766 Detail. Description. Heap-based buffer overflow in Windows GDI+ allows an unauthorized attacker to execute code over a network.
  60. [60]
  61. [61]
    Class Display Device Contexts - Win32 apps | Microsoft Learn
    Jan 7, 2021 · Applications that use class device contexts should always call BeginPaint when processing a WM_PAINT message. The function sets the correct ...Missing: screen | Show results with:screen
  62. [62]
    The WM_PAINT Message - Win32 apps - Microsoft Learn
    Jan 7, 2021 · The WM_PAINT message is sent when window content changes, prompting an application to draw the client area using BeginPaint and EndPaint.
  63. [63]
    About Painting and Drawing - Win32 apps | Microsoft Learn
    Jan 7, 2021 · The system supplies display device contexts that uniquely correspond to the windows. ... The WM_PAINT Message · Drawing Without the WM_PAINT ...
  64. [64]
    Memory Device Contexts - Win32 apps - Microsoft Learn
    Jan 7, 2021 · To create a bitmap of the appropriate dimensions, use the CreateBitmap, CreateBitmapIndirect, or CreateCompatibleBitmap function. After the ...
  65. [65]
    BitBlt function (wingdi.h) - Win32 apps - Microsoft Learn
    Oct 13, 2021 · The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device ...Missing: CreateCompatibleBitmap | Show results with:CreateCompatibleBitmap
  66. [66]
    Development Breakthroughs In Windows Presentation Foundation ...
    GDI+ offers partial transparency and anti-aliasing ... Technically, the problem is that while GDI and GDI+ are scalable, USER32 isn't. ... text capabilities ...
  67. [67]
    The Virtual Screen - Win32 apps - Microsoft Learn
    Jan 7, 2021 · Windows GDI. Ask Learn Ask Learn Focus mode. Table of contents. Read in ... The primary monitor contains the origin (0,0). This is for ...
  68. [68]
    StretchBlt function (wingdi.h) - Win32 apps - Microsoft Learn
    Oct 12, 2021 · The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the ...
  69. [69]
    ExcludeClipRect function (wingdi.h) - Win32 apps - Microsoft Learn
    Feb 22, 2024 · The ExcludeClipRect function creates a new clipping region that consists of the existing clipping region minus the specified rectangle.
  70. [70]
    How To: Print from a Windows Program - Win32 apps | Microsoft Learn
    Jan 7, 2021 · If the selected printer has a GDI-based printer driver, the program can also send the content to the printer, and the XPS Print API converts ...
  71. [71]
    Printer Escapes - Win32 apps - Microsoft Learn
    Jan 7, 2021 · GDI supports a complete set of path functions that applications can use instead of the escapes to draw paths on any device. For a list of ...
  72. [72]
    Render a Print Job - Windows drivers | Microsoft Learn
    Jan 30, 2023 · At this point, a drawing surface has been created and rendering can begin. The functions that GDI calls depend on whether banding is in effect.
  73. [73]
    [MS-WMF]: Glossary - Microsoft Learn
    Jun 24, 2021 · banding: A printing technique in which an application prints an image by dividing it into a number of bands and sending each band to the ...
  74. [74]
    GDI Printer Drivers - Windows - Microsoft Learn
    Jul 17, 2025 · All Windows 2000 and later printer drivers consist of the following components: A printer graphics DLL that assists GDI in rendering a print ...
  75. [75]
    (Win32/GDI+) Real-time rendering uses too much CPU
    Mar 19, 2023 · I am currently trying to build a win32 program that shows a constantly updating window, using GDI+. Here is the code to paint the window.
  76. [76]
    High DPI Desktop Application Development on Windows - Win32 apps
    Jul 14, 2025 · Most legacy desktop UI frameworks have built-in assumptions that the display DPI will not change during the lifetime of the process. This ...
  77. [77]
    Improving the high-DPI experience in GDI based Desktop Apps
    May 19, 2017 · In this article, we will describe the challenge presented by high DPI displays, show you several ways to configure GDI Scaling, discuss how GDI Scaling works ...
  78. [78]
    Retained Mode Versus Immediate Mode - Win32 apps
    Aug 23, 2019 · A retained-mode API is declarative. The application constructs a scene from graphics primitives, such as shapes and lines.Missing: GDI inefficiency large
  79. [79]
    Practical Tips For Boosting The Performance Of Windows Forms Apps
    When you want your control to be redrawn, you can call its Invalidate method. The entire control will be redrawn if you do not pass any arguments to this call.
  80. [80]
    How to Optimize GDI+ drawing? - HayaGeek
    Nov 17, 2023 · Another technique to optimize GDI+ drawing is to only refresh the regions that need redrawing, instead of redrawing the entire surface.
  81. [81]
    HELP!! Very Large Spooling / File Size after Data Merge
    Nov 7, 2007 · This problem occurs because Graphics Device Interface (GDI) does not compress raster data when the GDI processes EMF spool files and generates ...PDF File 1.39MB 91 pages Spools to huge size when trying to printPDF files size increasing in printer spoolerMore results from community.adobe.comMissing: complex | Show results with:complex
  82. [82]
    Microsoft Security Bulletin MS12-034 - Critical
    The vulnerability is caused by the incorrect handling of specially crafted TTF files. What is TrueType? TrueType is a digital font technology used in Microsoft ...
  83. [83]
  84. [84]
    MS10-061: Printer Spooler Vulnerability - Microsoft
    Sep 14, 2010 · This particular vulnerability is one of several used by the Stuxnet malware to escalate privilege and/or propagate across the network. When ...Missing: GDI | Show results with:GDI
  85. [85]
    PrintNightmare, Critical Windows Print Spooler Vulnerability - CISA
    Jul 2, 2021 · CISA encourages administrators to disable the Windows Print spooler service in Domain Controllers and systems that do not print. Additionally, ...Missing: GDI | Show results with:GDI<|separator|>
  86. [86]
    [PDF] The Legacy Print Spooler: A story about vulnerabilities ... - Black Hat
    This is the story of how we discovered the DoS, CVE-2020-1048 and CVE-2020-1337 vulnerabilities which we reported to Microsoft.Missing: risks | Show results with:risks
  87. [87]
    Exploit protection reference - Microsoft Defender for Endpoint
    Mar 25, 2025 · This mitigation is implemented within GDI, which validates the location of the file. ... This mitigation requires Mandatory ASLR to take effect.
  88. [88]
    Mitigate threats by using Windows 10 security features
    Dec 31, 2017 · You can use the Group Policy setting called Process Mitigation Options to control ASLR settings ("Force ASLR" and "Bottom-up ASLR"), as ...
  89. [89]
    The Current State of Exploit Development, Part 1 - CrowdStrike
    Aug 6, 2020 · Legacy Mitigation #2: ASLR/kASLR. With the addition of DEP, vulnerability researchers and adversaries quickly adopted code reuse techniques. The ...
  90. [90]
    About GDI+ - Win32 apps - Microsoft Learn
    Jan 7, 2021 · GDI+ improves on Windows Graphics Device Interface (GDI) (the graphics device interface included with earlier versions of Windows) by adding new ...
  91. [91]
    About GDI+ Managed Code - Windows Forms | Microsoft Learn
    GDI+ improves on GDI (the Graphics Device Interface included with earlier versions of Windows) by adding new features and by optimizing existing features.
  92. [92]
    What's New In GDI+? - Win32 apps | Microsoft Learn
    Jan 7, 2021 · First, GDI+ expands on the features of GDI by providing new capabilities, such as gradient brushes and alpha blending.
  93. [93]
    New Features - Win32 apps | Microsoft Learn
    Jan 7, 2021 · GDI+ expands on Windows Graphics Device Interface (GDI) by providing linear gradient and path gradient brushes for filling shapes, paths, and regions.Missing: enhancements anti- aliased
  94. [94]
    Using GDI+ - Win32 apps - Microsoft Learn
    Jan 7, 2021 · The following topics describe how to use the GDI+ API with the C++ programming language:Missing: enhancements anti- aliased JPEG PNG class
  95. [95]
    PathGradientBrush::SetTransform (gdipluspath.h) - Win32 apps
    Oct 13, 2021 · If the brush's transformation matrix is set to represent any transformation other than the identity, then the boundary path is transformed ...
  96. [96]
    Interoperability between GDI and GDI+ - Application Developer
    Dec 18, 2023 · GDI+ currently has no direct support for raster operations (ROPs), so GDI must be used directly if R2_XOR pen operations are required.Missing: backward | Show results with:backward
  97. [97]
    About Direct2D - Win32 apps - Microsoft Learn
    May 26, 2022 · 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 ...Why Direct2d? · High Performance With... · Visual Quality
  98. [98]
    Text Rendering with Direct2D and DirectWrite - Win32 apps
    Aug 19, 2020 · Sub-pixel ClearType enables an application to put glyphs on sub-pixel positions to allow for both sharp glyph rendering and glyph layout. Y ...
  99. [99]
    Optimizing Performance: 2D Graphics and Imaging - WPF
    WPF Imaging APIs have been redesigned to overcome the shortcomings of GDI and GDI+ and provide a new set of APIs to display and use images within your ...
  100. [100]
    Enhance UI with the Visual layer (Windows App SDK/WinUI 3)
    Jul 14, 2025 · The Visual layer in the Windows App SDK/WinUI 3 provides a high performance, retained-mode API for graphics, effects, animations, and input.
  101. [101]
    Graphics APIs in Windows - Win32 apps - Microsoft Learn
    Jul 8, 2024 · The primary API for programming graphics since the early days of Windows has been the Graphical Device Interface (GDI). This API was ...Missing: history | Show results with:history
  102. [102]
    Render Targets Overview - Win32 apps | Microsoft Learn
    Aug 19, 2020 · It is also possible to render using GDI on a Direct2D render target by calling QueryInterface on a render target for ID2D1GdiInteropRenderTarget ...
  103. [103]
    Direct2D and GDI Interoperability Overview - Win32 apps
    May 25, 2022 · It's possible for GDI to apply a GDI transform (through the SetWorldTransform method) or other effect to the same DC used by the render target, ...<|control11|><|separator|>