Lably
Skip to content

Graphics Device Interface

Microsoft Windows API

  • 6 min read
  • 5 chapters

Related on Lably

Through Microsoft Windows, Output device and Printer (computing)

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 a modified Bresenham's line drawing algorithm to draw aliased lines and curves, that does not round to the nearest integer.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication