We are working on an Optical Character Recognition system and i want to compare how different renderers render text. I want to make a simple program that creates an image, writes some text on it with different fonts, sizes and styles and saves it to a .png file(I want to have all sizes, fonts styles i need in one file so they are easy to compare). I've managed to do it with GDI and GDI+ renderers using Bitmap. Now i'm trying to do the same thing in a WPF application, as I've heard rendering text there is different. Is it possible to use BitmapImage for that? Coming from Windows Forms I presume this problem should be pretty simple but i just can't seem to do it in WPF.
This is a simplified version of how i did it with GDI+ Renderer:
public void CreateAndSave()
{
Bitmap bitmap = new Bitmap(500, 500, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bitmap);
g.Clear(Color.White);
g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
g.DrawString("sample text", font, brush, x, y);
bitmap.Save(fileName);
}
Is there any similar way of doing this with WPF?