In Chapter 9 we delved into advanced 2D graphics programming. In this chapter we will explore GDI+ transformations. A transformation is a process that changes graphics objects from one state to another. Rotation, scaling, reflection, translation, and shearing are some examples of transformation. Transformations can be applied not only to graphics shapes, curves, and images, but even to image colors.

In this chapter we will cover the following topics:

  • The basics of transformation, including coordinate systems and matrices
  • Global, local, and composite transformations
  • Transformation functionality provided by the Graphics class
  • Transformation concepts such as shearing, rotation, scaling, and translation
  • The Matrix and ColorMatrix classes, and their role in transformation
  • Matrix operations in image processing, including rotation, translation, shearing, and scaling
  • Color transformation and recoloring
  • Text transformation
  • Composite transformations and the matrix order

Any drawing process involves a source and a destination. The source of a drawing is the application that created it, and the destination is a display or printer device. For example, the process of drawing a simple rectangle starts with a command telling GDI+ to draw on the screen, followed by GDI+ iterating through multiple steps before it finally renders a rectangle on the screen. In the same way, transformation involves some steps before it actually renders the transformed object on a device. These steps are shown in Figure 10.1, which shows that GDI+ is responsible for converting world coordinates to page coordinates and device coordinates before it can render a transformed object.

Figure 10.1. Steps in the transformation process


GDI+: The Next-Generation Graphics Interface

Your First GDI+ Application

The Graphics Class

Working with Brushes and Pens

Colors, Fonts, and Text

Rectangles and Regions

Working with Images

Advanced Imaging

Advanced 2D Graphics



Developing GDI+ Web Applications

GDI+ Best Practices and Performance Techniques

GDI Interoperability

Miscellaneous GDI+ Examples

Appendix A. Exception Handling in .NET

show all menu

GDI+ Programming with C#
GDI+ Programming with C#
ISBN: 073561265X
Year: 2003
Pages: 145 © 2008-2017.
If you may any questions please contact us: