27
I don't understand why the DPI parameters on the RenderTargetBitmap are used the way they seem to be used.
Quite often I see code that deals with non-standard DPI settings by adjusting the image size based on the DPI like this:
new RenderTargetBitmap ((int) (width/96d)*dpi, (int) (height/96d)*dpi, dpi, dpi, PixelFormats.Pbgra32);
Examples:
http://blogs.msdn.com/b/jaimer/archive/2009/07/03/rendertargetbitmap-tips.aspx (via web.archive.org)
ContentControl + RenderTargetBitmap + empty image
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/984da366-33d3-4fd3-b4bd-4782971785f8/
Other times the dpi seems to be hard coded to either 96 or different values like so:
new RenderTargetBitmap (width, height, 96, 96, PixelFormats.Pbgra32);
Examples:
http://www.ericsink.com/wpf3d/3_Bitmap.html
http://dedjo.blogspot.com/2008/05/performance-appliance-of.html