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

And here is a complete list.

Posted by KennyKerr with no comments
Filed under: , ,

I just don’t get twitter

I think I’m with Mickey on this one and may never post anything more, but to ensure that nobody confuses me with a few other notorious Kenny Kerr’s out there my twitter account is “kennykerr”.

 

 

Posted by KennyKerr with no comments

Window Clippings loves Windows 7

I received a few queries about this so I thought I better just make a quick statement: Window Clippings 2.1 works great on Windows 7.

 

I’ve also updated the website to point this out.

Posted by KennyKerr with 7 comment(s)
Filed under:

Windows Server 2008 R2 for MSDN Subscribers

It’s been just over a week since Windows 7 was made available to MSDN subscribers and now you can finally download the server version and with it version 2 of the best virtualization system on the planet!

Go and get it!

Posted by KennyKerr with no comments

Lenovo Website Blues

I’ve been dreaming of getting a Lenovo laptop for a few years. Don’t get me wrong, I love my Dell D630 but it may be time to upgrade soon. What frustrates me is how bad the Lenovo website experience is. Take the very appealing new T400s’ customization page:

Boy that’s one serious processor upgrade. For only $999,624.00 I can upgrade to the pathetic low-voltage 1.4GHz Core 2 Duo processor. This leaves me with a sales price of over a million dollars:

 

Now if only I was as lucky as John Robbins...

 

Posted by KennyKerr with 5 comment(s)

On the move again

Our house is now officially on the market. Anyone want to live in Tonbridge in Kent? We’re on our way back to Ontario in Canada after two years in England. This will be our last move!

In other news there have been some hiccups with scheduling at MSDN Magazine. My next article, on Direct2D again, will now appear in the September 2009 issue. I’ve also just finished another really fun article on the new Windows Web Services API that I’m really excited about. That’ll be in the October 2009 issue and I’ll probably write some more about it for the December 2009 issue.

We’re really looking forward to being back in Canada! Just as soon as we sell this house...

Posted by KennyKerr with 3 comment(s)

Asynchronous Agents

Rick Molloy, one of the masterminds behind the new concurrency runtime (concrt) and parallel patterns library (PPL), has written an article in the latest issue of MSDN Magazine demonstrating the new asynchronous agents library with the classic dining philosophers problem.

Concurrent Affairs: Solving The Dining Philosophers Problem With Asynchronous Agents

Enabling C++ developers to write highly concurrent applications is a major focus of Visual Studio 2010. The beta release includes the Concurrency Runtime, parallel libraries, and development tools aimed at addressing several common problems preventing developers from unlocking the performance potential inherent to multicore hardware. Notably, this includes ensuring that developers can identify and take advantage of opportunities for concurrency in their code, productively manage shared state and its side effects, and not having to worry about building low-overhead concurrency infrastructure that is scalable at run time on a variety of hardware.

In this article, I'm going to demonstrate how to use the new Asynchronous Agents Library included as part of Visual C++ 2010 to manage the difficulties that can arise with shared state. To show you how this works, I will walk through an implementation of a classic concurrency problem: Djikstra's Dining Philosophers. You'll see how the actor-based programming construct of an agent in combination with asynchronous message-passing APIs can be used to provide a correct and easy to understand solution to this problem that doesn't rely directly on threading or synchronization primitives.

Enjoy!

Posted by KennyKerr with no comments
Filed under: ,

Lost Carrier Pigeon

What do you when a carrier pigeon lands in your back yard seemingly lost?

It has bracelets around its feet with numbers but no email address.   :)

It’s pretty tame and let me pick it up to inspect its markings.

Posted by KennyKerr with 2 comment(s)

Windows with C++: Introducing Direct2D

I’ve been away from my computer for a few days working on a house renovation project and didn’t notice that my latest Windows with C++ column came out until the mail man delivered a copy of the June 2009 issue of MSDN Magazine.

In this issue I introduce a new technology that I’m very excited about. I’ve been waiting for Direct2D for some time. When Microsoft started pushing WPF as the “one true path” (TM) I just couldn’t persuade myself to buy the sales pitch. If you felt the same way then read on. This just might make your day.

Windows with C++: Introducing Direct2D

With the introduction of Windows Vista a few years ago, it was clear that the era of the Windows Graphics Device Interface (GDI) was coming to an end. GDI, even with the help of GDI+, had been showing its age especially when compared to the superior graphics capabilities of Windows Presentation Foundation (WPF). As if that weren't enough, GDI lost its hardware acceleration while WPF took advantage of Direct3D's abundance of hardware acceleration.

However, if you want to develop high-performance and high-quality commercial applications, you'll still look to C++ and native code to deliver that power. That's why few things excite me more about Windows 7 than the introduction of Direct2D and DirectWrite. Direct2D is a brand new 2D graphics API designed to support the most demanding and visually rich desktop applications with the best possible performance. DirectWrite is also a brand-new API that complements Direct2D and provides hardware-accelerated text, when used with Direct2D, and high-quality text layout and rendering with advanced support for OpenType typography and ClearType text rendering.

In this article, I will explore these new technologies and give you an idea of why it matters and how you can start using them today.

Big thanks to Mark Lawrence and Ben Constable, from the Direct2D team, for their feedback on the article as well as for providing a side bar discussing rendering performance.

Stay tuned for more Direct2D articles in my upcoming Windows with C++ columns.

If you’re looking for one of my previous articles here is a complete list of them for you to browse through.

Produce the highest quality screenshots with the least amount of effort! Use Window Clippings.

Posted by KennyKerr with 5 comment(s)
Filed under: , ,
More Posts « Previous page - Next page »