ArticleslgStudy

science

Graphics Device Interface

Graphics Device Interface is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Graphics Device Interface rather than just read about it. In short: 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.

Graphics Device Interface — main illustration
Graphics Device Interface — illustration

Key takeaways

  • Graphics Device Interface belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Graphics Device Interface to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Graphics Device Interface from memory before moving on to harder problems.

Reference excerpt

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. Windows apps use Windows API to interact with GDI, for such tasks as drawing lines and curves, rendering fonts, and handling palettes. The Windows USER subsystem uses GDI to render such UI elements as window frames and menus. Other systems have components that are similar to GDI; for example: Mac OS had QuickDraw, and Linux and Unix have X Window System core protocol. GDI's most significant advantages over more direct methods of accessing the hardware are perhaps its scaling capabilities and its abstract representation of target devices. Using GDI, it is possible 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 most "What You See Is What You Get" applications for Microsoft Windows. Simple games that do not require fast graphics rendering may use GDI. However, GDI is relatively hard to use for advanced animation, lacks a notion for synchronizing with individual video frames in the video card, and lacks hardware rasterization for 3D. Modern games usually use Direct3D, Vulkan, or OpenGL instead.

Technical details In GDI, a device context (DC) defines the attributes of text and images for the output device, e.g. screen or printer. GDI maintains the actual context. Generating the output requires a handle to the device context (HDC). After generating the output, the handle could be released. GDI uses Bresenham's line drawing algorithm to draw aliased lines and curves.

Version history

Early versions GDI was present in the initial release of Windows. MS-DOS programs had manipulated the graphics hardware using software interrupts (sometimes via the video BIOS) and by manipulating video memory directly. Code written in this way expects that it is the only user of the video memory, which was not tenable in a multitasking environment, such as Windows. BYTE magazine, in December 1983, discussed Microsoft's plans for a system to output graphics to both printers and monitors with the same code in the forthcoming first release of Windows. On Windows 3.1x and Windows 9x, GDI can use bit blit features for 2D acceleration, if a suitable graphics card driver is installed. Since Windows NT 4.0, the GDI of Windows NT was running in kernel mode; but since Windows Vista, the DWM runs in user mode.

Windows XP With the introduction of Windows XP, GDI+ complemented GDI. GDI+ was written in C++. It 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 RGBA values to represent color. Use of these features is apparent in Windows XP components, such as Microsoft Paint, Windows Picture and Fax Viewer, Photo Printing Wizard, and the My Pictures Slideshow screensaver. Their presence in the basic graphics layer greatly simplifies implementations of vector-graphics systems such as Adobe Flash or SVG. Besides, .NET Framework provides a managed interface for GDI+ via the System.Drawing namespace. While GDI+ is included with Windows XP and later, the GDI+ dynamic library can also be shipped with an application and used on older versions of Windows. Because of the additional text processing and resolution independence capabilities in GDI+, the CPU undertakes text rendering. The result is an order of magnitude slower than the hardware-accelerated GDI. Chris Jackson published some tests indicating that a piece of text rendering code he had written could render 99,000 glyphs per second in GDI, but the same code using GDI+ rendered 16,600 glyphs per second. GDI+ is similar (in purpose and structure) to Apple's QuickDraw GX subsystem, and the open-source libart and cairo libraries.

Windows Vista In Windows Vista, all Windows applications including GDI and GDI+ applications run in the new compositing engine, Desktop Window Manager (DWM), which is GPU hardware-accelerated. As such, the GDI itself is no longer hardware-accelerated. Because of the nature of the composition operations, window moves can be faster or more responsive because the application does not need to re-render the underlying content.

Windows 7 Windows 7 includes GDI hardware acceleration for blitting operations in the Windows Display Driver Model v1.1. This improves GDI performance and allows DWM to use local video memory for compositing, thereby reducing system memory footprint and increasing the performance of graphics operations. Most primitive GDI operations are still not hardware-accelerated, unlike Direct2D. GDI+ continues to rely on software rendering in Windows 7.

GDI printers A GDI printer or Winprinter (analogous to a Winmodem) is a printer designed to accept output from a host computer running Windows, which does all print processing: GDI renders a page as a bitmap, which the computer's printer driver receives, processes, and sends to the associated printer. Communication between the computer's GDI and driver, and the printer, is bidirectional; the printer tells the computer if it is ready to print or offline, out of paper, and so on. A printer with its own control language can accept input from any device with a suitable driver, without requiring a PC running Windows. Such a printer requires hardware, firmware, and memory for the page rendering that the Windows host computer's GDI otherwise carries out. GDI printers can be made available to computers on a network if they are connected as shared printers on a computer running Windows. Some "generic" GDI drivers such as pnm2ppa have been written; they aim to make GDI printers compatible with non-Windows operating systems such as FreeBSD, but they cannot support all printers. To allow simpler generation of drivers for Winprinters, Microsoft developed the Universal Printer Driver. This allows printer vendors to write Generic Printer Description (GPD) "minidrivers" which describe the printer's capabilities and command set in plaintext without requiring kernel mode programming. Microsoft has moved away from the GDI printing model with Open XML Paper Specification.

… excerpt ends here. Continue reading the full article.

Illustrations

Graphics Device Interface: The Graphics Device Interface in the architecture of Windows NT
The Graphics Device Interface in the architecture of Windows NT
Graphics Device Interface: GDI as one of the backends in GDK
GDI as one of the backends in GDK

Worked examples

Example 1 — a first encounter with Graphics Device Interface

Start with the simplest possible case. Write down what Graphics Device Interface claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Graphics Device Interface before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Graphics Device Interface ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Graphics Device Interface

In research
Graphics Device Interface appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Graphics Device Interface in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Graphics Device Interface is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graphics libraries, Microsoft application programming interfaces, Printing technology, so understanding it makes those chapters shorter.
In everyday life
Look for Graphics Device Interface outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Graphics Device Interface” →

How to study Graphics Device Interface in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Graphics Device Interface means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Graphics Device Interface out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Graphics Device Interface in simple terms?

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.

Why does Graphics Device Interface matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Graphics Device Interface?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Graphics Device Interface.

Tags

  • Graphics libraries
  • Microsoft application programming interfaces
  • Printing technology
  • Text rendering libraries
  • Windows components

Keep exploring