Windows with C++: Drawing with Direct2D
My latest Windows with C++ column, "Drawing with Direct2D", just went live on the redesigned MSDN Magazine website. This is really a continuation of my previous column where I introduced Direct2D. From the article:
It is helpful to think about Direct2D as a hardware-accelerated 2-D rendering API. Of course, it supports software fallback, but the point here is that Direct2D is about rendering. Unlike other graphics APIs on Windows, Direct2D takes a componentized approach to graphics. It does not provide its own APIs for encoding and decoding bitmaps, text layout, font management, animation, 3-D and so on. Rather, it focuses on rendering and control over the graphics processing unit (GPU) while providing first class hooks to other APIs that focus on things like text layout and imaging. Direct2D does, however, provide primitives for representing different types of brushes as well as simple and complex shapes, the building blocks for any 2-D graphics application.
In this article, I'm going to show you how to draw with Direct2D. I'll begin by introducing Direct2D's color structure and then
show you how to create various types of brushes. Unlike most of the other graphics APIs on Windows, Direct2D doesn't provide a "pen" primitive, so brushes are pretty important as they're used for all outline and filling tasks. With that out of the way, I'll show you how to draw primitive shapes.
I hope you enjoy it. Right now I’m finishing up the December issue of Windows with C++ where I dive into Direct2D interoperability.
Here are links to some of the most recent Windows with C++ columns:
June 2009 – Introducing Direct2D
April 2009 – The Virtual Disk API in Windows 7
February 2009 – Visual C++ 2010 and the Parallel Patterns Library
December 2008 – x64 Debugging With Pseudo Variables and Format Specifiers
October 2008 – Exploring High-Performance Algorithms
August 2008 – Asynchronous WinHTTP