Overview of the Technology

GDI+ is a graphics device interface library that ships with Microsoft Windows XP and Microsoft Windows .NET Server. GDI+ includes impressive support for two-dimensional (2D) graphics and imaging, and optimal support for text and fonts.

GDI+ is the successor to GDI, the graphics device interface included with earlier versions of Windows. While Windows XP and Windows .NET Server continue to support GDI for compatibility with existing applications, if you are writing new applications, you should take advantage of the additional features and improved programming mode that GDI+ offers, as examined in the next section.

As was true for GDI, one of the many benefits of using GDI+ is that it insulates the application from the graphics hardware, thus allowing you to draw objects to the screen or printer without having to concern yourself about the details behind different device technologies. GDI+ application programming interfaces (APIs) are exposed through a set of C++ classes and as part of the Microsoft .NET Framework.

What's New in GDI+?


  • Linear gradient brush: Can be horizontal or vertical. For example, a horizontal gradient brush can be configured to change color as you move from the left side of a figure to the right side.
  • Path gradient brush: A path gradient brush can be configured to change color as you move from the center of a figure toward the boundary.
  • Cardinal splines: A sequence of individual curves joined to form a larger curve.

As stated, GDI+ has many capabilities that GDI does not offer. In 2D graphics, for instance, GDI+ expands GDI support by providing linear gradient and path gradient brushes for filling shapes, paths, and regions. Brushes can also be used to draw lines, curves, and paths. In addition, GDI+ provides support for scalable regions, alpha blending, cardinal splines, and transformations. Furthermore, GDI+ supports multiple image formats-including .bmp, .png, .gif, and .png-which allows you to load, save, and manipulate different types of images.

There have been significant improvements to text and font support since GDI. For example, GDI+ supports resolution-independent layout, guaranteeing that text layout and line breaks will not change as the output-device resolution changes, a common pitfall when using GDI. You are probably familiar with this problem if you ever used GDI to draw text to devices that have different resolutions, such as to screens and printers. As the application switches between output devices with different resolutions, there is a greater chance of clipping because paragaraphs get longer as the line-breaking positions change.

Even if you are writing a user interface (UI) widget (such as a drop-down menu) that works only on the screen and you never need to deal with a printer, you will still benefit enormously from GDI+ resolution-independence. Higher-resolution screens of 150 to 200 dots per inch (DPI) are just around the corner. With the resolution-independent layout that GDI+ provides, you'll be ready for this change.

GDI+ incorporates a cleaner and much improved font management architecture that allows side-by-side installation of the same font by using private font collections. In addition, GDI+ supports many new scripts like Gujarati, Gurmukhi, Kannada, and Syriac.

Programming Model

Core to the GDI+ programming model is the concept of a graphics surface, represented by the Graphics class. The Graphics classplays a similar role to the GDI device context. This class represents both the capabilities of a particular output device and the attributes that specify how items will be drawn on that output device, whether it is a screen or a printer. The main difference in the programming model between a GDI device context and GDI+ Graphics objects is that Graphics objects are not tied to a font, pen, brush, path, or image. As a result, Graphics has no SelectObject method to select a font in the device.

Microsoft Corporation - Developing International Software
Developing International Software
ISBN: 0735615837
EAN: 2147483647
Year: 2003
Pages: 198

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net