parsesvg: use new stroke-opacity and fill-opacity properties
This commit is contained in:
parent
d5a8eb4713
commit
f8b0c5548c
1 changed files with 17 additions and 14 deletions
|
@ -525,22 +525,26 @@ var parsesvg = func(group, path, options = nil)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
parsePath(attr['d']);
|
parsePath(attr['d']);
|
||||||
|
|
||||||
var fillOpacity = style['fill-opacity'];
|
var fill = style['fill'];
|
||||||
if( fillOpacity != nil)
|
if( fill != nil )
|
||||||
stack[-1].set('fill', style['fill'] ~ sprintf("%02x", int(style['fill-opacity']*255)));
|
stack[-1].set('fill', fill);
|
||||||
else
|
|
||||||
stack[-1].set('fill', style['fill']);
|
var fill_opacity = style['fill-opacity'];
|
||||||
|
if( fill_opacity != nil)
|
||||||
|
stack[-1].setDouble('fill-opacity', fill_opacity);
|
||||||
|
|
||||||
|
var stroke = style['stroke'];
|
||||||
|
if( stroke != nil )
|
||||||
|
stack[-1].set('stroke', stroke);
|
||||||
|
|
||||||
|
var stroke_opacity = style['stroke-opacity'];
|
||||||
|
if( stroke_opacity != nil)
|
||||||
|
stack[-1].setDouble('stroke-opacity', stroke_opacity);
|
||||||
|
|
||||||
var w = style['stroke-width'];
|
var w = style['stroke-width'];
|
||||||
stack[-1].setStrokeLineWidth( w != nil ? evalCSSNum(w) : 1 );
|
stack[-1].setStrokeLineWidth( w != nil ? evalCSSNum(w) : 1 );
|
||||||
|
|
||||||
var strokeOpacity = style['stroke-opacity'];
|
|
||||||
if(strokeOpacity != nil)
|
|
||||||
stack[-1].set('stroke', (style['stroke'] ~ sprintf("%02x", int(style['stroke-opacity']*255))));
|
|
||||||
else
|
|
||||||
stack[-1].set('stroke', style['stroke'] or "none");
|
|
||||||
|
|
||||||
var linecap = style['stroke-linecap'];
|
var linecap = style['stroke-linecap'];
|
||||||
if( linecap != nil )
|
if( linecap != nil )
|
||||||
stack[-1].setStrokeLineCap(style['stroke-linecap']);
|
stack[-1].setStrokeLineCap(style['stroke-linecap']);
|
||||||
|
@ -549,7 +553,6 @@ var parsesvg = func(group, path, options = nil)
|
||||||
if( linejoin != nil )
|
if( linejoin != nil )
|
||||||
stack[-1].setStrokeLineJoin(style['stroke-linejoin']);
|
stack[-1].setStrokeLineJoin(style['stroke-linejoin']);
|
||||||
|
|
||||||
|
|
||||||
# http://www.w3.org/TR/SVG/painting.html#StrokeDasharrayProperty
|
# http://www.w3.org/TR/SVG/painting.html#StrokeDasharrayProperty
|
||||||
var dash = style['stroke-dasharray'];
|
var dash = style['stroke-dasharray'];
|
||||||
if( dash and size(dash) > 3 )
|
if( dash and size(dash) > 3 )
|
||||||
|
|
Loading…
Reference in a new issue