You are previewing Graphics Programming with GDI+.
O'Reilly logo
Graphics Programming with GDI+

Book Description

Graphics Programming with GDI+ explores and exploits a wonderful range of GDI+ programming concepts, techniques, and applications for programmers of beginner to intermediate abilities. Being a prolific contributor to the Internet community of developers, Mahesh Chand is offering what seems to be a natural extension of what he does best—sharing his programming skills with other talented programmers. Each chapter compels to the next.”

         —Jason Hattingh, Director, Greystone Digital FX

“Mahesh does a very good job getting .NET developers up to speed using the GDI+ features supported in the .NET Framework. There is good coverage of graphics fundamentals that helps the reader better understand the concepts of graphics programming with GDI+, and there are some excellent sample applications that demonstrate the graphics topics covered to reinforce the concepts presented.”

         —Charles G. Parker, President, Parallel Consulting, Inc.

Graphics Programming with GDI+ is a comprehensive reference for anyone who wants to leverage this technology. It presents a clear discussion of the topics in such a manner that is comprehensible to the beginner, but sufficiently in-depth to challenge seasoned programmers.”

         —Deborah J. Bechtold, MCSD, MCDBA

"This is the most comprehensive book about graphics programming using GDI+ so far. This book will be a very useful handbook for everyone who does graphics programming for Windows."

         —Min Liu, Software Design Engineer of GDI+, Microsoft Corporation

Graphics Programming with GDI+ is the .NET developer's guide to writing graphics applications for Windows and the Web. Through the use of detailed examples it provides experienced programmers with a deep understanding of the entire GDI+ API defined in the .NET Framework class library.

The book begins with an introduction to GDI+ and the basics of graphics programming in Windows. The core of the book is a hands-on guide to practical topics, including how to use Windows Forms and optimize GDI+ performance. Chapters demonstrate how to develop real-world tools such as GDI+Painter, GDI+Editor, ImageViewer, and ImageAnimator. The author provides extensive reusable sample code in C# throughout, and complete downloadable source code in C# and Visual Basic .NET is available online, as are color versions of screen shots from the book.

Key topics include:

  • How GDI+ compares to GDI

  • How GDI+ is defined and used in the .NET Framework

  • How to draw, paint, and fill graphics objects

  • Viewing and manipulating images

  • Transforming graphics objects, images, and colors

  • Printing in .NET

  • How to develop GDI+ Web applications

  • How to optimize drawing quality and performance

  • Interactive color blending and transparent colors

  • GDI interoperability

  • Answers to frequently asked GDI+ questions

  • Graphics Programming in GDI+ is the most in-depth treatment available on writing effective graphics applications for the .NET Framework.

    Table of Contents

    1. Copyright
    2. Praise for Graphics Programming with GDI+
    3. Microsoft .NET Development Series
    4. Figures
    5. Tables
    6. Acknowledgments
    7. Introduction
    8. GDI+: The Next-Generation Graphics Interface
      1. Understanding GDI+
      2. Exploring GDI+ Functionality
      3. GDI+ from a GDI Perspective
      4. GDI+ Namespaces and Classes in .NET
      5. Summary
    9. Your First GDI+ Application
      1. Drawing Surfaces
      2. The Coordinate System
      3. Tutorial: Your First GDI+ Application
      4. Some Basic GDI+ Objects
      5. Summary
    10. The Graphics Class
      1. Graphics Class Properties
      2. Graphics Class Methods
      3. The GDI+Painter Application
      4. Drawing a Pie Chart
      5. Summary
    11. Working with Brushes and Pens
      1. Understanding and Using Brushes
      2. Using Pens in GDI+
      3. Transformation with Pens
      4. Transformation with Brushes
      5. System Pens and System Brushes
      6. A Real-World Example: Adding Colors, Pens, and Brushes to the GDI+Painter Application
      7. Summary
    12. Colors, Fonts, and Text
      1. Accessing the Graphics Object
      2. Working with Colors
      3. Working with Fonts
      4. Working with Text and Strings
      5. Rendering Text with Quality and Performance
      6. Advanced Typography
      7. A Simple Text Editor
      8. Transforming Text
      9. Summary
    13. Rectangles and Regions
      1. The Rectangle Structure
      2. The Region Class
      3. Regions and Clipping
      4. Clipping Regions Example
      5. Regions, Nonrectangular Forms, and Controls
      6. Summary
    14. Working with Images
      1. Raster and Vector Images
      2. Working with Images
      3. Manipulating Images
      4. Playing Animations in GDI+
      5. Working with Bitmaps
      6. Working with Icons
      7. Skewing Images
      8. Drawing Transparent Graphics Objects
      9. Viewing Multiple Images
      10. Using a Picture Box to View Images
      11. Saving Images with Different Sizes
      12. Summary
    15. Advanced Imaging
      1. Rendering Partial Bitmaps
      2. Working with Metafiles
      3. Color Mapping Using Color Objects
      4. Image Attributes and the ImageAttributes Class
      5. Encoder Parameters and Image Formats
      6. Summary
    16. Advanced 2D Graphics
      1. Line Caps and Line Styles
      2. Understanding and Using Graphics Paths
      3. Graphics Containers
      4. Reading Metadata of Images
      5. Blending Explained
      6. Alpha Blending
      7. Miscellaneous Advanced 2D Topics
      8. Summary
    17. Transformation
      1. Coordinate Systems
      2. Transformation Types
      3. The Matrix Class and Transformation
      4. The Graphics Class and Transformation
      5. Global, Local, and Composite Transformations
      6. Image Transformation
      7. Color Transformation and the Color Matrix
      8. Matrix Operations in Image Processing
      9. Text Transformation
      10. The Significance of Transformation Order
      11. Summary
    18. Printing
      1. A Brief History of Printing with Microsoft Windows
      2. Overview of the Printing Process
      3. Your First Printing Application
      4. Printer Settings
      5. The PrintDocument and Print Events
      6. Printing Text
      7. Printing Graphics
      8. Print Dialogs
      9. Customizing Page Settings
      10. Printing Multiple Pages
      11. Marginal Printing: A Caution
      12. Getting into the Details: Custom Controlling and the Print Controller
      13. Summary
    19. Developing GDI+ Web Applications
      1. Creating Your First ASP.NET Web Application
      2. Your First Graphics Web Application
      3. Drawing Simple Graphics
      4. Drawing Images on the Web
      5. Drawing a Line Chart
      6. Drawing a Pie Chart
      7. Summary
    20. GDI+ Best Practices and Performance Techniques
      1. Understanding the Rendering Process
      2. Double Buffering and Flicker-Free Drawing
      3. Understanding the SetStyle Method
      4. The Quality and Performance of Drawing
      5. Summary
    21. GDI Interoperability
      1. Using GDI in the Managed Environment
      2. Cautions for Using GDI in Managed Code
      3. Summary
    22. Miscellaneous GDI+ Examples
      1. Designing Interactive GUI Applications
      2. Drawing Shaped Forms and Windows Controls
      3. Adding Copyright Information to a Drawn Image
      4. Reading and Writing Images to and from a Stream or Database
      5. Creating Owner-Drawn List Controls
      6. Summary
    23. Exception Handling in .NET
      1. Why Exception Handling?
      2. Understanding the try...catch Block
      3. Understanding Exception Classes
      4. Summary