Graphics Device Interface

related topics
{system, computer, user}
{math, number, function}

The Graphics Device Interface (GDI) 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 is responsible for tasks such as drawing lines and curves, rendering fonts and handling palettes. It is not directly responsible for drawing windows, menus, etc.; that task is reserved for the user subsystem, which resides in user32.dll and is built atop GDI. Other systems have components which are similar to GDI, for example Macintosh's QuickDraw and Gnome/GTK's GDK/Xlib.

Perhaps the most significant capability of GDI over more direct methods of accessing the hardware is its scaling capabilities, and abstraction of target devices. Using GDI, it is very easy to draw on multiple devices, such as a screen and a printer, and expect proper reproduction in each case. This capability is at the center of all What You See Is What You Get applications for Microsoft Windows.

Simple games which do not require fast graphics rendering use GDI. However, GDI cannot animate properly as it has no notion of synchronizing with the framebuffer, and lacks rasterization for 3D. Modern games usually use DirectX or OpenGL instead, which give programmers the capabilities to use features of modern hardware.

Contents

Technical details

A Device Context (DC) is used to define the attributes of text and images that are output to the screen or printer. The actual context is maintained by GDI. A handle to the Device Context (HDC) is obtained before output is written and then released after elements have been written.

A DC, like most GDI objects, is opaque - its data cannot be accessed directly, but its handle can be passed to various GDI functions that will operate on it, either to draw an object, to retrieve information about it, or to change the object in some way.

Version history

Windows XP

With the introduction of Windows XP, GDI was deprecated in favor of its successor, the C++ based GDI+ subsystem. GDI+ adds anti-aliased 2D graphics, floating point coordinates, gradient shading, more complex path management, intrinsic support for modern graphics-file formats like JPEG and PNG, and support for composition of affine transformations in the 2D view pipeline. GDI+ uses ARGB values to represent color. Use of these features is apparent in Windows XP's user interface and several of its applications such as Microsoft Paint, Windows Picture and Fax Viewer, Photo Printing Wizard, My Pictures Slideshow screensaver, and their presence in the basic graphics layer greatly simplifies implementations of vector-graphics systems such as Flash or SVG.

Full article ▸

related documents
Digital signal
Telnet
Middleware
PDP-1
File viewer
Intel 8086
Client-server
Traceroute
Protocol data unit
Audio file format
Demodulation
JFS (file system)
Lotus Symphony
Wireless network
Plesiochronous Digital Hierarchy
AutoCAD
Real Time Streaming Protocol
Protocol stack
Ringdown
Routing table
BNC connector
Multitier architecture
OpenSSH
FIFO
Wide area network
Wine (software)
Broadband
Jupiter Ace
Motorola 6809
Streaming media