qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.68k stars 3.02k forks source link

"Ghost Lines" when using Anti-aliasing, polygons with shared boundaries, and no outline/QT::NoPen #12023

Open qgib opened 15 years ago

qgib commented 15 years ago

Author Name: springmeyer - (springmeyer -) Original Redmine Issue: 1963 Affected QGIS version: master Redmine category:map_canvas


QT's anti-aliasing output exhibits an inherent limitation of AA, where polygon edges are drawn/feathered twice and the background color "bleeds" through what are supposed to be tightly shared edges of polygons.

I wonder if some of the new render hints in QT4.4 > might help work around this issue:

http://doc.trolltech.com/4.5/qpainter.html#RenderHint-enum

See also: http://trac.mapnik.org/ticket/428, where I am working on a workaround using AGG that may apply to the QT renderer, given an exposed API.


qgib commented 14 years ago

Author Name: Paolo Cavallini (@pcav)


Is this a QGIS, or a Qt bug?

qgib commented 14 years ago

Author Name: springmeyer - (springmeyer -)


QT limitation which may benefit from workarounds in QGIS. I think this is an important ticket to have open for other users to see, or potentially as an FAQ only if we don't find an easy solution.

qgib commented 14 years ago

Author Name: Paolo Cavallini (@pcav)


Is this still true for current Qt and QGIS versions? Please confirm.

qgib commented 14 years ago

Author Name: John Tull (John Tull)


This problem still exists in trunk with the most recent Qt release.

qgib commented 13 years ago

Author Name: Tim Sutton (Tim Sutton)


Hi

I did a little test using both:

QPainter::SmoothPixmapTransform
QPainter::HighQualityAntialiasing

In src/gui/qgsmapcanvasmap.cpp for [[AntiAlias]] flags. Both choices did not resolve the issue for me. Using:

QGIS e93c1841 (SVN r15735) Trunk
Qt 4.7
qgib commented 13 years ago

Author Name: springmeyer - (springmeyer -)


We solved this sufficiently in Mapnik within the AGG renderer by allowing the user to control the AA gamma. A gamma of 0 is aliased while 1 is fully anti-aliased and setting gamma to around .6-.7 is able to remove the faint lines while keeping an AA-ish look with much more definition to edges (like coastlines) than can be achieved by the only other known workaround: overpainting with a thin line of the same color as the polygon fill. In short, we solved this by reducing the aggressiveness of the AA algorithm so that polygons are slightly dilated rather are fully AA or aliased.

So, I assume that QT will expose somewhere an equivalent gamma setting (or partial AA ability) - as QT's renderer is originally based on AGG (http://labs.qt.nokia.com/2009/12/18/qt-graphics-and-performance-the-raster-engine/)

qgib commented 13 years ago

Author Name: Tim Sutton (Tim Sutton)


Reading the the referenced article it seems they only were inspired by AGG and didnt directly use any source code from AGG in their implementation. It seems like Qt4 rendering engine does not expose any agg-like gamma options and there isnt really any reasonable work around we can come up with for this. I am going to close this ticket since the only way to resolve this issue currently is to disable AA rendering it would seem and there isnt anything else we can do to fix it.


qgib commented 13 years ago

Author Name: springmeyer - (springmeyer -)


Okay.

qgib commented 11 years ago

Author Name: Henrik Uggla (@huggla)


Turning off "Make lines appear less jagged..." removes the thin lines on the screen but they still show when printing (see attached pdf). I can find no option for disabling anti-aliasing in the composer. Applies to both Windows7 and ubuntugis.

Note regarding attached pdf: The thin lines are displayed differently in different pdf-viewers.



qgib commented 10 years ago

Author Name: Jürgen Fischer (@jef-n)


qgib commented 7 years ago

Author Name: Johannes Kroeger (Johannes Kroeger)


I realised that #16269 and #18620 were duplicates of this and closed them accordingly.

Has anything happened in the past years or maybe, hopefully, in QT5 that allows this to be fixed? It would highly improve cartographic quality in some use cases.

If not, a "use fill color for stroke" checkbox would be nice, if that indeed is a workaround for this (as suggested in the duplicates). It could be a useful addition for other use cases as well maybe?

qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 6 years ago

Author Name: Johannes Kroeger (Johannes Kroeger)


A workaround to this is:

Set the Stroke width to Hairline Set the Stroke color to @@symbol_color@ using Data defined override

I forgot who shared this, either Nathan or Nyall. :)

qgib commented 6 years ago

Author Name: Giovanni Manghi (@gioman)


Johannes Kroeger wrote:

A workaround to this is:

Set the Stroke width to Hairline Set the Stroke color to @@symbol_color@ using Data defined override

I forgot who shared this, either Nathan or Nyall. :)

is this in the docs? Can't find it.


I wonder if some of the new render hints in QT4.4 > might help work around this issue:

http://doc.trolltech.com/4.5/qpainter.html#RenderHint-enum

See also: http://trac.mapnik.org/ticket/428, where I am working on a workaround using AGG that may apply to the QT renderer, given an exposed API. to QT's anti-aliasing output exhibits an inherent limitation of AA, where polygon edges are drawn/feathered twice and the background color "bleeds" through what are supposed to be tightly shared edges of polygons.

I wonder if some of the new render hints in QT4.4 > might help work around this issue:

http://doc.trolltech.com/4.5/qpainter.html#RenderHint-enum

See also: http://trac.mapnik.org/ticket/428, where I am working on a workaround using AGG that may apply to the QT renderer, given an exposed API.

qgib commented 6 years ago

Author Name: Johannes Kroeger (Johannes Kroeger)


I don't think so, it was either on IRC or Twitter.

This issue remains, please keep it opened. The workaround is just that, a workaround!

kannes commented 3 years ago

I just realised this issue had been closed back then but it still exists and is still a major rendering issue. Please re-open, I think it was only closed by accident.

gioman commented 3 years ago

it still exists and is still a major rendering issue

@kannes but it should still be an upstream issue in QT, as far as I understand.

kannes commented 3 years ago

Once/if upstream fixes this, it might require some changes in QGIS I think or maybe a workaround can be found to fix the issue in another way. Having it open with that tag seems like a good setup to me, thank you!

Maybe even that silly workaround could be integrated (cue Clippy asking "It seems like you want to disable outlines for polygons, this will lead to visible boundaries between neighboring polygons due to a bug in Qt, would like to enable a workaround?") as a little fix.

antoniolocandro commented 1 year ago

Glad I found this ticket, thank you for keeping it open for knowledge. Still present in latest QGIS version 3.35.0-Master QGIS code revision b508e4f87e

image image

iuuniang commented 1 month ago

After testing, this problem still exists in qgis version 3.38.3, resulting in a very unattractive effect of the printed map.