25.2. A CDC is like a cranky six-legged ant

MFC formulates graphics in terms of a CDC class which encapsulates a handle to a device context. A device context is simply something that accepts graphics calls. A CDC can correspond to an onscreen window, to a printer, or to a region in memory that’s been tailored so as to behave like a virtual device context. The CDC class has one primary member, an old-style Windows HDC object holding a handle. The CDC class’s state also includes certain active tool objects. In addition, the CDC class has a wide range of graphics methods.

For the purposes of this section, let’s think of a CDC as a cranky six-legged ant. If you anger a CDC, it has the ability to kick up such a fuss that Windows will crash. (The ...

Get Software Engineering and Computer Games 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.