diff --git a/Nasal/canvas/svg.nas b/Nasal/canvas/svg.nas index b542b31c3..d7fe570a3 100644 --- a/Nasal/canvas/svg.nas +++ b/Nasal/canvas/svg.nas @@ -525,13 +525,22 @@ var parsesvg = func(group, path, options = nil) } else parsePath(attr['d']); - - stack[-1].set('fill', style['fill']); + + var fillOpacity = style['fill-opacity']; + if( fillOpacity != nil) + stack[-1].set('fill', style['fill'] ~ sprintf("%02x", int(style['fill-opacity']*255))); + else + stack[-1].set('fill', style['fill']); var w = style['stroke-width']; stack[-1].setStrokeLineWidth( w != nil ? evalCSSNum(w) : 1 ); - stack[-1].set('stroke', style['stroke'] or "none"); - + + 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']; if( linecap != nil ) stack[-1].setStrokeLineCap(style['stroke-linecap']);