Bug report #8980
svg fill issue: lines not rendered correctly
|Affected QGIS version:
|Pull Request or Patch supplied:
|Crashes QGIS or corrupts data:
|Copied to github as #:
I attach here a svg that is being used to fill polygons.
The pattern of the svg is made of simple, sharp lines/dots.
When applied in qgis the result is that not all the pattern is rendered in the same way, see attached screenshot.
#3 Updated by Radim Blazek about 10 years ago
There are two kind of irregularities with sv11.svg which do apply to any use of that svg including point markers and line markers. See attached a single tile render.png rendered by render.py
1) The first row of lines is cut to half by top border. That is not surprising, the graphics go out of the SVG border (half of the line width) and thus it is cut of. I consider this a feature. Solution is to design the SVG so that graphics are withing the SVG extent.
2) Even/odd rows (similar for columns but less obvious) are rendered different (1px black x 2px gray). That is due to antialiasing used when the SVG is rendered to an image (depends where line float coordinates fall into image pixels). Qt SVG module has hardcoded antialiasing on as mentione for example here http://qt-project.org/faq/answer/how_to_toggle_antialiasing_for_svg_rendering even not explicitly stated in Qt doc. Strange thing is, that even when the SVG is stored as QPicture the picture is still antialiased when rendered on image, see attached picture.py. Anyway, we want to use antialiased rendering of SVG files to get smooth symbols.
To be honest, I don't know clean solution for this problem. It would be probably possible to render the tile on bigger image and then scale it down using QPainter::SmoothPixmapTransform but that would decrease quality of all SVG symbols.
Is it the SVG pattern a workaround for line pattern fill bug in 2.0?