Exploring GDI+ Functionality

Microsoft's managed GDI+ documentation divides its functionality into three categories: 2D vector graphics, imaging, and typography. This book divides the GDI+ functionality into five categories:

  1. 2D vector graphics
  2. Imaging
  3. Typography
  4. Printing
  5. Design

1.2.1 2D Vector Graphics Programming

Vector graphics concerns the drawing of shapes that can be specified by sets of points on a coordinate system. Such shapes are called primitives; examples include lines, curves, rectangles, and paths. In managed GDI+, a class object or structure represents a graphics primitive. Each class or structure provides members that can be used to get and set a primitive's properties. For example, the Point structure provides X and Y properties that represent the x- and y-coordinate values of a point. The Point structure also provides methods, including Ceiling, Round, and Truncate. We will discuss these methods in more detail in Chapter 2.

In the .NET Framework library, 2D vector programming is divided into two categories: general and advanced. General 2D vector graphics programming functionality is defined in the System.Drawing namespace; advanced functionality is defined in the System.Drawing.Drawing2D namespace.

The major 2D vector programming classes defined in the System.Drawing namespace are Pen, Pens, Brush (and Brush-derived classes), Brushes, Font (and Font-related classes), Point, Rectangle, and Size. We will discuss these classes and their members in more detail in other chapters according to how they are categorized.

The System.Drawing.Drawing2D namespace provides blending, color blending, graphics paths, custom line caps, hatch and linear gradient brushes, and matrices. We will discuss these classes and their members in more detail in Chapter 9.

1.2.2 Imaging

Imaging involves viewing and manipulating images. In managed GDI+, imaging functionality is divided into two categories: basic and advanced. The basic functionality is defined in the Image class, which also serves as the base class of the Bitmap and Metafile classes. The Image class provides members to load, create, and save images.

The Bitmap and Metafile classes define functionality for displaying, manipulating, and saving bitmaps and metafiles. Chapters 7 and 8 cover imaging functionality in more detail.

1.2.3 Typography

Typography refers to the design and appearance of text. GDI+ provides classes to create and use fonts. Some of the font-related classes are Font, FontFamily, and FontConverter. GDI+ also provides classes to read all installed fonts on a system. You can also add custom fonts to the font collection. We will cover the capabilities of GDI+ with respect to fonts and typography in Chapter 5.

1.2.4 Printing

GDI+ provides easy-to-use classes that encapsulate Windows printing functionality. The printing classes defined in the .NET Framework class library provide access to and control over available printers, printer sources, paper and paper sources, pages, printer resolution, and so on. GDI+ printing functionality is defined in the System.Drawing.Printing namespace. Chapter 11 is dedicated to printing functionality.

1.2.5 Design

The GDI+ class library also provides classes that extend design-time user interface (UI) logic and drawing functionality. These classes are defined in the System.Drawing.Design namespace. Examples of extended UI functionality include creating custom toolbox items, type-specific value editors, and type converters.

Категории