artemp/trac2github — Issue #158: Add transfer mode & opacity to RasterSymbolizer
Author: artemp
Created: 2011-10-09 20:17:14+00:00
State: open
Labels: Raster_Input_Driver

wiki:RasterSymbolizer would be more useful if it were possible to apply raster images with a transfer mode similar to those found in Photoshop. Currently, images are opaque, and can only be tinted by layering translucent polygons over them. For applications like hill shading it's desirable for there to be more interaction between the raster image and rendered mapnik cartography underneath. Attached is a number of example files showing the four transfer modes that are especially relevant here: ''multiply'', ''screen'', ''hard light'', ''linear light'', and ''luminosity''.

'''Multiply''' darkens a base image, by multiplying together each pixel with white = 1.0 and black = 0.0. Where the overlaid image is white, there is no change to the base image. Where the overlaid image is black, the output image is also black.

'''Screen''' lightens a base image, and is the opposite of ''multiply''. Where the overlaid image is black, there is no change to the base image. Where the overlaid image is white, the output image is also white.

'''Hard Light''' is a combination of ''screen'' and ''multiply''. Where the overlaid image is 50% gray, there is no change to the base image. Where the overlaid image is white, the output image is also white. Where the overlaid image is black, the output image is also black.

'''Linear Light''' is similar to ''hard light'', but the grays are handled slightly differently, added together instead of multiplied. The visual effect is like a harsher ''hard light''.

'''Luminosity''' replaces the lightness values of the base image entirely with those of the overlaid image. Only hue and saturation remain from the base image.