Mono Ignores Graphics.InterpolationMode?

2019-08-08 18:56发布

问题:

I have a program that draws some vector graphics using System.Drawing and the Graphics class. The anti-aliasing works, kindof okay, but for my need I neede oversampling, so I create the starting image to be n times larger and then scale back the final image by n. On Window and .NET the resulting image looks great! However, on Mono 2.4.2.3 (Ubuntu 9.10 stock install), the intropolation is horrible. Here's how I'm scaling my images:

Bitmap bmp = new Bitmap(Bmp.Width / OverSampling, Bmp.Height / OverSampling);
Graphics g = Graphics.FromImage(bmp);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(Bmp, 0, 0, bmp.Width, bmp.Height);
g.Dispose();

From what I can tell there is no interpolation happening at all. Any ideas?

回答1:

Well I found this: http://www.mail-archive.com/mono-devel-list@lists.ximian.com/msg18099.html

I guess the underlying code of Mono's drawing routines are at fault. YAY! Now I get to write my own downscaler.



回答2:

See:

  • High quality image re-sampling in Mono/C#/ASP.NET
  • http://www.toptensoftware.com/blog/posts/17/high-quality-image-resampling-in-monolinux


标签: c# mono gdi+