Add comp-op support.
This commit is contained in:
parent
66012862db
commit
3e3b4f09bc
@ -55,6 +55,41 @@
|
||||
"default-meaning": "no filters",
|
||||
"type": "imagefilters",
|
||||
"doc": "A list of image filters. Currently supported are agg-stack-blur, emboss, blur, gray, sobel, edge-detect, x-gradient, y-gradient, sharpen"
|
||||
},
|
||||
"comp-op": {
|
||||
"css": "composite-operation",
|
||||
"default-value": "src-over",
|
||||
"default-meaning": "add the current layer on top of other layers",
|
||||
"doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
|
||||
"type": ["clear",
|
||||
"src",
|
||||
"dst",
|
||||
"src-over",
|
||||
"dst-over",
|
||||
"src-in",
|
||||
"dst-in",
|
||||
"src-out",
|
||||
"dst-out",
|
||||
"src-atop",
|
||||
"dst-atop",
|
||||
"xor",
|
||||
"plus",
|
||||
"minus",
|
||||
"multiply",
|
||||
"screen",
|
||||
"overlay",
|
||||
"darken",
|
||||
"lighten",
|
||||
"color-dodge",
|
||||
"color-burn",
|
||||
"hard-light",
|
||||
"soft-light",
|
||||
"difference",
|
||||
"exclusion",
|
||||
"contrast",
|
||||
"invert",
|
||||
"invert-rgb"
|
||||
]
|
||||
}
|
||||
},
|
||||
"map": {
|
||||
|
@ -16,19 +16,30 @@ tree.Style.prototype.toXML = function(env) {
|
||||
});
|
||||
}));
|
||||
|
||||
var comp_op = _.flatten(this.definitions.map(function(definition) {
|
||||
return definition.rules.filter(function(rule) {
|
||||
return (rule.name === 'composite-operation');
|
||||
});
|
||||
}));
|
||||
|
||||
var rules = this.definitions.map(function(definition) {
|
||||
return definition.toXML(env, existing);
|
||||
});
|
||||
|
||||
var image_filters_xml = '';
|
||||
var image_filters_xml = '',
|
||||
comp_op_xml = '';
|
||||
|
||||
if (image_filters.length) {
|
||||
image_filters_xml = 'image-filters="' + image_filters.map(function(f) {
|
||||
return f.value.eval(env).toString(env, null, ';');
|
||||
}).join(',') + '"';
|
||||
}
|
||||
|
||||
if (comp_op.length) {
|
||||
comp_op_xml = 'comp-op="' + comp_op[0].value.eval(env).toString() + '"';
|
||||
}
|
||||
|
||||
return '<Style name="' + this.name + '" filter-mode="first" ' + image_filters_xml + '>\n' + rules.join('') + '</Style>';
|
||||
return '<Style name="' + this.name + '" filter-mode="first" ' + image_filters_xml + ' ' + comp_op_xml + '>\n' + rules.join('') + '</Style>';
|
||||
};
|
||||
|
||||
})(require('../tree'));
|
||||
|
@ -3,5 +3,6 @@
|
||||
line-color:#F00;
|
||||
line-width: 0.5;
|
||||
image-filters: blur(), sharpen();
|
||||
composite-operation: src-in;
|
||||
line-dasharray: 2, 3;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user