Featured Posts

An Introduction to GDI

Posted by admin | Posted in Theory Subjects, Visual Programming | Posted on 24-10-2009

0

Graphics Device Interface (GDI) functions is used to paint the client area of your window. Windows provides several GDI functions for writing text strings to the client area of the window. The most commonly used text output function is undoubtedly TextOut. This function has the following format:

TextOut (hdc, x, y, psText, iLength) ;

Explanatation:

TextOut writes a character string to the client area of the window.
hdc argument is a “handle to a device context,” and it is an important part of GDI. Virtually every GDI function requires this handle as the first argument to the function.
x and y arguments define the starting position of the character string in the client area.
The psText argument is a pointer to the character string.
iLength is the length of the string in characters.

More About GDI:(Wiki)

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. GDI is similar to Macintosh’s QuickDraw.

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 (no notion of synchronizing with the framebuffer) and lacks rasterization for 3D. Modern games tend to use DirectX or OpenGL, which give programmers the capabilities to use features of modern hardware.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Post a comment

You must be logged in to post a comment.