Archive for the ‘Code’ Category

WPF animations are described through the use of Storyboard objects. They’re nice because a designer can create them in Blend and nobody has to mess with their XAML. Write a couple storyboards manually and you’ll see just how important that is. But storyboard objects animate only with respect to the simple passage of time. This [...]

Most projects I’ve worked on had to, at one time or another, required some manner of custom code to be executed in a loop, in real time (i.e. every frame or so), without interfering with other execution. Custom animations, poll-based listeners, and synchronized interop with D3DImage all fall into this category. One easy way to [...]

Performance Multithreading

Posted: June 1, 2009 in Code

It’s been a while since I’ve said anything here (actually I haven’t said much at all), but I wanted to share a general philosophy I take towards multithreading. I’ve seen a number of misconceptions out there, many of which I shared for some time, that I’d like to comment on. In my area of specialization, [...]

Let’s say you’re rendering a D3DImage, and you want to blit a texture to it. The logical thing to do is draw an untransformed quad to the scene, with corners at (-1,1), (1,1), (1,-1), and (-1,-1). Those same vertices would have a UV coordinate to read into the texture at, respectively, (0,1), (1,1), (1,0), and [...]

The ShaderEffect object allows you to register a dependency property bound to a texture sampler. It has a parameter allowing you to specify whether to use nearest-neighbor (point) filtering, or bilinear filtering. Unfortunately, WPF currently appears to completely ignore this parameter. After a little experimentation, I’ve discovered a simple rule it follows: If the brush [...]