Chapter 5. Creating Images
In This Chapter
Understanding the
System.Drawing
namespaceFinding out how the drawing classes fit into the .NET Framework
Using
System.Drawing
to create a simple game application
No one is going to write the next edition of Bioshock using C#. It just isn't the kind of language you use to write graphics-intensive applications like shoot-'em-up games.
Still, C# packs a fair amount of power into the System.Drawing
classes. Though these classes are somewhat primitive in some areas, and using them might cause you to have to write a few more lines of code than you should, there isn't much that these classes can't do with sufficient work.
The drawing capability provided by the .NET Framework is divided into four logical areas by the namespace design provided by Microsoft. All the general drawing capability is in the System.Drawing
namespace. Then there are some specialized namespaces:
System.Drawing.2D
has advanced vector drawing functionality.System.Drawing.Imaging
is mostly about using bitmap graphic formats, like.bmp
and.jpg
files.System.Drawing.Text
deals with advanced typography.
In this chapter, I focus on the base namespace and cover only the basics of drawing in C#. (Discussing every aspect of drawing could easily fill an entire book.)
Getting to Know System.Drawing
Even at the highest level, graphics programming consists of drawing polygons, filling them with color, and labeling them with text — all on a canvas of some sort. Unsurprisingly, this leaves you ...
Get C# 2010 All-in-One For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.