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

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020