Note that there are some explanatory texts on larger screens.

plurals
  1. POBilinear interpolation - DirectX vs. GDI+
    primarykey
    data
    text
    <p>I have a C# app for which I've written GDI+ code that uses Bitmap/TextureBrush rendering to present 2D images, which can have various image processing functions applied. This code is a new path in an application that mimics existing DX9 code, and they share a common library to perform all vector and matrix (e.g. ViewToWorld/WorldToView) operations. My test bed consists of DX9 output images that I compare against the output of the new GDI+ code.</p> <p>A simple test case that renders to a viewport that matches the Bitmap dimensions (i.e. no zoom or pan) <em>does</em> match pixel-perfect (no binary diff) - but as soon as the image is zoomed up (magnified), I get very minor differences in 5-10% of the pixels. The magnitude of the difference is 1 (occasionally 2)/256. I suspect this is due to interpolation differences.</p> <p><b>Question</b>: For a DX9 ortho projection (and identity world space), with a camera perpendicular and centered on a textured quad, is it reasonable to expect <a href="http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&amp;l=EN-US&amp;k=k(MICROSOFT.DIRECTX.DIRECT3D.TEXTUREFILTER);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV3.5%22);k(DevLang-CSHARP)&amp;rd=true" rel="nofollow">DirectX.Direct3D.TextureFilter.Linear</a> to generate identical output to a GDI+ TextureBrush filled rectangle/polygon when using the <a href="http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&amp;l=EN-US&amp;k=k(SYSTEM.DRAWING.DRAWING2D.INTERPOLATIONMODE);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV3.5%22);k(DevLang-CSHARP)&amp;rd=true" rel="nofollow">System.Drawing.Drawing2D.InterpolationMode.Bilinear</a> setting?</p> <p>For this (magnification) case, the DX9 code is using this (MinFilter,MipFilter set similarly):<br> <code>Device.SetSamplerState(0, SamplerStageStates.MagFilter, (int)TextureFilter.Linear);</code></p> <p>and the GDI+ path is using: <code>g.InterpolationMode = InterpolationMode.Bilinear;</code></p> <p>I thought that "Bilinear Interpolation" was a fairly specific filter definition, but then I noticed that there is another option in GDI+ for "HighQualityBilinear" (which I've tried, with no difference - which makes sense given the description of "added prefiltering for shrinking")</p> <p><b>Followup Question:</b> Is it reasonable to expect pixel-perfect output matching between DirectX and GDI+ (assuming all external coordinates passed in are equal)? If not, why not?</p> <p><b>Clarification:</b> The images I'm using are opaque grayscale (R=G=B, A=1) using Format32bppPArgb.</p> <p>Finally, there are a number of other APIs I could be using (Direct2D, WPF, GDI, etc.) - and this question generally applies to comparing the output of "equivalent" bilinear interpolated output images across any two of these. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload