You can combine the two approaches of drawing on a WriteableBitmap. The next sample displays a Path on a WriteableBitmap against a gradient that uses transparency so that you can see how the premultiplied alphas work.
I’m sure you remember the Path element from the end of the previous chapter that displayed a cat from a string in the Silverlight Path Markup Syntax. The goal of the VectorToRaster program is to make a bitmap of precisely the right size for that cat, and then put that cat in the bitmap.
The Path Markup Syntax for the cat is defined in a Path element in the Resources section of the MainPage.xaml file:
Example 14-8. Silverlight Project: VectorToRaster File: MainPage.xaml (excerpt)