Question Details

No question body available.

Tags

c# wpf image xaml svg

Answers (1)

Accepted Answer Available
Accepted Answer
June 17, 2026 Score: 4 Rep: 39,761 Quality: Expert Completeness: 60%

When drawing vector shapes your lines will be anti aliased, and that will cause some amount of blurring if your lines do not exactly align with pixels on the screen. Some of your coordinates are not whole numbers, and that should support this idea.

So my primary recommendation would be to design your image for a specific resolution. Showing grid-lines in inkscape can help you visualize the "pixels". Make sure your lines perfectly align with the pixel-grid. You also need to ensure wpf draws your image in exactly this size. Ofc, if you design vector graphics for a specific pixel resolution, you might as well convert it to a bitmap. It may be easier to ensure that a bitmap image are not scaled in any way.

I'm not sure if UseLayoutRounding and SnapToDevicePixels apply for individual points in a pathGeometry, since that would distort the graphics. You could try specifying RenderOptions.EdgeMode="Aliased". While that should force lines to be sharp, it may affect the width of the lines and/or cells, and cause the image to look weird.

If you want to your image to look good at different resolutions (i.e. dpi) you will need to make some kind of compromise. If you have a line 1 pixel wide and scale it to 125% you can either draw it as 1.25 pixels, and accept some blurring, or round it down to 1 pixel, and accept that the line will thinner than it should.