Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#2616 closed defect (fixed)

AGG - Polygon "outline" is drawn when outline is not specified

Reported by: havatv Owned by: tbonfort
Priority: normal Milestone:
Component: AGG Version: svn-trunk (development)
Severity: normal Keywords: AGG, polygon, composed symbol, outline
Cc: brage, sdlime, dmorissette

Description

When composing polygon symbols using a background colour and a foreground pattern in a different colour using AGG, there will be a 1 pixel outline in the background colour also where the border passes through the foreground pattern. This is not correct behaviour - outlines shall be specified explicitly.

Example (only rectangular polygons, but the same effect can be seen for all polygons): http://gis.umb.no/cgi-bin/mapserv_5.2dev1?map=/users/ikf/ikfht/mapserv/tests/polyfill_whitespace.map (you have to zoom out a bit to see all the borders...)

Here is an example of how this is specified in LAYER-> CLASS (white pattern on yellow background):

     STYLE
        COLOR 255 205 114
      END # style
      STYLE
	symbol "halvapent"
	SIZE 30
        COLOR 255 255 255
      END # style

Attachments (3)

2616-before.png (53.7 KB ) - added by tbonfort 16 years ago.
sample content rendered before the patch
2616-after.png (71.8 KB ) - added by tbonfort 16 years ago.
sample content rendered after the patch
polyfill_whitespace.map (3.5 KB ) - added by havatv 16 years ago.
Map file for the example pattern

Download all attachments as: .zip

Change History (13)

comment:1 by tbonfort, 16 years ago

see also #2749

comment:2 by brage, 16 years ago

Cc: brage added

comment:3 by tbonfort, 16 years ago

Cc: sdlime dmorissette added
Resolution: fixed
Status: newclosed

removed the outline drawing in r7974, (with all my apologies to the coast of Norway of #2749 :) )

this seems the correct way to do this, and users can add the outline back in by adding an outlinecolor + width to achieve the same effect

I'm wondering how many "my polygons are disjoint" messages we'll be getting on the mailing-lists :)

by tbonfort, 16 years ago

Attachment: 2616-before.png added

sample content rendered before the patch

by tbonfort, 16 years ago

Attachment: 2616-after.png added

sample content rendered after the patch

by havatv, 16 years ago

Attachment: polyfill_whitespace.map added

Map file for the example pattern

comment:4 by havatv, 16 years ago

I tried to test this with the nightly build now, but the colours went away for some reason. I might have some problems with my mapfile - I have included it as an attachment.

Here is the same example with the nightly version:

http://gis.umb.no/cgi-bin/mapserv_5.3dev?map=/users/ikf/ikfht/mapserv/tests/polyfill_whitespace.map

It seems as if the outlines are still there (in very light gray).

comment:5 by tbonfort, 16 years ago

the color disappearing is a side effect of the SIZE/WIDTH parameters passing to doubles (along with using symbolscale)

as for the outlines you see, that's what I was referring to in

I'm wondering how many "my polygons are disjoint" messages we'll be getting on the mailing-lists :)

see http://thread.gmane.org/gmane.comp.graphics.agg/2359/focus=2367 for an explanation

comment:6 by havatv, 16 years ago

I think I understand the effect of anti-aliasing that you describe.

My problem here is that I do not see the fill colour (the polygon "inside" - should be yellow in my case) when using the binary from the nightly (neither with AGG or GD)... I am using Firefox 3.0. 5.2 gives me the fill.

You can try the links provided above and see for yourself (AGG output).

in reply to:  6 comment:7 by tbonfort, 16 years ago

Replying to havatv:

My problem here is that I do not see the fill colour (the polygon "inside" - should be yellow in my case) when using the binary from the nightly (neither with AGG or GD)... I am using Firefox 3.0. 5.2 gives me the fill.

that's the part that i was referring to for the size/width bug when passed to doubles... will fix tonight

in reply to:  3 comment:8 by brage, 16 years ago

Replying to tbonfort:

removed the outline drawing in r7974, (with all my apologies to the coast of Norway of #2749 :) )

this seems the correct way to do this, and users can add the outline back in by adding an outlinecolor + width to achieve the same effect

I'm wondering how many "my polygons are disjoint" messages we'll be getting on the mailing-lists :)

I belive the problem is that mapserver is rendering the shapes on by one, so that the antialiasing is against the background instead of against the neighbouring shapes within the same layer. From what I can judge from the rather sparse agg documentation and examples, a possible solution might be to render all the shapes in a layer collectively with agg::render_scanlines_compound rather than individually with agg::render_scanlines. Compare the output of flash_rasterizer.cpp vs flash_rasterizer2.cpp on http://www.antigrain.com/demo/. However - I have no experience with agg, so I cannot say if this really is the solution for mapserver.

comment:9 by tbonfort, 16 years ago

the problem with the compund rasterizer is that it doesn't fit well with the mapserver way of drawing features:

we loop through all geometries, each time rendering it with its style(s)

this is incompatible with the compound rasterizer, which requires you to accumulate geometries, and then render the entire set with a *common* style

in reply to:  9 comment:10 by havatv, 16 years ago

Replying to tbonfort:

OK, I will test again in a couple of days.

Here comes some wild thoughts on the polygon rendering "problems" by someone who is not very much into rendering...

I guess there is not a way to turn off anti-aliasing in AGG for polygon boundaries (no anti-aliasing would normally be preferable for polygon networks, but perhaps not for isolated polygons). Could it be possible to achieve no anti-aliasing for polygons by buffering the polygon by some small distance before rendering, and then clip using the original polygon after rendering (similar to techniques for continuous tile rendering)?

Or, would it be possible to select AGG or GD rendering on a layer-by-layer basis? Then, AGG could be used for lines, points (and isolated polygons), while GD could be used for polygon networks...

Note: See TracTickets for help on using tickets.