Browse files

Added support for blend modes in Sandwich provider

  • Loading branch information...
1 parent 1d9c104 commit 92fa6384f9581af3044bc257dba789c2dab04433 @migurski migurski committed Apr 12, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 TileStache/Sandwich.py
View
12 TileStache/Sandwich.py
@@ -1,6 +1,15 @@
from . import Core
-from Blit import Color, Bitmap
+from Blit import Color, Bitmap, blends
+
+blend_modes = {
+ 'screen': blends.screen,
+ 'add': blends.add,
+ 'multiply': blends.multiply,
+ 'subtract': blends.subtract,
+ 'linear light': blends.linear_light,
+ 'hard light': blends.hard_light
+ }
class Provider:
"""
@@ -60,6 +69,7 @@ def renderTile(self, width, height, srs, coord):
#
kwargs = dict(opacity=float(layer.get('opacity', 1.0)))
+ kwargs['blendfunc'] = blend_modes.get(layer.get('mode', None), None)
if mask_name:
rendered = rendered.blend(foreground, tiles[mask_name], **kwargs)

0 comments on commit 92fa638

Please sign in to comment.