Blurred symbols on point vector layers

Topics: SharpMap v0.9 / v1.x
May 5, 2014 at 2:32 PM
Hi

When I display a point layer with a symbol of an image the image is slightly blurred. I think it is caused by the DrawPoint method in VectorRenderer where the g.DrawImage method takes floats with decimal numbers and the fact that the symbols are therefore not placed on whole pixels causes the antialising to kick in. This is different from 0.9 that I am trying to convert from. Is there a way to work around this issue?

Best Regards
Justin Case
Editor
May 6, 2014 at 9:42 AM
Have you the SymbolScale=1.0?
May 6, 2014 at 12:47 PM
Yes, the symbolscale is 1, but the code looks like this
//if (symbolscale == 1f)
//{
//    g.DrawImageUnscaled(symbol, (int) (pp.X - symbol.Width/2f + offset.X),
//                                (int) (pp.Y - symbol.Height/2f + offset.Y));
//}
//else
//{
//    var width = symbol.Width*symbolscale;
//    var height = symbol.Height*symbolscale;
//    g.DrawImage(symbol, (int) pp.X - width/2 + offset.X*symbolscale,
//                        (int) pp.Y - height/2 + offset.Y*symbolscale, width, height);
//}
var width = symbol.Width * symbolscale;
var height = symbol.Height * symbolscale;
g.DrawImage(symbol, pp.X - width / 2 + offset.X * symbolscale,
                    pp.Y - height / 2 + offset.Y * symbolscale, width, height);
Where I believe the commented out code is what is was in 0.9. This means that it will never do the DrawImageUnscaled, which would give me the non-blurred symbols. The question is why someone commented out the old code which worked better.