diff --git a/lib/carto/tree/style.js b/lib/carto/tree/style.js index f050e89..270d69e 100644 --- a/lib/carto/tree/style.js +++ b/lib/carto/tree/style.js @@ -5,13 +5,16 @@ var _ = require('underscore'); // return a stringified style for Mapnik tree.StyleXML = function(name, attachment, definitions, env) { var existing = {}; - var image_filters = [], direct_image_filters = [], comp_op = [], opacity = []; + var image_filters = [], image_filters_inflate = [], direct_image_filters = [], comp_op = [], opacity = []; for (var i = 0; i < definitions.length; i++) { for (var j = 0; j < definitions[i].rules.length; j++) { if (definitions[i].rules[j].name === 'image-filters') { image_filters.push(definitions[i].rules[j]); } + if (definitions[i].rules[j].name === 'image-filters-inflate') { + image_filters_inflate.push(definitions[i].rules[j]); + } if (definitions[i].rules[j].name === 'direct-image-filters') { direct_image_filters.push(definitions[i].rules[j]); } @@ -38,6 +41,10 @@ tree.StyleXML = function(name, attachment, definitions, env) { }).value().join(',') + '"'; } + if (image_filters_inflate.length) { + attrs_xml += ' image-filters-inflate="' + image_filters_inflate[0].value.ev(env).toString() + '"'; + } + if (direct_image_filters.length) { attrs_xml += ' direct-image-filters="' + _.chain(direct_image_filters) // prevent identical filters from being duplicated in the style diff --git a/test/rendering-mss/image-filters.mss b/test/rendering-mss/image-filters.mss index 79e611c..a333aa4 100644 --- a/test/rendering-mss/image-filters.mss +++ b/test/rendering-mss/image-filters.mss @@ -1,4 +1,5 @@ #layer { - image-filters:invert(); - direct-image-filters:invert(); + image-filters:invert(); + image-filters-inflate:true; + direct-image-filters:invert(); } \ No newline at end of file diff --git a/test/rendering-mss/image-filters.xml b/test/rendering-mss/image-filters.xml index 262f405..532cf81 100644 --- a/test/rendering-mss/image-filters.xml +++ b/test/rendering-mss/image-filters.xml @@ -1,2 +1,2 @@ - \ No newline at end of file