Skip to content
This repository

Per-layer opacity and compositing #314

Closed
artemp opened this Issue October 11, 2011 · 6 comments

4 participants

Artem Pavlenko Dane Springmeyer felix-1128 novldp
Artem Pavlenko
Owner

Let's say I want to render a semi-transparent street overlay to render on top of an aerial image, and that I want to have the following layers:

  • Aerial image
  • Street overlay
  • Labels and point symbols

I would like the street overlay layer to be semi-transparent. If the individual symbolizers are semi-transparent, lots of rendering artifacts will appear:

  • Road casing and road fill will clash - the road casing will be visible through the road fill, and the road fill will be more opaque than the border.
  • Crossroads will be more opaque than the individual roads, as all roads will be rendered on top of each other.

Thus, the solution to this problem would be to have two new parameters for every layer: opacity and compositing mode.

Every layer should get its own canvas; once all elements in a layer have been rendered, that layer canvas is composed on top of the canvas for the resulting image.

For bonus points, instantiate canvases only for layers with 1.0 opacity and normal compositing, in order to not waste memory.

felix-1128

Hope it can be solved soon

Dane Springmeyer
Owner

/cc @ivansanchez and @novldp - who were the original reporters of this bug back when we used trac.

Dane Springmeyer
Owner

new work I'm about to commit implements this, adding a new style-level opacity value:

Whereas this is the same map with the same opacity value, but at the symbolizer level (the only previous option in older mapnik):

Dane Springmeyer springmeyer closed this in 48a543b June 19, 2012
Dane Springmeyer
Owner

should have mentioned that comp-op is now also supported at style level (as well as symbolizer level), and will be available in the upcoming 2.1.0 release.

novldp
novldp commented June 19, 2012

Awesome progress! This will indeed make life easy for these types of renders.

Dane Springmeyer
Owner

great to hear @novldp :)

Dane Springmeyer springmeyer referenced this issue from a commit June 21, 2012
Dane Springmeyer use the current buffer in markers, building, shield, and line pattern…
… symbolizers to ensure that style level opacity and compositing work - refs #1262 and #314
af519a4
Dane Springmeyer springmeyer referenced this issue from a commit June 21, 2012
Dane Springmeyer fix behavior of compositing via python api now that we have premultip…
…lication issues sorted out in core - refs #1262 and #314 and #1211
eb4740b
Andrew Harvey andrewharvey referenced this issue in andrewharvey/osm-hybrid-carto September 19, 2012
Open

use per layer opacity and compositing #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.