I have a C # application for which I wrote GDI + code that uses Bitmap / TextureBrush rendering to represent 2D images that can have various image processing functions. 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, which I compare with the release of the new GDI + code.
A simple test case that appears in a viewport that matches the size of the bitmap (i.e., without scaling or panning) does not match the ideal pixel (without a binary break) - but as soon as the image is enlarged (enlarged), I get very slight differences in 5-10% of the pixels. The difference is 1 (sometimes 2) / 256. I suspect this is due to differences in interpolation.
Question For a DX9 orthoprojection (and peaceful identity space), with a camera perpendicular and centered on a textured square, is it reasonable to expect DirectX.Direct3D.TextureFilter.Linear to generate identical rectangle / polygon output filled with GDI + TextureBrush when using System.Drawing . Setting up Drawing2D.InterpolationMode.Bilinear ?
For this (increase) case, the DX9 code is used (MinFilter, MipFilter is set similarly):
Device.SetSamplerState(0, SamplerStageStates.MagFilter, (int)TextureFilter.Linear);
and the GDI + path uses: g.InterpolationMode = InterpolationMode.Bilinear;
I thought that “Bilinear Interpolation” was a rather specific filter definition, but then I noticed that in GDI + there is another option for “HighQualityBilinear” (which I tried without a difference), which makes sense, given the description “added preliminary filtering for compression ")
Question about the next question: Is it possible to expect that the correspondence between pixels and DirectX and GDI + will correspond to a pixel? (provided that all external coordinates are passed equal)? If not, why not?
Clarification: The images I use are opaque shades of gray (R = G = B, A = 1) using Format32bppPArgb.
Finally, there are a number of other APIs that I could use (Direct2D, WPF, GDI, etc.) - and this question is usually used to compare the output of the "equivalent" bilinear interpolated output images for either of the two. Thanks!