This project has moved and is read-only. For the latest updates, please go here.

Problem with Antialiasing drawing Metafiles

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0
Aug 19, 2010 at 11:51 AM

I use windows metafiles for VectorLayer.Style.Symbol, and Smoothmode set in AntiAlias. But I can't get antialiased image.

What's a problem?

Aug 19, 2010 at 4:44 PM

Hello nigr0nyx,

VectorStyle.Symbol is of type Bitmap, so I suppose your metafile symbol is rendered to a bitmap before being passed to the VectorStyle

Cheers FObermaier

Aug 20, 2010 at 5:53 AM
Edited Aug 20, 2010 at 5:57 AM

Thanks for reply, FObermaier.

I changed type of VectorStyle.Symbol from Bitmap to Image, and picture in metafile has vector format. Other WMF/EMF viewers display my metafiles correctly.  I think problem with GDI+, because this is very common problem.

Aug 20, 2010 at 10:45 AM

I've found decision, but I don't understand why that happens.


Aug 20, 2010 at 11:27 AM

What did you find, URL please


Aug 20, 2010 at 11:44 AM

I did experiments and I determined, when I create instance of Metafile by constructor, like that:

 Metafile mFile = new Metafile("Symblo.emf");

properties Size and Resolution are incorrect. That's why image drawing not antialiase.

For getting correct properties of metafile I serialized and deserialized instance.

And second moment, InterpolationMode can be set to HighQualityBicubic:

g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;