Home > Store

Graphics Programming with GDI+

Register your product to gain access to bonus material or receive a coupon.

Graphics Programming with GDI+

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

The most comprehensive and in-depth coverage of GDI+ available!

° All Windows programmers developing applications that deal with graphics, monitors, or printers need to use GDI+.

° There is little documentation available on GDI+. There are only two books on the market, and they are both introductory.

° The author uses real world examples and extensive sample code.

Description

  • Copyright 2004
  • Edition: 1st
  • Premium Website
  • ISBN-10: 0-321-16077-0
  • ISBN-13: 978-0-321-16077-5

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.



Downloads

Source Code

Untitled Document Source code for Graphics Programming with GDI+ is available on the author's web site

Supplements

Color Figures

Download the Color Figures PDF related to this title. The File Size is 5.6MB

Extras

Author's Site

Click for the Author's Web Site related to this title.

Sample Content

Online Sample Chapter

GDI+ Graphics Transformation

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents



Figures.


Tables.


Acknowledgments.


Introduction.


1. GDI+: The Next-Generation Graphics Interface.

Understanding GDI+.

Definition.

What Is GDI+?

The GDI+ Library in the .NET Framework.

What's New in GDI+ for GDI Programmers?

Exploring GDI+ Functionality.

2D Vector Graphics Programming.

Imaging.

Typography.

Printing.

Design.

GDI+ from a GDI Perspective.

Elimination of Handles and Device Contexts.

Object-Oriented Approach.

Graphics Object Independence.

Method Overloading.

Draw and Fill Methods.

Regions and Their Styles.

GDI+ Namespaces and Classes in .NET.

The System.Drawing Namespace.

The System.Drawing.Design Namespace.

The System.Drawing.Drawing2D Namespace.

The System.Drawing.Imaging Namespace.

The System.Drawing.Printing Namespace.

The System.Drawing.Text Namespace.

Summary.



2. Your First GDI+ Application.

Drawing Surfaces.

Forms as a Surface.

Printers as a Surface.

Bitmaps as a Surface.

The Coordinate System.

The Cartesian Coordinate System.

The Default GDI+ Coordinate System.

Tutorial: Your First GDI+ Application.

Creating a Windows Application.

Adding a Reference to GDI+.

Getting a Graphics Object in an Application.

Creating Pens and Brushes.

Drawing Graphics Shapes.

Releasing Objects.

Building and Running the Application.

Some Basic GDI+ Objects.

The Color Structure.

The Point and PointF Structures.

The Rectangle and RectangleF Structures.

The Size and SizeF Structures.

Summary.



3. The Graphics Class.

Graphics Class Properties.

Graphics Class Methods.

Draw Methods.

Fill Methods.

Miscellaneous Graphics Class Methods.

The GDI+Painter Application.

Drawing a Pie Chart.

Summary.



4. Working with Brushes and Pens.

Understanding and Using Brushes.

The Brush Class.

The Brushes Class.

Solid Brushes.

Hatch Brushes.

Texture Brushes.

Gradient Brushes.

Using Pens in GDI+.

Creating Pens.

Pen Class Properties and Methods.

Pen Types.

Pens Example.

Pen Alignment.

LineCap, DashCap, and DashStyle.

Drawing Other Graphics Shapes by Applying Cap and Dashed Line Styles.

Transformation with Pens.

Transformation with Brushes.

System Pens and System Brushes.

System Pens.

System Brushes.

A Real-World Example: Adding Colors, Pens, and Brushes to the GDI+Painter Application.

Improvements in GDI+Painter.

Summary.



5. Colors, Fonts, and Text.

Accessing the Graphics Object.

Working with Colors.

Color Spaces.

The Color Structure.

System Colors.

The ColorConverter and ColorTranslator Classes.

Working with Fonts.

Font Types in Windows.

Fonts in .NET.

The FontStyle Enumeration.

The FontFamily Class.

The GraphicsUnit Enumeration.

The Font Class.

Constructing a Font Object.

Working with Text and Strings.

Drawing Formatted Text.

Using Tab Stops.

The FormatFlags Property.

Setting Digital Substitution.

Rendering Text with Quality and Performance.

Advanced Typography.

Getting All Installed Fonts on a System.

Private Font Collection.

A Simple Text Editor.

Transforming Text.

Summary.



6. Rectangles and Regions.

The Rectangle Structure.

Constructing a Rectangle Object.

Constructing a RectangleF Object.

Rectangle Properties and Methods.

The Region Class.

Constructing a Region Object.

The Complement, Exclude, and Union Methods.

The Xor and Intersect Methods.

GetBounds and Other Methods.

Regions and Clipping.

Clipping Regions Example.

Regions, Nonrectangular Forms, and Controls.

The Application.

Coding.

Summary.



7. Working with Images.

Raster and Vector Images.

Raster Image Formats.

Graphics File Formats.

Working with Images.

An Image Viewer Application.

Creating an Image Object.

Drawing an Image.

Saving Images.

Retrieving Image Properties.

Manipulating Images.

Creating a Thumbnail of an Image.

Rotating and Flipping Images.

Adding Rotate and Flip Options to the Image Viewer.

Fitting Images.

Zooming In and Out.

Playing Animations in GDI+.

Working with Bitmaps.

Creating a Bitmap Object.

Viewing a Bitmap.

The Bitmap Class Methods and Properties.

Working with Icons.

Skewing Images.

Drawing Transparent Graphics Objects.

Viewing Multiple Images.

Using a Picture Box to View Images.

Saving Images with Different Sizes.

Summary.



8. Advanced Imaging.

Rendering Partial Bitmaps.

Drawing Grayscale or Other Color Images.

Using BitmapData to Change Pixel Format.

Working with Metafiles.

Metafile Class Method.

Creating Metafiles Programmatically.

Enhanced Metafiles.

How Metafiles Work.

Reading a Metafile Header.

Color Mapping Using Color Objects.

The Color Remap Table.

The Color Matrix.

The Color Palette.

Image Attributes and the ImageAttributes Class.

The SetWrapMode Method.

The SetGamma Method.

The SetColorMatrix Method.

The SetNoOp and SetColorKey Methods.

The SetThreshold Method.

The SetBrushRemapTable Method.

The Clear Methods.

Encoder Parameters and Image Formats.

The Encoder, EncoderCollection, and Image Relationship.

The Encoder and EncoderParameter Classes.

Retrieving Information from Digital Images or Tagged Data of TIFF Files.

Converting a Bitmap to Other Formats.

Summary.



9. Advanced 2D Graphics.

Line Caps and Line Styles 9.1.1 Line Caps and Styles Specified by the Pen Class.

Adding Line Caps and Styles.

Getting and Setting Line Caps and Styles.

Drawing Other Objects with Line Caps and Styles.

Customizing Line Caps.

Understanding and Using Graphics Paths.

Creating a GraphicsPath Object.

Shaped Forms and Graphics Paths.

GraphicsPath Properties and Methods.

Subpaths.

The Graphics Path Iterator.

Graphics Containers.

Understanding Graphics States.

Saving and Restoring Graphics States.

Working with Graphics Containers.

Reading Metadata of Images.

Blending Explained.

Color Blending.

Blending Using LinearGradientBrush Objects.

Adding Multicolor Support to Gradients.

Using Gamma Correction in Linear Gradient Brushes.

Blending Using PathGradientBrush Objects.

Alpha Blending.

Brushes, Pens, and Alpha Blending.

Alpha Blending and Images.

Compositing Mode and Blending.

Mixed Blending.

Miscellaneous Advanced 2D Topics.

Region Data.

The SmoothingMode and PixelOffsetMode Enumerations.

Summary.



10. Transformation.

Coordinate Systems.

Transformation Types.

The Matrix Class and Transformation.

The Graphics Class and Transformation.

Global, Local, and Composite Transformations.

Image Transformation.

Color Transformation and the Color Matrix.

The ColorMatrix Class.

Matrix Operations in Image Processing.

Translating Colors.

Scaling Colors.

Shearing Colors.

Rotating Colors.

Text Transformation.

The Significance of Transformation Order.

Summary.



11. Printing.

A Brief History of Printing with Microsoft Windows.

Hewlett-Packard Chooses Standards.

Overview of the Printing Process.

How Is Drawing Different from Printing?

Conceptual Flow of the Printing Process.

Programmatic Flow of the Printing Process.

The System.Drawing.Printing Namespace.

Your First Printing Application.

Printer Settings.

The PrinterSettings Class.

The PaperSize Class.

The PaperSource Class.

The PrinterResolutionKind Enumeration.

PrinterSettings Collection Classes.

A Printer Settings Example.

The PrintDocument and Print Events.

Understanding Print Events.

Printing Text.

Printing Graphics.

Printing Graphics Items.

Printing Images.

Print Dialogs.

The PrintDialog Control.

The PageSetupDialog Control.

The PrintPreviewDialog Control.

Print Dialogs in Action.

Customizing Page Settings.

The PageSettings Class.

Page Margins.

Creating a Custom Paper Size.

The PaperKind Enumeration.

The PaperSourceKind Enumeration.

Page Settings in Action.

The PrintRange Enumeration.

Printing Multiple Pages.

The DocumentName Property.

Marginal Printing: A Caution.

Getting into the Details: Custom Controlling and the Print Controller.

Summary.



12. Developing GDI+ Web Applications.

Creating Your First ASP.NET Web Application.

Creating a Web Application Project.

Adding Web Controls to a Web Form.

Writing Code on the Button Click Event Handler.

Your First Graphics Web Application.

How Does It Work?

Understanding the Save Method.

Drawing Simple Graphics.

Drawing Images on the Web.

Setting Image Quality.

Using LinearGradientBrush and PathGradientBrussh.

Drawing Transparent Graphics Objects.

Drawing a Line Chart.

The ChartComp Component.

The Client Application.

Drawing a Pie Chart.

Summary.



13. GDI+ Best Practices and Performance Techniques.

Understanding the Rendering Process.

Understanding the Paint Event.

Adding a Paint Event Handler to a Form.

Adding a Paint Event Handler to Windows Controls.

Overriding the OnPaint Method of a Form.

Using VS.NET to Add the Paint Event Handler.

Disposing of Graphics Objects.

The OnPaintBackground Method.

Scope and Type of Variables and Performance.

Double Buffering and Flicker-Free Drawing.

Understanding the SetStyle Method.

The Quality and Performance of Drawing.

Repaint Only the Required Area.

Use Graphics Paths.

Select Methods Carefully.

Avoid Using Frequently Called Events.

Use System Brushes and Pens.

Avoid Automatic Scaling of Images.

Summary.



14. GDI Interoperability.

Using GDI in the Managed Environment.

The DllImportAttribute Class.

Using the BitBlt Function.

Using GDI Print Functionality.

Cautions for Using GDI in Managed Code.

No GDI Calls between GetHdc and ReleaseHdc.

Using GDI on a GDI+ Graphics Object Backed by a Bitmap.

Summary.



15. Miscellaneous GDI+ Examples.

Designing Interactive GUI Applications.

Understanding the Control Class.

The Application.

Drawing Transparent Controls.

Drawing Shaped Forms and Windows Controls.

Adding Copyright Information to a Drawn Image.

Reading and Writing Images to and from a Stream or Database.

Creating Owner-Drawn List Controls.

The DrawItem Event.

The MeasureItem Event.

Owner-Drawn ListBox Controls.

An Owner-Drawn Image ListBox Control.

Summary.



Appendix A: Exception Handling in .NET.

Why Exception Handling?

Understanding the try…catch Block.

The try…catch Statement.

The try…catch…finally Statement.

Nested try…catch Statements.

Multiple catch Statements with a Single try Statement.

Understanding Exception Classes.

The Exception Class: Mother of All Exceptions.

Other Exception Classes.

Summary.



Index. 0321160770T10142003

Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership