Monthly Archives: March 2014

Write an extension method to make saving a WriteableBitmap into a file easy using WPF and C#

In my post Create a bitmap and save it into a file using WPF, XAML, and C# I lamented (okay, whined) about how cumbersome it is to save a WriteableBitmap into a file. Fortunately there’s a way you can make … Continue reading

Posted in extension methods, graphics, wpf, XAML | Leave a comment

Make a BitmapPixelMaker class to make working with pixels in a WriteableBitmap easier using WPF and C#

After building the example Set the pixels in a bitmap using WPF, XAML, and C#, I couldn’t get it out of my head. Doing the math to set the correct bytes in a one-dimensional pixel array isn’t all that hard, … Continue reading

Posted in graphics, wpf | 1 Comment

Create a bitmap and save it into a file using WPF, XAML, and C#

The example Set the pixels in a bitmap using WPF, XAML, and C# shows how to create a WriteableBitmap in WPF. This example shows how to save the bitmap into a file. (Like many things in WPF, it’s not as … Continue reading

Posted in files, graphics | 1 Comment

Probabilistically pick large random prime numbers C#

The example Probabilistically determine whether a number is prime in C# explains an algorithm for determining whether a number is prime with any desired level of certainty. After you add that method to your algorithmic toolkit, finding large primes is … Continue reading

Posted in algorithms, mathematics | Leave a comment

Probabilistically determine whether a number is prime in C#

This is a cool little algorithm that uses some clever mathematics. This algorithm and several related algorithms are described in my book Essential Algorithms: A Practical Approach to Computer Algorithms. I think it’s a really good book (and it’s gotten … Continue reading

Posted in algorithms, mathematics | 1 Comment

Easily draw different styles of “illuminated” text in C#

The previous example showed how to draw “illuminated” text. It drew each paragraph’s initial letter in a large font with a box around it. Real illuminated manuscripts typically make the initial letter much more elaborate. You can modify that example … Continue reading

Posted in fonts, graphics, strings | Leave a comment