On 1 October 2016 at 19:48, Richard Duivenvoorde <[email protected]> wrote: > Hi All, > > I've been contacted by a cartophil (no offence Jan ;-)), which sent me > the two attached images, and asked me if the labelbuffers you see there > could be done with QGIS... > > To precize: > > If you look in lblbuf1.png [0] (Dutch kadastral 1:10000 map) it looks > like the label 'Arnhemse Broek' is normally buffered on first side. But > better looking into it, it looks like it is ONLY ('transparently') > buffered the complement(?) color of the buffer. > So: text = black, so there is only a complement(?) of black == white > buffer, IF the buffer(!) is covering a pixel which has the same color as > the text (black in this case). > For example: looking at the top of the A in 'Arnhemse Broek' you see > that red is actually NOT having a buffer, but the little black casing of > the red, DOES have a buffer.. > > In lblbuf2.png (swiss topo map) if you look at the height-line/contour > labels, you see exactly the same: there is a buffer, but only if it is > over a line with the same color... > > Tried some label settings in QGIS with lblbuf3.png as nearest result... > Taking blue as labeltext, yellow (complement) as buffer color, and > Addition as blending. > > But as you see there the blending takes ALL colors into account, so you > have a slight buffering everywhere, and yellow artifacts in the red > pixels.... > > So diving into the code: > > Blending mode is here: > > https://github.com/qgis/QGIS/blob/master/src/core/qgspallabeling.cpp#L1009 > > Going to renderer: > > https://github.com/qgis/QGIS/blob/master/src/core/qgspainting.cpp#L6 > > Going to pretty low level qpainter behaviour: > > http://doc.qt.io/qt-5/qpainter.html#setCompositionMode > > http://doc.qt.io/qt-5/qpainter.html#CompositionMode-enum > > It looks like there are even more modes then are available in the > Blending dropdown in QGIS. > > I'm not so much into color theories, but is it possible that the use > case above is one of the composition modes which just is not in QGIS > blending mode dropdown yet? > > And if so: which one do you think? I can try to add it myself. > > OR is the usecase a custom blending mode (we are wondering then how the > dutch cadastre and the swiss topo are doing this... because it is NOT > part of esri apparently too....).
It's not a blending mode - it's a technique called "variable depth buffers" or "smart halos". - ArcGIS offers it, but requires precreation of a raster layer (see https://blogs.esri.com/esri/arcgis/2011/11/28/variable-depth-masking-contour-label-example/). - It can be done in Mapnik - see http://mapnik.org/news/smart-halos Hugo has been looking into this for QGIS - see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/63 Nyall > > Thanks for any pointers. > > Regards, > > Richard Duivenvoorde > > [0] > http://storage3.static.itmages.com/i/16/1001/h_1475315030_8477266_8bd662bb47.png > [1] > http://storage7.static.itmages.com/i/16/1001/h_1475315072_4576698_eaebba1bb0.png > [2] > http://storage1.static.itmages.com/i/16/1001/h_1475315103_2918295_e2b5874a36.png > _______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
